struct eon_spi_flash_params {
u8 idcode1;
- u16 page_size;
- u16 pages_per_sector;
- u16 sectors_per_block;
u16 nr_sectors;
const char *name;
};
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",
},
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;
struct macronix_spi_flash_params {
u16 idcode;
- u16 page_size;
- u16 pages_per_sector;
- u16 sectors_per_block;
u16 nr_blocks;
const char *name;
};
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",
},
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 */
struct spansion_spi_flash_params {
u16 idcode1;
u16 idcode2;
- u16 page_size;
u16 pages_per_sector;
u16 nr_sectors;
const char *name;
{
.idcode1 = 0x0213,
.idcode2 = 0,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 16,
.name = "S25FL008A",
{
.idcode1 = 0x0214,
.idcode2 = 0,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 32,
.name = "S25FL016A",
{
.idcode1 = 0x0215,
.idcode2 = 0,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 64,
.name = "S25FL032A",
{
.idcode1 = 0x0216,
.idcode2 = 0,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 128,
.name = "S25FL064A",
{
.idcode1 = 0x2018,
.idcode2 = 0x0301,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 256,
.name = "S25FL128P_64K",
{
.idcode1 = 0x2018,
.idcode2 = 0x0300,
- .page_size = 256,
.pages_per_sector = 1024,
.nr_sectors = 64,
.name = "S25FL128P_256K",
{
.idcode1 = 0x0215,
.idcode2 = 0x4d00,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 64,
.name = "S25FL032P",
{
.idcode1 = 0x2018,
.idcode2 = 0x4d01,
- .page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 256,
.name = "S25FL129P_64K",
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;
struct stmicro_spi_flash_params {
u8 idcode1;
- u16 page_size;
u16 pages_per_sector;
u16 nr_sectors;
const char *name;
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",
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;
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;
};
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",
},
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];
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;
}