]> git.sur5r.net Git - u-boot/commitdiff
sf: inline data constants
authorMike Frysinger <vapier@gentoo.org>
Mon, 5 Mar 2012 03:56:52 +0000 (22:56 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 5 Mar 2012 03:56:52 +0000 (22:56 -0500)
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 <vapier@gentoo.org>
drivers/mtd/spi/eon.c
drivers/mtd/spi/macronix.c
drivers/mtd/spi/spansion.c
drivers/mtd/spi/stmicro.c
drivers/mtd/spi/winbond.c

index 6a3bf0f3221365e80041a18ad1f84c2d93a5c410..eccdf833df05a742b20a606ec5d4232784cd3e4d 100644 (file)
@@ -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;
index 87a3ad0c30259eec6bebb34780d984cde4b6214a..894b1ca2b4ca63839b4d30331c1ed1ed41ca20f4 100644 (file)
@@ -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 */
index 457cc0629852fe0119df4154edfeefd2e8b0dd39..bedde0760db6d2408dc8f8ac3c311b2d2273027e 100644 (file)
@@ -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;
index 5b684792deca53e7ccc5a2980a382e3395e6a5d6..6f7b807da2ce12bcaf6eeeccf14672d458bd0527 100644 (file)
@@ -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;
index 0e126f40c5e55ac9e39498c0eab585583f850e5b..d1358ea24b74f5ac838c6f54ed66a8dbdc3f3509 100644 (file)
 
 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;
 }