]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sf: always read 5 bytes for the idcode
authorMike Frysinger <vapier@gentoo.org>
Sat, 28 Mar 2009 10:41:09 +0000 (06:41 -0400)
committerMike Frysinger <vapier@gentoo.org>
Thu, 2 Apr 2009 10:50:21 +0000 (06:50 -0400)
Some SPI flash drivers like to have extended id information available
(like the spansion flash), so rather than making it re-issue the ID cmd
to get at the last 2 bytes, have the common code read 5 bytes rather than
just 3.  This also matches the Linux behavior where it always reads 5 id
bytes from all flashes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
CC: Mingkai Hu <Mingkai.hu@freescale.com>
drivers/mtd/spi/spansion.c
drivers/mtd/spi/spi_flash.c

index 3dcccd3b28eb243f2518869c8c3c42c5ed8c3b6c..fdb791798560edf65598c7423e423f0a5bb87bdc 100644 (file)
@@ -310,15 +310,9 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
        struct spansion_spi_flash *spsn;
        unsigned int i;
        unsigned short jedec, ext_jedec;
-       int ret;
-       u8 id[5] = {0};
-
-       ret = spi_flash_cmd(spi, CMD_READ_ID, id, sizeof(id));
-       if (ret)
-               return NULL;
 
-       jedec = id[1] << 8 | id[2];
-       ext_jedec = id[3] << 8 | id[4];
+       jedec = idcode[1] << 8 | idcode[2];
+       ext_jedec = idcode[3] << 8 | idcode[4];
 
        for (i = 0; i < ARRAY_SIZE(spansion_spi_flash_table); i++) {
                params = &spansion_spi_flash_table[i];
index 21ba5f9009359e888e90f96aefac7f76bf7a35d2..274895ad8ea21fad8d2c467be906d0c9c04903f7 100644 (file)
@@ -101,7 +101,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
        struct spi_slave *spi;
        struct spi_flash *flash;
        int ret;
-       u8 idcode[3];
+       u8 idcode[5];
 
        spi = spi_setup_slave(bus, cs, max_hz, spi_mode);
        if (!spi) {
@@ -120,8 +120,8 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
        if (ret)
                goto err_read_id;
 
-       debug("SF: Got idcode %02x %02x %02x\n", idcode[0],
-                       idcode[1], idcode[2]);
+       debug("SF: Got idcode %02x %02x %02x %02x %02x\n", idcode[0],
+                       idcode[1], idcode[2], idcode[3], idcode[4]);
 
        switch (idcode[0]) {
 #ifdef CONFIG_SPI_FLASH_SPANSION