From: Mike Frysinger Date: Mon, 5 Mar 2012 03:56:52 +0000 (-0500) Subject: sf: inline data constants X-Git-Tag: v2012.10-rc1~423 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a4ed3b6;p=oweals%2Fu-boot.git sf: inline data constants I imagine much of these constants are due to copy & pasting previous drivers rather than an actual reflection of the hardware layout. At any rate, inline the info that we don't care about externally as it shrinks things nicely. Signed-off-by: Mike Frysinger --- diff --git a/drivers/mtd/spi/eon.c b/drivers/mtd/spi/eon.c index 6a3bf0f322..eccdf833df 100644 --- a/drivers/mtd/spi/eon.c +++ b/drivers/mtd/spi/eon.c @@ -16,9 +16,6 @@ struct eon_spi_flash_params { u8 idcode1; - u16 page_size; - u16 pages_per_sector; - u16 sectors_per_block; u16 nr_sectors; const char *name; }; @@ -26,25 +23,16 @@ struct eon_spi_flash_params { static const struct eon_spi_flash_params eon_spi_flash_table[] = { { .idcode1 = 0x16, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_sectors = 1024, .name = "EN25Q32B", }, { .idcode1 = 0x18, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_sectors = 4096, .name = "EN25Q128", }, { .idcode1 = 0x16, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_sectors = 1024, .name = "EN25Q32B", }, @@ -84,10 +72,9 @@ struct spi_flash *spi_flash_probe_eon(struct spi_slave *spi, u8 *idcode) flash->write = spi_flash_cmd_write_multi; flash->erase = eon_erase; flash->read = spi_flash_cmd_read_fast; - flash->page_size = params->page_size; - flash->sector_size = params->page_size * params->pages_per_sector - * params->sectors_per_block; - flash->size = params->page_size * params->pages_per_sector + flash->page_size = 256; + flash->sector_size = 256 * 16 * 16; + flash->size = 256 * 16 * params->nr_sectors; return flash; diff --git a/drivers/mtd/spi/macronix.c b/drivers/mtd/spi/macronix.c index 87a3ad0c30..894b1ca2b4 100644 --- a/drivers/mtd/spi/macronix.c +++ b/drivers/mtd/spi/macronix.c @@ -42,9 +42,6 @@ struct macronix_spi_flash_params { u16 idcode; - u16 page_size; - u16 pages_per_sector; - u16 sectors_per_block; u16 nr_blocks; const char *name; }; @@ -52,57 +49,36 @@ struct macronix_spi_flash_params { static const struct macronix_spi_flash_params macronix_spi_flash_table[] = { { .idcode = 0x2013, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 8, .name = "MX25L4005", }, { .idcode = 0x2014, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 16, .name = "MX25L8005", }, { .idcode = 0x2015, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 32, .name = "MX25L1605D", }, { .idcode = 0x2016, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 64, .name = "MX25L3205D", }, { .idcode = 0x2017, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 128, .name = "MX25L6405D", }, { .idcode = 0x2018, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 256, .name = "MX25L12805D", }, { .idcode = 0x2618, - .page_size = 256, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 256, .name = "MX25L12855E", }, @@ -182,9 +158,8 @@ struct spi_flash *spi_flash_probe_macronix(struct spi_slave *spi, u8 *idcode) flash->write = spi_flash_cmd_write_multi; flash->erase = macronix_erase; flash->read = spi_flash_cmd_read_fast; - flash->page_size = params->page_size; - flash->sector_size = params->page_size * params->pages_per_sector - * params->sectors_per_block; + flash->page_size = 256; + flash->sector_size = 256 * 16 * 16; flash->size = flash->sector_size * params->nr_blocks; /* Clear BP# bits for read-only flash */ diff --git a/drivers/mtd/spi/spansion.c b/drivers/mtd/spi/spansion.c index 457cc06298..bedde0760d 100644 --- a/drivers/mtd/spi/spansion.c +++ b/drivers/mtd/spi/spansion.c @@ -38,7 +38,6 @@ struct spansion_spi_flash_params { u16 idcode1; u16 idcode2; - u16 page_size; u16 pages_per_sector; u16 nr_sectors; const char *name; @@ -48,7 +47,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = 0x0213, .idcode2 = 0, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 16, .name = "S25FL008A", @@ -56,7 +54,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = 0x0214, .idcode2 = 0, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 32, .name = "S25FL016A", @@ -64,7 +61,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = 0x0215, .idcode2 = 0, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 64, .name = "S25FL032A", @@ -72,7 +68,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = 0x0216, .idcode2 = 0, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 128, .name = "S25FL064A", @@ -80,7 +75,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = 0x2018, .idcode2 = 0x0301, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 256, .name = "S25FL128P_64K", @@ -88,7 +82,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = 0x2018, .idcode2 = 0x0300, - .page_size = 256, .pages_per_sector = 1024, .nr_sectors = 64, .name = "S25FL128P_256K", @@ -96,7 +89,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = 0x0215, .idcode2 = 0x4d00, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 64, .name = "S25FL032P", @@ -104,7 +96,6 @@ static const struct spansion_spi_flash_params spansion_spi_flash_table[] = { { .idcode1 = 0x2018, .idcode2 = 0x4d01, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 256, .name = "S25FL129P_64K", @@ -151,8 +142,8 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode) flash->write = spi_flash_cmd_write_multi; flash->erase = spansion_erase; flash->read = spi_flash_cmd_read_fast; - flash->page_size = params->page_size; - flash->sector_size = params->page_size * params->pages_per_sector; + flash->page_size = 256; + flash->sector_size = 256 * params->pages_per_sector; flash->size = flash->sector_size * params->nr_sectors; return flash; diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c index 5b684792de..6f7b807da2 100644 --- a/drivers/mtd/spi/stmicro.c +++ b/drivers/mtd/spi/stmicro.c @@ -40,7 +40,6 @@ struct stmicro_spi_flash_params { u8 idcode1; - u16 page_size; u16 pages_per_sector; u16 nr_sectors; const char *name; @@ -49,56 +48,48 @@ struct stmicro_spi_flash_params { static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = { { .idcode1 = 0x11, - .page_size = 256, .pages_per_sector = 128, .nr_sectors = 4, .name = "M25P10", }, { .idcode1 = 0x15, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 32, .name = "M25P16", }, { .idcode1 = 0x12, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 4, .name = "M25P20", }, { .idcode1 = 0x16, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 64, .name = "M25P32", }, { .idcode1 = 0x13, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 8, .name = "M25P40", }, { .idcode1 = 0x17, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 128, .name = "M25P64", }, { .idcode1 = 0x14, - .page_size = 256, .pages_per_sector = 256, .nr_sectors = 16, .name = "M25P80", }, { .idcode1 = 0x18, - .page_size = 256, .pages_per_sector = 1024, .nr_sectors = 64, .name = "M25P128", @@ -153,8 +144,8 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) flash->write = spi_flash_cmd_write_multi; flash->erase = stmicro_erase; flash->read = spi_flash_cmd_read_fast; - flash->page_size = params->page_size; - flash->sector_size = params->page_size * params->pages_per_sector; + flash->page_size = 256; + flash->sector_size = 256 * params->pages_per_sector; flash->size = flash->sector_size * params->nr_sectors; return flash; diff --git a/drivers/mtd/spi/winbond.c b/drivers/mtd/spi/winbond.c index 0e126f40c5..d1358ea24b 100644 --- a/drivers/mtd/spi/winbond.c +++ b/drivers/mtd/spi/winbond.c @@ -17,10 +17,6 @@ struct winbond_spi_flash_params { uint16_t id; - /* Log2 of page size in power-of-two mode */ - uint8_t l2_page_size; - uint16_t pages_per_sector; - uint16_t sectors_per_block; uint16_t nr_blocks; const char *name; }; @@ -28,73 +24,46 @@ struct winbond_spi_flash_params { static const struct winbond_spi_flash_params winbond_spi_flash_table[] = { { .id = 0x3013, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 8, .name = "W25X40", }, { .id = 0x3015, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 32, .name = "W25X16", }, { .id = 0x3016, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 64, .name = "W25X32", }, { .id = 0x3017, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 128, .name = "W25X64", }, { .id = 0x4014, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 16, .name = "W25Q80BL", }, { .id = 0x4015, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 32, .name = "W25Q16", }, { .id = 0x4016, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 64, .name = "W25Q32", }, { .id = 0x4017, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 128, .name = "W25Q64", }, { .id = 0x4018, - .l2_page_size = 8, - .pages_per_sector = 16, - .sectors_per_block = 16, .nr_blocks = 256, .name = "W25Q128", }, @@ -110,7 +79,6 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode) const struct winbond_spi_flash_params *params; struct spi_flash *flash; unsigned int i; - unsigned page_size; for (i = 0; i < ARRAY_SIZE(winbond_spi_flash_table); i++) { params = &winbond_spi_flash_table[i]; @@ -133,17 +101,12 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode) flash->spi = spi; flash->name = params->name; - /* Assuming power-of-two page size initially. */ - page_size = 1 << params->l2_page_size; - flash->write = spi_flash_cmd_write_multi; flash->erase = winbond_erase; flash->read = spi_flash_cmd_read_fast; - flash->page_size = page_size; - flash->sector_size = page_size * params->pages_per_sector; - flash->size = page_size * params->pages_per_sector - * params->sectors_per_block - * params->nr_blocks; + flash->page_size = 4096; + flash->sector_size = 4096; + flash->size = 4096 * 16 * params->nr_blocks; return flash; }