summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Chou <thomas@wytron.com.tw>2010-04-30 21:11:20 +0800
committerMike Frysinger <vapier@gentoo.org>2010-06-30 23:47:08 -0400
commit12c2e3bbbe873ca79817845077dd8e6630d71158 (patch)
tree63f24e148eee66e77406f3647e0ac848288d6925
parent7319bcaf8ba1cddba2e56a722144eafc98868f77 (diff)
downloadu-boot-imx-12c2e3bbbe873ca79817845077dd8e6630d71158.zip
u-boot-imx-12c2e3bbbe873ca79817845077dd8e6630d71158.tar.gz
u-boot-imx-12c2e3bbbe873ca79817845077dd8e6630d71158.tar.bz2
spi_flash: support old STMicro parts with RES
Some old STMicro parts do not support JEDEC ID (0x9f). This patch uses RES (0xab) to get Electronic ID and translates it to JEDEC ID. Signed-off-by: Thomas Chou <thomas@wytron.com.tw> Acked-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--drivers/mtd/spi/spi_flash.c1
-rw-r--r--drivers/mtd/spi/stmicro.c21
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 612f819..dd0dbbf 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -147,6 +147,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
#endif
#ifdef CONFIG_SPI_FLASH_STMICRO
case 0x20:
+ case 0xff: /* Let the stmicro func handle non-JEDEC ids */
flash = spi_flash_probe_stmicro(spi, idcode);
break;
#endif
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c
index ae0d047..21e9b00 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]) {