#define CMD_M25PXX_RES 0xab /* Release from DP, and Read Signature */
struct stmicro_spi_flash_params {
- u8 idcode1;
- /* XILINX: idcode1 isn't specific enough;
- * multiple non-compatible devices match. Store complete idcode */
- u32 idcode;
+ u16 idcode1;
u16 page_size;
u16 pages_per_sector;
u16 nr_sectors;
.nr_sectors = 16,
.name = "M25P80",
},
-/*
- * XILINX:
- * This table only examines the capacity of the device.
- * The M25P128 and N25Q128 have the same capacity (16777216)
- * but different number of sectors, pages per sector.
- * Match the N25Q128 which is actually present on the board.
- */
{
- .idcode1 = 0x18,
- .idcode = 0x20BB1810,
+ .idcode1 = 0x2018,
+ .page_size = 256,
+ .pages_per_sector = 1024,
+ .nr_sectors = 64,
+ .name = "M25P128",
+ },
+ {
+ .idcode1 = 0xBB18,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 256,
.name = "N25Q128_1.8V",
},
{
- .idcode1 = 0x18,
- .idcode = 0x20BA1810,
+ .idcode1 = 0xBA18,
.page_size = 256,
.pages_per_sector = 256,
.nr_sectors = 256,
.name = "N25Q128_3V",
},
- {
- .idcode1 = 0x18,
- .page_size = 256,
- .pages_per_sector = 1024,
- .nr_sectors = 64,
- .name = "M25P128",
- },
};
static int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len)
for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) {
params = &stmicro_spi_flash_table[i];
- if (params->idcode1 == idcode[2]) {
- if (params->idcode == 0) {
- break;
- }
- /* Check complete device ID, if specified */
- if ((((params->idcode & 0xFF000000) >> 24) == idcode[0]) &&
- (((params->idcode & 0x00FF0000) >> 16) == idcode[1]) &&
- (((params->idcode & 0x000000FF) >> 0) == idcode[3])) {
- break;
- }
- }
+ if (params->idcode1 == ((idcode[1] << 8) | idcode[2]))
+ break;
}
if (i == ARRAY_SIZE(stmicro_spi_flash_table)) {
- debug("SF: Unsupported STMicro ID %02x\n", idcode[1]);
+ debug("SF: Unsupported STMicro ID %02x %02x\n",
+ idcode[1], idcode[2]);
return NULL;
}