diff options
author | Wolfgang Denk <wd@denx.de> | 2010-07-04 23:36:11 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-07-04 23:36:11 +0200 |
commit | f12d4cb48a1040c25a55148d0eedee1a896364e6 (patch) | |
tree | 8d7e6120f059a2436d3e21db3644994c24b6ea2d /drivers/mtd/spi/stmicro.c | |
parent | a5496a180b3b6fd9feac6dc51822167892879470 (diff) | |
parent | b376bbb49f42ed8ea566ca1b3e440240204008ca (diff) | |
download | u-boot-imx-f12d4cb48a1040c25a55148d0eedee1a896364e6.zip u-boot-imx-f12d4cb48a1040c25a55148d0eedee1a896364e6.tar.gz u-boot-imx-f12d4cb48a1040c25a55148d0eedee1a896364e6.tar.bz2 |
Merge branch 'sf' of git://git.denx.de/u-boot-blackfin
Diffstat (limited to 'drivers/mtd/spi/stmicro.c')
-rw-r--r-- | drivers/mtd/spi/stmicro.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c index ae0d047..3134027 100644 --- a/drivers/mtd/spi/stmicro.c +++ b/drivers/mtd/spi/stmicro.c @@ -46,6 +46,7 @@ #define CMD_M25PXX_DP 0xb9 /* Deep Power-down */ #define CMD_M25PXX_RES 0xab /* Release from DP, and Read Signature */ +#define STM_ID_M25P10 0x11 #define STM_ID_M25P16 0x15 #define STM_ID_M25P20 0x12 #define STM_ID_M25P32 0x16 @@ -78,6 +79,13 @@ static inline struct stmicro_spi_flash *to_stmicro_spi_flash(struct spi_flash static const struct stmicro_spi_flash_params stmicro_spi_flash_table[] = { { + .idcode1 = STM_ID_M25P10, + .page_size = 256, + .pages_per_sector = 128, + .nr_sectors = 4, + .name = "M25P10", + }, + { .idcode1 = STM_ID_M25P16, .page_size = 256, .pages_per_sector = 256, @@ -316,6 +324,19 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) struct stmicro_spi_flash *stm; unsigned int i; + if (idcode[0] == 0xff) { + i = spi_flash_cmd(spi, CMD_M25PXX_RES, + idcode, 4); + if (i) + return NULL; + if ((idcode[3] & 0xf0) == 0x10) { + idcode[0] = 0x20; + idcode[1] = 0x20; + idcode[2] = idcode[3] + 1; + } else + return NULL; + } + for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) { params = &stmicro_spi_flash_table[i]; if (params->idcode1 == idcode[2]) { @@ -344,8 +365,9 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) stm->flash.size = params->page_size * params->pages_per_sector * params->nr_sectors; - debug("SF: Detected %s with page size %u, total %u bytes\n", - params->name, params->page_size, stm->flash.size); + printf("SF: Detected %s with page size %u, total ", + params->name, params->page_size); + print_size(stm->flash.size, "\n"); return &stm->flash; } |