sf: Divide spi_flash into multiple parts
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v3 1/28 sf: Divide spi_flash into multiple parts
Divided the spi_flash framework into mutiple parts for
- spi_flash.c:
spi flash core file, interaction for spi/qspi driver to spi_flash framework.
- spi_flash_ops.c
spi flash preffered operations, erase,write and read.
- spi_flash_probe.c
spi flash probing, easy to extend probing functionality.
This change will support to extend the functionality in a proper manner.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/Makefile | 2 +- drivers/mtd/spi/spi_flash.c | 571 +------------------------------------- drivers/mtd/spi/spi_flash_ops.c | 314 +++++++++++++++++++++ drivers/mtd/spi/spi_flash_probe.c | 276 ++++++++++++++++++ 4 files changed, 596 insertions(+), 567 deletions(-) create mode 100644 drivers/mtd/spi/spi_flash_ops.c create mode 100644 drivers/mtd/spi/spi_flash_probe.c
drivers/mtd/spi/Makefile +1 -1
@@ -14,7 +14,7 @@ COBJS-$(CONFIG_SPL_SPI_LOAD) += spi_spl_load.o COBJS-$(CONFIG_SPL_SPI_BOOT) += fsl_espi_spl.o endif -COBJS-$(CONFIG_SPI_FLASH) += spi_flash.o +COBJS-$(CONFIG_SPI_FLASH) += spi_flash_probe.o spi_flash_ops.o spi_flash.o COBJS-$(CONFIG_SPI_FLASH_ATMEL) += atmel.o COBJS-$(CONFIG_SPI_FLASH_EON) += eon.o COBJS-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.o
drivers/mtd/spi/spi_flash.c +5 -566
592 lines not on this page · raw message
drivers/mtd/spi/spi_flash_ops.c new file +314 -0
314 lines not on this page · raw message
drivers/mtd/spi/spi_flash_probe.c new file +276 -0
276 lines not on this page · raw message
Signature · 1 line
1.8.3
PATCH v3 2/28 sf: probe: Add new spi_flash_probe support
In reply to a message not in the archiveAdded new spi_flash_probe support, currently added N25Q* flash part attributes support.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
Defined CONFIG_SPI_FLASH_LEGACY for old probing style which is available on spi_flash_probe_legacy.c, this will removed soon once all flashes are supported in new spi_flash_probe.
---
Changes for v3:
- Fix warning issue.
Changes for v2:
- Removed CONFIG_SPI_FLASH_NEW, add CONFIG_SPI_FLASH_LEGACY
- Enable CONFIG_SPI_FLASH_STMICRO in spi_flash_params table
- Updated few structure members
drivers/mtd/spi/Makefile | 1 + drivers/mtd/spi/spi_flash_probe.c | 229 ++++++++++++------------- drivers/mtd/spi/spi_flash_probe_legacy.c | 276 +++++++++++++++++++++++++++++++ 3 files changed, 385 insertions(+), 121 deletions(-) create mode 100644 drivers/mtd/spi/spi_flash_probe_legacy.c
drivers/mtd/spi/Makefile +1 -0
@@ -14,6 +14,7 @@ COBJS-$(CONFIG_SPL_SPI_LOAD) += spi_spl_load.o COBJS-$(CONFIG_SPL_SPI_BOOT) += fsl_espi_spl.o endif +COBJS-$(CONFIG_SPI_FLASH_LEGACY) += spi_flash_probe_legacy.o spi_flash_ops.o spi_flash.o COBJS-$(CONFIG_SPI_FLASH) += spi_flash_probe.o spi_flash_ops.o spi_flash.o COBJS-$(CONFIG_SPI_FLASH_ATMEL) += atmel.o COBJS-$(CONFIG_SPI_FLASH_EON) += eon.o
drivers/mtd/spi/spi_flash_probe.c +108 -121
291 lines not on this page · raw message
drivers/mtd/spi/spi_flash_probe_legacy.c new file +276 -0
276 lines not on this page · raw message
Signature · 1 line
1.8.3
PATCH v3 2/28 sf: probe: Add new spi_flash_probe support
Hi,
Quoted 88 lines · Jagannadha Sutradharudu Teki
Added new
spi_flash_probesupport, currently added N25Q* flash part attributes support.Updated the
sector_sizeattributes as per the flash parts. Looks fine for with thissector_sizefor computing the size of flash.Defined
CONFIG_SPI_FLASH_LEGACYfor old probing style which is available onspi_flash_probe_legacy.c, this will removed soon once all flashes are supported in newspi_flash_probe.Signed-off-by Jagannadha Sutradharudu Teki <[email protected]>---
Changes for v3:
- Fix warning issue.
Changes for v2:
- RemovedCONFIG_SPI_FLASH_NEW, addCONFIG_SPI_FLASH_LEGACY
- EnableCONFIG_SPI_FLASH_STMICROinspi_flash_paramstable
- Updated few structure membersdrivers/mtd/spi/Makefile | 1 + drivers/mtd/spi/spi_flash_probe.c | 229 ++++++++++++------------- drivers/mtd/spi/spi_flash_probe_legacy.c | 276 +++++++++++++++++++++++++++++++ 3 files changed, 385 insertions(+), 121 deletions(-) create mode 100644 drivers/mtd/spi/spi_flash_probe_legacy.c...
drivers/mtd/spi/spi_flash_probe_legacy.c new file +56
-0+/* +* The following table holds all device probe functions +* +* shift: number of continuation bytes before the ID +* idcode: the expected IDCODE or 0xff for non JEDEC devices +* probe: the function to call +* +* Non JEDEC devices should be ordered in the table such that +* the probe functions with best detection algorithms come first. +* +* Several matching entries are permitted, they will be tried +* in sequence until a probe function returns non NULL. +* +* IDCODE_CONT_LEN may be redefined if a device needs to declare a +* larger "shift" value. IDCODE_PART_LEN generally shouldn't be +* changed. This is the max number of bytes probe functions may +* examine when looking up part-specific identification info. +* +* Probe functions will be given the idcode buffer starting at their +* manu id byte (the "idcode" in the table below). In other words, +* all of the continuation bytes will be skipped (the "shift" below). +*/ +#define IDCODE_CONT_LEN 0 +#define IDCODE_PART_LEN 5 +static const struct { +const u8 shift; +const u8 idcode; +struct spi_flash *(*probe) (struct spi_slave *spi,u8 *idcode); +} flashes[] = { +/* Keep it sorted by define name */ +#ifdef CONFIG_SPI_FLASH_ATMEL + {0 ,0x1f , spi_flash_probe_atmel, }, +#endif +#ifdef CONFIG_SPI_FLASH_EON + {0 ,0x1c , spi_flash_probe_eon, }, +#endif +#ifdef CONFIG_SPI_FLASH_GIGADEVICE + {0 ,0xc8 , spi_flash_probe_gigadevice, }, +#endif +#ifdef CONFIG_SPI_FLASH_MACRONIX + {0 ,0xc2 , spi_flash_probe_macronix, }, +#endif +#ifdef CONFIG_SPI_FLASH_SPANSION + {0 ,0x01 , spi_flash_probe_spansion, }, +#endif +#ifdef CONFIG_SPI_FLASH_SST + {0 ,0xbf , spi_flash_probe_sst, }, +#endif +#ifdef CONFIG_SPI_FLASH_STMICRO + {0 ,0x20 , spi_flash_probe_stmicro, }, +#endif +#ifdef CONFIG_SPI_FLASH_WINBOND + {0 ,0xef , spi_flash_probe_winbond, }, +#endif +#ifdef CONFIG_SPI_FRAM_RAMTRON + { 6, 0xc2, spi_fram_probe_ramtron, },
drivers/mtd/spi/spi_flash_probe_legacy.c line 152
Quoted 10 lines
drivers/mtd/spi/spi_flash_probe_legacy.c new file +10
-0+# undef IDCODE_CONT_LEN +# define IDCODE_CONT_LEN 6 +#endif +/* Keep it sorted by best detection */ +#ifdef CONFIG_SPI_FLASH_STMICRO + { 0, 0xff, spi_flash_probe_stmicro, }, +#endif +#ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC + { 0, 0xff, spi_fram_probe_ramtron, }, +#endif
Do you think it is worth using a linker list for this?
Regards,
Simon
PATCH v3 2/28 sf: probe: Add new spi_flash_probe support
Quoted 97 lines · Simon Glass
Hi,
Quoted 92 lines · Jagannadha Sutradharudu Teki
Added new
spi_flash_probesupport, currently added N25Q* flash part attributes support.Updated the
sector_sizeattributes as per the flash parts. Looks fine for with thissector_sizefor computing the size of flash.Defined
CONFIG_SPI_FLASH_LEGACYfor old probing style which is available onspi_flash_probe_legacy.c, this will removed soon once all flashes are supported in newspi_flash_probe.Signed-off-by Jagannadha Sutradharudu Teki <[email protected]>---
Changes for v3:
- Fix warning issue.
Changes for v2:
- RemovedCONFIG_SPI_FLASH_NEW, addCONFIG_SPI_FLASH_LEGACY
- EnableCONFIG_SPI_FLASH_STMICROinspi_flash_paramstable
- Updated few structure membersdrivers/mtd/spi/Makefile | 1 + drivers/mtd/spi/spi_flash_probe.c | 229 ++++++++++++------------- drivers/mtd/spi/spi_flash_probe_legacy.c | 276 +++++++++++++++++++++++++++++++ 3 files changed, 385 insertions(+), 121 deletions(-) create mode 100644 drivers/mtd/spi/spi_flash_probe_legacy.c...
drivers/mtd/spi/spi_flash_probe_legacy.c new file +61
-0+/* +* The following table holds all device probe functions +* +* shift: number of continuation bytes before the ID +* idcode: the expected IDCODE or 0xff for non JEDEC devices +* probe: the function to call +* +* Non JEDEC devices should be ordered in the table such that +* the probe functions with best detection algorithms come first. +* +* Several matching entries are permitted, they will be tried +* in sequence until a probe function returns non NULL. +* +* IDCODE_CONT_LEN may be redefined if a device needs to declare a +* larger "shift" value. IDCODE_PART_LEN generally shouldn't be +* changed. This is the max number of bytes probe functions may +* examine when looking up part-specific identification info. +* +* Probe functions will be given the idcode buffer starting at their +* manu id byte (the "idcode" in the table below). In other words, +* all of the continuation bytes will be skipped (the "shift" below). +*/ +#define IDCODE_CONT_LEN 0 +#define IDCODE_PART_LEN 5 +static const struct { +const u8 shift; +const u8 idcode; +struct spi_flash *(*probe) (struct spi_slave *spi,u8 *idcode); +} flashes[] = { +/* Keep it sorted by define name */ +#ifdef CONFIG_SPI_FLASH_ATMEL + {0 ,0x1f , spi_flash_probe_atmel, }, +#endif +#ifdef CONFIG_SPI_FLASH_EON + {0 ,0x1c , spi_flash_probe_eon, }, +#endif +#ifdef CONFIG_SPI_FLASH_GIGADEVICE + {0 ,0xc8 , spi_flash_probe_gigadevice, }, +#endif +#ifdef CONFIG_SPI_FLASH_MACRONIX + {0 ,0xc2 , spi_flash_probe_macronix, }, +#endif +#ifdef CONFIG_SPI_FLASH_SPANSION + {0 ,0x01 , spi_flash_probe_spansion, }, +#endif +#ifdef CONFIG_SPI_FLASH_SST + {0 ,0xbf , spi_flash_probe_sst, }, +#endif +#ifdef CONFIG_SPI_FLASH_STMICRO + {0 ,0x20 , spi_flash_probe_stmicro, }, +#endif +#ifdef CONFIG_SPI_FLASH_WINBOND + {0 ,0xef , spi_flash_probe_winbond, }, +#endif +#ifdef CONFIG_SPI_FRAM_RAMTRON + {6 ,0xc2 , spi_fram_probe_ramtron, }, +# undef IDCODE_CONT_LEN +# define IDCODE_CONT_LEN 6 +#endif + /* Keep it sorted by best detection */ +#ifdef CONFIG_SPI_FLASH_STMICRO
Quoted 8 lines
drivers/mtd/spi/spi_flash_probe_legacy.c line 152
Quoted 6 lines
drivers/mtd/spi/spi_flash_probe_legacy.c new file +5
-0+ { 0, 0xff, spi_flash_probe_stmicro, }, +#endif +#ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC + { 0, 0xff, spi_fram_probe_ramtron, }, +#endifDo you think it is worth using a linker list for this?
I didn't understand what do you means by this? Can you please elaborate.
Signature · 8 lines
Thanks, Jagan. -------- Jagannadha Sutradharudu Teki, E: jagannadh.teki at gmail.com, P: +91-9676773388 Engineer - System Software Hacker U-boot - SPI Custodian and Zynq APSOC Ln: http://www.linkedin.com/in/jaganteki
PATCH v3 2/28 sf: probe: Add new spi_flash_probe support
Hi Jagan,
Quoted 108 lines · Jagan Teki
Quoted 27 lines · Simon Glass
Hi,
Quoted 22 lines · Jagannadha Sutradharudu Teki
Added new
spi_flash_probesupport, currently added N25Q* flash part attributes support.Updated the
sector_sizeattributes as per the flash parts. Looks fine for with thissector_sizefor computing the size of flash.Defined
CONFIG_SPI_FLASH_LEGACYfor old probing style which is available onspi_flash_probe_legacy.c, this will removed soon once all flashes are supported in newspi_flash_probe.Signed-off-by Jagannadha Sutradharudu Teki <[email protected]>---
Changes for v3:
- Fix warning issue.
Changes for v2:
- RemovedCONFIG_SPI_FLASH_NEW, addCONFIG_SPI_FLASH_LEGACY
- EnableCONFIG_SPI_FLASH_STMICROinspi_flash_paramstable
- Updated few structure membersdrivers/mtd/spi/Makefile | 1 + drivers/mtd/spi/spi_flash_probe.c | 229++++++++++++-------------
Quoted 70 lines
Quoted 70 lines
drivers/mtd/spi/spi_flash_probe_legacy.c | 276 +++++++++++++++++++++++++++++++ 3 files changed, 385 insertions(+), 121 deletions(-) create mode 100644 drivers/mtd/spi/spi_flash_probe_legacy.c...
drivers/mtd/spi/spi_flash_probe_legacy.c new file +61
-0+/* +* The following table holds all device probe functions +* +* shift: number of continuation bytes before the ID +* idcode: the expected IDCODE or 0xff for non JEDEC devices +* probe: the function to call +* +* Non JEDEC devices should be ordered in the table such that +* the probe functions with best detection algorithms come first. +* +* Several matching entries are permitted, they will be tried +* in sequence until a probe function returns non NULL. +* +* IDCODE_CONT_LEN may be redefined if a device needs to declare a +* larger "shift" value. IDCODE_PART_LEN generally shouldn't be +* changed. This is the max number of bytes probe functions may +* examine when looking up part-specific identification info. +* +* Probe functions will be given the idcode buffer starting at their +* manu id byte (the "idcode" in the table below). In other words, +* all of the continuation bytes will be skipped (the "shift" below). +*/ +#define IDCODE_CONT_LEN 0 +#define IDCODE_PART_LEN 5 +static const struct { +const u8 shift; +const u8 idcode; +struct spi_flash *(*probe) (struct spi_slave *spi,u8 *idcode); +} flashes[] = { +/* Keep it sorted by define name */ +#ifdef CONFIG_SPI_FLASH_ATMEL + {0 ,0x1f , spi_flash_probe_atmel, }, +#endif +#ifdef CONFIG_SPI_FLASH_EON + {0 ,0x1c , spi_flash_probe_eon, }, +#endif +#ifdef CONFIG_SPI_FLASH_GIGADEVICE + {0 ,0xc8 , spi_flash_probe_gigadevice, }, +#endif +#ifdef CONFIG_SPI_FLASH_MACRONIX + {0 ,0xc2 , spi_flash_probe_macronix, }, +#endif +#ifdef CONFIG_SPI_FLASH_SPANSION + {0 ,0x01 , spi_flash_probe_spansion, }, +#endif +#ifdef CONFIG_SPI_FLASH_SST + {0 ,0xbf , spi_flash_probe_sst, }, +#endif +#ifdef CONFIG_SPI_FLASH_STMICRO + {0 ,0x20 , spi_flash_probe_stmicro, }, +#endif +#ifdef CONFIG_SPI_FLASH_WINBOND + {0 ,0xef , spi_flash_probe_winbond, }, +#endif +#ifdef CONFIG_SPI_FRAM_RAMTRON + {6 ,0xc2 , spi_fram_probe_ramtron, }, +# undef IDCODE_CONT_LEN +# define IDCODE_CONT_LEN 6 +#endif + /* Keep it sorted by best detection */ +#ifdef CONFIG_SPI_FLASH_STMICROQuoted 8 lines
drivers/mtd/spi/spi_flash_probe_legacy.c line 152
Quoted 6 lines
drivers/mtd/spi/spi_flash_probe_legacy.c new file +5
-0+ { 0, 0xff, spi_flash_probe_stmicro, }, +#endif +#ifdef CONFIG_SPI_FRAM_RAMTRON_NON_JEDEC + { 0, 0xff, spi_fram_probe_ramtron, }, +#endifDo you think it is worth using a linker list for this?
Quoted 3 lines
I didn't understand what do you means by this?
Can you please elaborate.
I mean that you could use the features of linker_lists.h - for example to define macros to declare each driver, and then have this file look through the available drivers.
U_BOOT_CMD() does this - see do_help() for how the list is scanned.
It's just an idea, perhaps for the future.
Regards,
Simon
PATCH v3 2/28 sf: probe: Add new spi_flash_probe support
In reply to Jagannadha Sutradharudu TekiHi Jagannadha,
Jagannadha Sutradharudu Teki <[email protected]>
Quoted 2 lines · writes:
Added new
spi_flash_probesupport, currently added N25Q* flash part attributes support.
[...]
I've given your series another try on Cubox. It looks better this time (e.g. the probe issue is gone), but there are still a couple of issues. I'm going to reply to each of the affected patches (2, 7, 14) individually so it shows up properly in Patchwork.
This patch causes a major regression and thus breaks bisectability. It rips out support for all SPI flash chips except for STMICRO ones, unless CONFIG_SPI_FLASH_LEGACY is defined. However, CONFIG_SPI_FLASH_LEGACY doesn't get defined anywhere.
A better approach would be to make the new code opt-in rather than opt-out, and selecting it automatically for CONFIG_SPI_FLASH_<vendor> as support for each vendor is added.
PS: What's the etiquette for the CC list of replies to patches? Keep
all original recipients CC'ed? Or should I have dropped the chip vendor contacts for this reply?
Sascha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130921/83bc2ee1/attachment.pgp>
PATCH v3 2/28 sf: probe: Add new spi_flash_probe support
Quoted 15 lines · Sascha Silbe
Hi Jagannadha,
Jagannadha Sutradharudu Teki <[email protected]>
Quoted 2 lines · writes:
Added new
spi_flash_probesupport, currently added N25Q* flash part attributes support.[...]
I've given your series another try on Cubox. It looks better this time (e.g. the probe issue is gone), but there are still a couple of issues. I'm going to reply to each of the affected patches (2, 7, 14) individually so it shows up properly in Patchwork.
Quoted 4 lines
This patch causes a major regression and thus breaks bisectability. It rips out support for all SPI flash chips except for STMICRO ones, unless
CONFIG_SPI_FLASH_LEGACYis defined. However,CONFIG_SPI_FLASH_LEGACYdoesn't get defined anywhere.
Ok.
I think for better bisect-ability, I will keep the old probe as spi_flash_probe_legacy.c which is defined
in CONFIG_SPI_FLASH and new anyway spi_flash-probe.c which will defined in CONFIG_SPI_FLASH
once all flash probes are merged.
I think it could be a better idea, let me know if you have any comments.
Quoted 9 lines
A better approach would be to make the new code opt-in rather than opt-out, and selecting it automatically for CONFIG_SPI_FLASH_<vendor> as support for each vendor is added.
PS: What's the etiquette for the CC list of replies to patches? Keep
all original recipients CC'ed? Or should I have dropped the chip vendor contacts for this reply?
Yes, you could add CCed one on reply, i think it's better to know the flash vendors to know how
u-boot is supporting sf. My intention of doing this, if any flash vendor is interesting about these features in u-boot
and they might do a test on their hw.
Signature · 8 lines
Thanks, Jagan. -------- Jagannadha Sutradharudu Teki, E: jagannadh.teki at gmail.com, P: +91-9676773388 Engineer - System Software, Opensource hacker U-boot - SPI Custodian and Zynq APSOC Ln: http://www.linkedin.com/in/jaganteki
PATCH v3 3/28 sf: probe: Add support for M25P* flash parts
In reply to a message not in the archiveAdded M25P* parts are which are avilable in spi_flash_probe_legacy.c.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +8 -1
@@ -37,6 +37,14 @@ struct spi_flash_params {static const struct spi_flash_params spi_flash_params_table[] = { #ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */ + {"M25P10" ,0x202011 ,0x0 ,32 *1024 ,4 }, + {"M25P20" ,0x202012 ,0x0 ,64 *1024 ,4 }, + {"M25P40" ,0x202013 ,0x0 ,64 *1024 ,8 }, + {"M25P80" ,0x202014 ,0x0 ,64 *1024 ,16 }, + {"M25P16" ,0x202015 ,0x0 ,64 *1024 ,32 }, + {"M25P32" ,0x202016 ,0x0 ,64 *1024 ,64 }, + {"M25P64" ,0x202017 ,0x0 ,64 *1024 ,128 }, + {"M25P128" ,0x202018 ,0x0 ,256 *1024 ,64 }, {"N25Q32" ,0x20ba16 ,0x0 ,64 *1024 ,64 }, {"N25Q32A" ,0x20bb16 ,0x0 ,64 *1024 ,64 }, {"N25Q64", 0x20ba17, 0x0, 64 * 1024, 128},
@@ -59,7 +67,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {* RAMTRON * SPANSION * SST -* STMICRO (M25*) * WINBOND */ };
Signature · 1 line
1.8.3
PATCH v3 4/28 sf: probe: Add support for EN25Q* flash parts
In reply to a message not in the archiveAdded EN25Q* parts are which are avilable in spi_flash_probe_legacy.c.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
---
Changes for v3:
- none
Changes for v2:
- Enable CONFIG_SPI_FLASH_EON
drivers/mtd/spi/spi_flash_probe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +4 -1
@@ -36,6 +36,10 @@ struct spi_flash_params { };static const struct spi_flash_params spi_flash_params_table[] = { +#ifdef CONFIG_SPI_FLASH_EON /* EON */ + {"EN25Q32B" ,0x1c3016 ,0x0 ,64 *1024 ,64 }, + {"EN25Q128B" ,0x1c3018 ,0x0 ,64 *1024 ,256 }, +#endif #ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */ {"M25P10" ,0x202011 ,0x0 ,32 *1024 ,4 }, {"M25P20", 0x202012, 0x0, 64 * 1024, 4},
@@ -61,7 +65,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {/* * TODO: * ATMEL -* EON * GIGADEVICE * MACRONIX * RAMTRON
Signature · 1 line
1.8.3
PATCH v3 5/28 sf: probe: Add support for GD25* flash parts
In reply to a message not in the archiveAdded GD25* parts are which are avilable in spi_flash_probe_legacy.c.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
---
Changes for v3:
- none
Changes for v2:
- Enable CONFIG_SPI_FLASH_GIGADEVICE
drivers/mtd/spi/spi_flash_probe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +4 -1
@@ -40,6 +40,10 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"EN25Q32B", 0x1c3016, 0x0, 64 * 1024, 64}, {"EN25Q128B", 0x1c3018, 0x0, 64 * 1024, 256}, #endif +#ifdef CONFIG_SPI_FLASH_GIGADEVICE /* GIGADEVICE */ + {"GD25Q64B", 0xc84017, 0x0, 64 * 1024, 128}, + {"GD25LQ32", 0xc86016, 0x0, 64 * 1024, 64}, +#endif #ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */ {"M25P10", 0x202011, 0x0, 32 * 1024, 4}, {"M25P20", 0x202012, 0x0, 64 * 1024, 4},
@@ -65,7 +69,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {/* * TODO: * ATMEL -* GIGADEVICE * MACRONIX * RAMTRON * SPANSION
Signature · 1 line
1.8.3
PATCH v3 6/28 sf: probe: Add support for MX25L* flash parts
In reply to a message not in the archiveAdded MX25L* parts are which are avilable in spi_flash_probe_legacy.c.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
---
Changes for v3:
- none
Changes for v2:
- Enable CONFIG_SPI_FLASH_MACRONIX
drivers/mtd/spi/spi_flash_probe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +9 -1
@@ -44,6 +44,15 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"GD25Q64B", 0xc84017, 0x0, 64 * 1024, 128}, {"GD25LQ32", 0xc86016, 0x0, 64 * 1024, 64}, #endif +#ifdef CONFIG_SPI_FLASH_MACRONIX /* MACRONIX */ + {"MX25L4005", 0xc22013, 0x0, 64 * 1024, 8}, + {"MX25L8005", 0xc22014, 0x0, 64 * 1024, 16}, + {"MX25L1605D", 0xc22015, 0x0, 64 * 1024, 32}, + {"MX25L3205D", 0xc22016, 0x0, 64 * 1024, 64}, + {"MX25L6405D", 0xc22017, 0x0, 64 * 1024, 128}, + {"MX25L12805", 0xc22018, 0x0, 64 * 1024, 256}, + {"MX25L12855E", 0xc22618, 0x0, 64 * 1024, 256}, +#endif #ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */ {"M25P10", 0x202011, 0x0, 32 * 1024, 4}, {"M25P20", 0x202012, 0x0, 64 * 1024, 4},
@@ -69,7 +78,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {/* * TODO: * ATMEL -* MACRONIX * RAMTRON * SPANSION * SST
Signature · 1 line
1.8.3
PATCH v3 7/28 sf: probe: Add support for W25* flash parts
In reply to a message not in the archiveAdded W25* parts are which are avilable in spi_flash_probe_legacy.c.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
---
Changes for v3:
- none
Changes for v2:
- Enable CONFIG_SPI_FLASH_WINBOND
drivers/mtd/spi/spi_flash_probe.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +32 -1
@@ -75,13 +75,44 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"N25Q1024", 0x20ba21, 0x0, 64 * 1024, 2048}, {"N25Q1024A", 0x20bb21, 0x0, 64 * 1024, 2048}, #endif +#ifdef CONFIG_SPI_FLASH_WINBOND /* WINBOND */ + {"W25P80", 0xef2014, 0x0, 64 * 1024, 16}, + {"W25P16", 0xef2015, 0x0, 64 * 1024, 32}, + {"W25P32", 0xef2016, 0x0, 64 * 1024, 64}, + {"W25X40", 0xef3013, 0x0, 64 * 1024, 8}, + {"W25X16", 0xef3015, 0x0, 64 * 1024, 32}, + {"W25X32", 0xef3016, 0x0, 64 * 1024, 64}, + {"W25X64", 0xef3017, 0x0, 64 * 1024, 128}, + {"W25Q80BL", 0xef4014, 0x0, 64 * 1024, 16}, + {"W25Q16CL", 0xef4015, 0x0, 64 * 1024, 32}, + {"W25Q32BV", 0xef4016, 0x0, 64 * 1024, 64}, + {"W25Q64CV", 0xef4017, 0x0, 64 * 1024, 128}, + {"W25Q128BV", 0xef4018, 0x0, 64 * 1024, 256}, + {"W25Q256", 0xef4019, 0x0, 64 * 1024, 512}, + {"W25Q80BW", 0xef5014, 0x0, 64 * 1024, 16}, + {"W25Q16DW", 0xef6015, 0x0, 64 * 1024, 32}, + {"W25Q32DW", 0xef6016, 0x0, 64 * 1024, 64}, + {"W25Q64DW", 0xef6017, 0x0, 64 * 1024, 128}, + {"W25Q128FW", 0xef6018, 0x0, 64 * 1024, 256}, +#endif + /* + * Note: + * Below paired flash devices has similar spi_flash_params params. + * (W25Q80BL, W25Q80BV) + * (W25Q16CL, W25Q16DV) + * (W25Q32BV, W25Q32FV_SPI) + * (W25Q64CV, W25Q64FV_SPI) + * (W25Q128BV, W25Q128FV_SPI) + * (W25Q32DW, W25Q32FV_QPI) + * (W25Q64DW, W25Q64FV_QPI) + * (W25Q128FW, W25Q128FV_QPI) + */ /* * TODO: * ATMEL * RAMTRON * SPANSION * SST - * WINBOND */ };
Signature · 1 line
1.8.3
PATCH v3 7/28 sf: probe: Add support for W25* flash parts
Jagannadha Sutradharudu Teki <[email protected]>
Quoted 5 lines · writes:
Added W25* parts are which are avilable in
spi_flash_probe_legacy.c.Updated the
sector_sizeattributes as per the flash parts. Looks fine for with thissector_sizefor computing the size of flash.
This breaks sector-sized (i.e. 4KiB) erases on W25Q32BV (and many other Winbond chips). The sizes are set differently by the old code and yours:
old yourspage_size 256 256sector_size 4K 64K
size 4M 4M
The data sheet defines three different granularities: pages (256B, used for writing), sectors (4KiB, used for erasing), blocks (64KiB, used for write protection in some configurations). You seem to have mixed sectors and blocks. The total size is the same, but sector-sized erases stop working.
With the following change, my (rather simple) test cases work again:
drivers/mtd/spi/spi_flash_probe.c +1 -1
@@ -85,7 +85,7 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"W25X64", 0xef3017, 0x0, 64 * 1024, 128}, {"W25Q80BL", 0xef4014, 0x0, 64 * 1024, 16}, {"W25Q16CL", 0xef4015, 0x0, 64 * 1024, 32}, - {"W25Q32BV", 0xef4016, 0x0, 64 * 1024, 64}, + {"W25Q32BV", 0xef4016, 0x0, 4 * 1024, 1024}, {"W25Q64CV", 0xef4017, 0x0, 64 * 1024, 128}, {"W25Q128BV", 0xef4018, 0x0, 64 * 1024, 256}, {"W25Q256", 0xef4019, 0x0, 64 * 1024, 512},
The other chips will need similar changes.
Sascha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130921/657eb526/attachment.pgp>
PATCH v3 7/28 sf: probe: Add support for W25* flash parts
Hi Sascha,
Thanks for your inputs.
I think you commented w.r.t old driver configurations. Yes, I will do these changes on next versions.
Quoted 52 lines · Sascha Silbe
Jagannadha Sutradharudu Teki <[email protected]>
Quoted 5 lines · writes:
Added W25* parts are which are avilable in
spi_flash_probe_legacy.c.Updated the
sector_sizeattributes as per the flash parts. Looks fine for with thissector_sizefor computing the size of flash.This breaks sector-sized (i.e. 4KiB) erases on W25Q32BV (and many other Winbond chips). The sizes are set differently by the old code and yours:
old yours
page_size256 256sector_size4K 64K
size 4M 4MThe data sheet defines three different granularities: pages (256B, used for writing), sectors (4KiB, used for erasing), blocks (64KiB, used for write protection in some configurations). You seem to have mixed sectors and blocks. The total size is the same, but sector-sized erases stop working.
With the following change, my (rather simple) test cases work again:
drivers/mtd/spi/spi_flash_probe.c +1
-1@@ -85,7 +85,7 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"W25X64", 0xef3017, 0x0, 64 * 1024, 128}, {"W25Q80BL", 0xef4014, 0x0, 64 * 1024, 16}, {"W25Q16CL", 0xef4015, 0x0, 64 * 1024, 32}, - {"W25Q32BV", 0xef4016, 0x0, 64 * 1024, 64}, + {"W25Q32BV", 0xef4016, 0x0, 4 * 1024, 1024}, {"W25Q64CV", 0xef4017, 0x0, 64 * 1024, 128}, {"W25Q128BV", 0xef4018, 0x0, 64 * 1024, 256}, {"W25Q256", 0xef4019, 0x0, 64 * 1024, 512},The other chips will need similar changes.
Sascha
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 8 lines
Thanks, Jagan. -------- Jagannadha Sutradharudu Teki, E: jagannadh.teki at gmail.com, P: +91-9676773388 Engineer - System Software Hacker U-boot - SPI Custodian and Zynq APSOC Ln: http://www.linkedin.com/in/jaganteki
PATCH v3 8/28 sf: probe: Add support for S25FL* flash parts
In reply to a message not in the archiveAdded S25FL* parts are which are avilable in spi_flash_probe_legacy.c.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
---
Changes for v3:
- none
Changes for v2:
- Enable CONFIG_SPI_FLASH_SPANSION
drivers/mtd/spi/spi_flash_probe.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/mtd/spi/spi_flash_probe.c +24 -5
@@ -53,6 +53,19 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"MX25L12805", 0xc22018, 0x0, 64 * 1024, 256}, {"MX25L12855E", 0xc22618, 0x0, 64 * 1024, 256}, #endif +#ifdef CONFIG_SPI_FLASH_SPANSION /* SPANSION */ + {"S25FL008A", 0x010213, 0x0, 64 * 1024, 16}, + {"S25FL016A", 0x010214, 0x0, 64 * 1024, 32}, + {"S25FL032A", 0x010215, 0x0, 64 * 1024, 64}, + {"S25FL064A", 0x010216, 0x0, 64 * 1024, 128}, + {"S25FL128P_256K", 0x012018, 0x0300, 256 * 1024, 64}, + {"S25FL128P_64K", 0x012018, 0x0301, 64 * 1024, 256}, + {"S25FL032P", 0x010215, 0x4d00, 64 * 1024, 64}, + {"S25FL064P", 0x010216, 0x4d00, 64 * 1024, 128}, + {"S25FL128S_64K", 0x012018, 0x4d01, 64 * 1024, 256}, + {"S25FL256S_64K", 0x010219, 0x4d01, 64 * 1024, 512}, + {"S25FL512S_64K", 0x010220, 0x4d01, 64 * 1024, 1024}, +#endif #ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */ {"M25P10", 0x202011, 0x0, 32 * 1024, 4}, {"M25P20", 0x202012, 0x0, 64 * 1024, 4},
@@ -98,6 +111,7 @@ static const struct spi_flash_params spi_flash_params_table[] = {/* * Note: * Below paired flash devices has similar spi_flash_params params. +* (S25FL129P_64K, S25FL128S_64K) * (W25Q80BL, W25Q80BV) * (W25Q16CL, W25Q16DV) * (W25Q32BV, W25Q32FV_SPI)
@@ -111,7 +125,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {* TODO: * ATMEL * RAMTRON -* SPANSION * SST */ };
@@ -122,19 +135,25 @@ struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode)struct spi_flash *flash;int i;u16 jedec = idcode[1 ] <<8 | idcode[2 ]; +u16 ext_jedec = idcode[3 ] <<8 | idcode[4 ]; -/* Get the flash id (jedec = manuf_id + dev_id) */ +/* Get the flash id (jedec = manuf_id + dev_id, ext_jedec) */ for (i =0 ; i <ARRAY_SIZE (spi_flash_params_table); i++) { params = &spi_flash_params_table[i];if ((params->jedec >>16 ) == idcode[0 ]) { -if ((params->jedec &0xFFFF ) == jedec) +if ((params->jedec &0xFFFF ) == jedec) { +if ((params->ext_jedec !=0 ) && + (params->ext_jedec == ext_jedec)) +continue ;break ; + } } }if (i ==ARRAY_SIZE (spi_flash_params_table)) { -printf ("SF: Unsupported flash ID: manuf %02x, jedec %04x\n" , - idcode[0 ], jedec); +printf ("SF: Unsupported flash IDs: " ); +printf ("manuf %02x, jedec %04x, ext_jedec %04x\n" , + idcode[0 ], jedec, ext_jedec);return NULL ; }
Signature · 1 line
1.8.3
PATCH v3 9/28 sf: probe: Add support for SST25* flash parts
In reply to a message not in the archiveAdded SST25* parts are which are avilable in spi_flash_probe_legacy.c.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
---
Changes for v3:
- none
Changes for v2:
- Enable CONFIG_SPI_FLASH_SST
drivers/mtd/spi/spi_flash_probe.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +12 -1
@@ -88,6 +88,18 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"N25Q1024", 0x20ba21, 0x0, 64 * 1024, 2048}, {"N25Q1024A", 0x20bb21, 0x0, 64 * 1024, 2048}, #endif +#ifdef CONFIG_SPI_FLASH_SST /* SST */ + {"SST25VF040B", 0xbf258d, 0x0, 64 * 1024, 8}, + {"SST25VF080B", 0xbf258e, 0x0, 64 * 1024, 16}, + {"SST25VF016B", 0xbf2541, 0x0, 64 * 1024, 32}, + {"SST25VF032B", 0xbf254a, 0x0, 64 * 1024, 64}, + {"SST25VF064C", 0xbf254b, 0x0, 64 * 1024, 128}, + {"SST25WF512", 0xbf2501, 0x0, 64 * 1024, 1}, + {"SST25WF010", 0xbf2502, 0x0, 64 * 1024, 2}, + {"SST25WF020", 0xbf2503, 0x0, 64 * 1024, 4}, + {"SST25WF040", 0xbf2504, 0x0, 64 * 1024, 8}, + {"SST25WF080", 0xbf2505, 0x0, 64 * 1024, 16}, +#endif #ifdef CONFIG_SPI_FLASH_WINBOND /* WINBOND */ {"W25P80", 0xef2014, 0x0, 64 * 1024, 16}, {"W25P16", 0xef2015, 0x0, 64 * 1024, 32},
@@ -125,7 +137,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {* TODO: * ATMEL * RAMTRON -* SST */ };
Signature · 1 line
1.8.3
PATCH v3 9/28 sf: probe: Add support for SST25* flash parts
Quoted 41 lines · Jagannadha Sutradharudu Teki
Added SST25* parts are which are avilable in
spi_flash_probe_legacy.c.Updated the
sector_sizeattributes as per the flash parts. Looks fine for with thissector_sizefor computing the size of flash.Signed-off-by Jagannadha Sutradharudu Teki <[email protected]>---
Changes for v3:
- none
Changes for v2:
- EnableCONFIG_SPI_FLASH_SSTdrivers/mtd/spi/spi_flash_probe.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)drivers/mtd/spi/spi_flash_probe.c +12
-0@@ -88,6 +88,18 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"N25Q1024", 0x20ba21, 0x0, 64 * 1024, 2048}, {"N25Q1024A", 0x20bb21, 0x0, 64 * 1024, 2048}, #endif +#ifdef CONFIG_SPI_FLASH_SST /* SST */ + {"SST25VF040B", 0xbf258d, 0x0, 64 * 1024, 8}, + {"SST25VF080B", 0xbf258e, 0x0, 64 * 1024, 16}, + {"SST25VF016B", 0xbf2541, 0x0, 64 * 1024, 32}, + {"SST25VF032B", 0xbf254a, 0x0, 64 * 1024, 64}, + {"SST25VF064C", 0xbf254b, 0x0, 64 * 1024, 128}, + {"SST25WF512", 0xbf2501, 0x0, 64 * 1024, 1}, + {"SST25WF010", 0xbf2502, 0x0, 64 * 1024, 2}, + {"SST25WF020", 0xbf2503, 0x0, 64 * 1024, 4}, + {"SST25WF040", 0xbf2504, 0x0, 64 * 1024, 8}, + {"SST25WF080", 0xbf2505, 0x0, 64 * 1024, 16}, +#endif #ifdef CONFIG_SPI_FLASH_WINBOND /* WINBOND */ {"W25P80", 0xef2014, 0x0, 64 * 1024, 16}, {"W25P16", 0xef2015, 0x0, 64 * 1024, 32},
drivers/mtd/spi/spi_flash_probe.c static const struct spi_flash_params spi_flash_params_table[] = { · line 142
Quoted 7 lines
drivers/mtd/spi/spi_flash_probe.c +0
-1@@ -125,7 +137,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {* TODO: * ATMEL * RAMTRON -* SST */ };
Tested on i.MX6Q (nitrogen6q) and i.MX6S (nitrogen6s) with p/n SST25VF016B.
PATCH v3 10/28 sf: probe: Add support for AT45DB* flash parts
In reply to a message not in the archiveAdded AT45DB* parts are which are avilable in spi_flash_probe_legacy.c.
Updated the sector_size attributes as per the flash parts. Looks fine for with this sector_size for computing the size of flash.
---
Changes for v3:
- none
Changes for v2:
- Enable CONFIG_SPI_FLASH_ATMEL
drivers/mtd/spi/spi_flash_probe.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +9 -1
@@ -36,6 +36,15 @@ struct spi_flash_params { };static const struct spi_flash_params spi_flash_params_table[] = { +#ifdef CONFIG_SPI_FLASH_ATMEL /* ATMEL */ + {"AT45DB011D" ,0x1f2200 ,0x0 ,64 *1024 ,4 }, + {"AT45DB021D" ,0x1f2300 ,0x0 ,64 *1024 ,8 }, + {"AT45DB041D" ,0x1f2400 ,0x0 ,64 *1024 ,8 }, + {"AT45DB081D" ,0x1f2500 ,0x0 ,64 *1024 ,16 }, + {"AT45DB161D" ,0x1f2600 ,0x0 ,64 *1024 ,32 }, + {"AT45DB321D" ,0x1f2700 ,0x0 ,64 *1024 ,64 }, + {"AT45DB641D" ,0x1f2800 ,0x0 ,64 *1024 ,128 }, +#endif #ifdef CONFIG_SPI_FLASH_EON /* EON */ {"EN25Q32B" ,0x1c3016 ,0x0 ,64 *1024 ,64 }, {"EN25Q128B", 0x1c3018, 0x0, 64 * 1024, 256},
@@ -135,7 +144,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {*/ /* * TODO: -* ATMEL * RAMTRON */ };
Signature · 1 line
1.8.3
PATCH v3 11/28 sf: probe: Give proper spacing on flash table params
In reply to a message not in the archiveGiven proper spacing between flash table params.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 154 +++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 77 deletions(-)
drivers/mtd/spi/spi_flash_probe.c +77 -77
@@ -37,97 +37,97 @@ struct spi_flash_params {static const struct spi_flash_params spi_flash_params_table[] = { #ifdef CONFIG_SPI_FLASH_ATMEL /* ATMEL */ - {"AT45DB011D" ,0x1f2200 ,0x0 ,64 *1024 ,4 }, - {"AT45DB021D" ,0x1f2300 ,0x0 ,64 *1024 ,8 }, - {"AT45DB041D" ,0x1f2400 ,0x0 ,64 *1024 ,8 }, - {"AT45DB081D" ,0x1f2500 ,0x0 ,64 *1024 ,16 }, - {"AT45DB161D" ,0x1f2600 ,0x0 ,64 *1024 ,32 }, - {"AT45DB321D" ,0x1f2700 ,0x0 ,64 *1024 ,64 }, - {"AT45DB641D" ,0x1f2800 ,0x0 ,64 *1024 ,128 }, + {"AT45DB011D" ,0x1f2200 ,0x0 ,64 *1024 ,4 }, + {"AT45DB021D" ,0x1f2300 ,0x0 ,64 *1024 ,8 }, + {"AT45DB041D" ,0x1f2400 ,0x0 ,64 *1024 ,8 }, + {"AT45DB081D" ,0x1f2500 ,0x0 ,64 *1024 ,16 }, + {"AT45DB161D" ,0x1f2600 ,0x0 ,64 *1024 ,32 }, + {"AT45DB321D" ,0x1f2700 ,0x0 ,64 *1024 ,64 }, + {"AT45DB641D" ,0x1f2800 ,0x0 ,64 *1024 ,128 }, #endif #ifdef CONFIG_SPI_FLASH_EON /* EON */ - {"EN25Q32B" ,0x1c3016 ,0x0 ,64 *1024 ,64 }, - {"EN25Q128B" ,0x1c3018 ,0x0 ,64 *1024 ,256 }, + {"EN25Q32B" ,0x1c3016 ,0x0 ,64 *1024 ,64 }, + {"EN25Q128B" ,0x1c3018 ,0x0 ,64 *1024 ,256 }, #endif #ifdef CONFIG_SPI_FLASH_GIGADEVICE /* GIGADEVICE */ - {"GD25Q64B" ,0xc84017 ,0x0 ,64 *1024 ,128 }, - {"GD25LQ32" ,0xc86016 ,0x0 ,64 *1024 ,64 }, + {"GD25Q64B" ,0xc84017 ,0x0 ,64 *1024 ,128 }, + {"GD25LQ32" ,0xc86016 ,0x0 ,64 *1024 ,64 }, #endif #ifdef CONFIG_SPI_FLASH_MACRONIX /* MACRONIX */ - {"MX25L4005" ,0xc22013 ,0x0 ,64 *1024 ,8 }, - {"MX25L8005" ,0xc22014 ,0x0 ,64 *1024 ,16 }, - {"MX25L1605D" ,0xc22015 ,0x0 ,64 *1024 ,32 }, - {"MX25L3205D" ,0xc22016 ,0x0 ,64 *1024 ,64 }, - {"MX25L6405D" ,0xc22017 ,0x0 ,64 *1024 ,128 }, - {"MX25L12805" ,0xc22018 ,0x0 ,64 *1024 ,256 }, - {"MX25L12855E" ,0xc22618 ,0x0 ,64 *1024 ,256 }, + {"MX25L4005" ,0xc22013 ,0x0 ,64 *1024 ,8 }, + {"MX25L8005" ,0xc22014 ,0x0 ,64 *1024 ,16 }, + {"MX25L1605D" ,0xc22015 ,0x0 ,64 *1024 ,32 }, + {"MX25L3205D" ,0xc22016 ,0x0 ,64 *1024 ,64 }, + {"MX25L6405D" ,0xc22017 ,0x0 ,64 *1024 ,128 }, + {"MX25L12805" ,0xc22018 ,0x0 ,64 *1024 ,256 }, + {"MX25L12855E" ,0xc22618 ,0x0 ,64 *1024 ,256 }, #endif #ifdef CONFIG_SPI_FLASH_SPANSION /* SPANSION */ - {"S25FL008A" ,0x010213 ,0x0 ,64 *1024 ,16 }, - {"S25FL016A" ,0x010214 ,0x0 ,64 *1024 ,32 }, - {"S25FL032A" ,0x010215 ,0x0 ,64 *1024 ,64 }, - {"S25FL064A" ,0x010216 ,0x0 ,64 *1024 ,128 }, - {"S25FL128P_256K" ,0x012018 ,0x0300 ,256 *1024 ,64 }, - {"S25FL128P_64K" ,0x012018 ,0x0301 ,64 *1024 ,256 }, - {"S25FL032P" ,0x010215 ,0x4d00 ,64 *1024 ,64 }, - {"S25FL064P" ,0x010216 ,0x4d00 ,64 *1024 ,128 }, - {"S25FL128S_64K" ,0x012018 ,0x4d01 ,64 *1024 ,256 }, - {"S25FL256S_64K" ,0x010219 ,0x4d01 ,64 *1024 ,512 }, - {"S25FL512S_64K" ,0x010220 ,0x4d01 ,64 *1024 ,1024 }, + {"S25FL008A" ,0x010213 ,0x0 ,64 *1024 ,16 }, + {"S25FL016A" ,0x010214 ,0x0 ,64 *1024 ,32 }, + {"S25FL032A" ,0x010215 ,0x0 ,64 *1024 ,64 }, + {"S25FL064A" ,0x010216 ,0x0 ,64 *1024 ,128 }, + {"S25FL128P_256K" ,0x012018 ,0x0300 ,256 *1024 ,64 }, + {"S25FL128P_64K" ,0x012018 ,0x0301 ,64 *1024 ,256 }, + {"S25FL032P" ,0x010215 ,0x4d00 ,64 *1024 ,64 }, + {"S25FL064P" ,0x010216 ,0x4d00 ,64 *1024 ,128 }, + {"S25FL128S_64K" ,0x012018 ,0x4d01 ,64 *1024 ,256 }, + {"S25FL256S_64K" ,0x010219 ,0x4d01 ,64 *1024 ,512 }, + {"S25FL512S_64K" ,0x010220 ,0x4d01 ,64 *1024 ,1024 }, #endif #ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */ - {"M25P10" ,0x202011 ,0x0 ,32 *1024 ,4 }, - {"M25P20" ,0x202012 ,0x0 ,64 *1024 ,4 }, - {"M25P40" ,0x202013 ,0x0 ,64 *1024 ,8 }, - {"M25P80" ,0x202014 ,0x0 ,64 *1024 ,16 }, - {"M25P16" ,0x202015 ,0x0 ,64 *1024 ,32 }, - {"M25P32" ,0x202016 ,0x0 ,64 *1024 ,64 }, - {"M25P64" ,0x202017 ,0x0 ,64 *1024 ,128 }, - {"M25P128" ,0x202018 ,0x0 ,256 *1024 ,64 }, - {"N25Q32" ,0x20ba16 ,0x0 ,64 *1024 ,64 }, - {"N25Q32A" ,0x20bb16 ,0x0 ,64 *1024 ,64 }, - {"N25Q64" ,0x20ba17 ,0x0 ,64 *1024 ,128 }, - {"N25Q64A" ,0x20bb17 ,0x0 ,64 *1024 ,128 }, - {"N25Q128" ,0x20ba18 ,0x0 ,64 *1024 ,256 }, - {"N25Q128A" ,0x20bb18 ,0x0 ,64 *1024 ,256 }, - {"N25Q256" ,0x20ba19 ,0x0 ,64 *1024 ,512 }, - {"N25Q256A" ,0x20bb19 ,0x0 ,64 *1024 ,512 }, - {"N25Q512" ,0x20ba20 ,0x0 ,64 *1024 ,1024 }, - {"N25Q512A" ,0x20bb20 ,0x0 ,64 *1024 ,1024 }, - {"N25Q1024" ,0x20ba21 ,0x0 ,64 *1024 ,2048 }, - {"N25Q1024A" ,0x20bb21 ,0x0 ,64 *1024 ,2048 }, + {"M25P10" ,0x202011 ,0x0 ,32 *1024 ,4 }, + {"M25P20" ,0x202012 ,0x0 ,64 *1024 ,4 }, + {"M25P40" ,0x202013 ,0x0 ,64 *1024 ,8 }, + {"M25P80" ,0x202014 ,0x0 ,64 *1024 ,16 }, + {"M25P16" ,0x202015 ,0x0 ,64 *1024 ,32 }, + {"M25P32" ,0x202016 ,0x0 ,64 *1024 ,64 }, + {"M25P64" ,0x202017 ,0x0 ,64 *1024 ,128 }, + {"M25P128" ,0x202018 ,0x0 ,256 *1024 ,64 }, + {"N25Q32" ,0x20ba16 ,0x0 ,64 *1024 ,64 }, + {"N25Q32A" ,0x20bb16 ,0x0 ,64 *1024 ,64 }, + {"N25Q64" ,0x20ba17 ,0x0 ,64 *1024 ,128 }, + {"N25Q64A" ,0x20bb17 ,0x0 ,64 *1024 ,128 }, + {"N25Q128" ,0x20ba18 ,0x0 ,64 *1024 ,256 }, + {"N25Q128A" ,0x20bb18 ,0x0 ,64 *1024 ,256 }, + {"N25Q256" ,0x20ba19 ,0x0 ,64 *1024 ,512 }, + {"N25Q256A" ,0x20bb19 ,0x0 ,64 *1024 ,512 }, + {"N25Q512" ,0x20ba20 ,0x0 ,64 *1024 ,1024 }, + {"N25Q512A" ,0x20bb20 ,0x0 ,64 *1024 ,1024 }, + {"N25Q1024" ,0x20ba21 ,0x0 ,64 *1024 ,2048 }, + {"N25Q1024A" ,0x20bb21 ,0x0 ,64 *1024 ,2048 }, #endif #ifdef CONFIG_SPI_FLASH_SST /* SST */ - {"SST25VF040B" ,0xbf258d ,0x0 ,64 *1024 ,8 }, - {"SST25VF080B" ,0xbf258e ,0x0 ,64 *1024 ,16 }, - {"SST25VF016B" ,0xbf2541 ,0x0 ,64 *1024 ,32 }, - {"SST25VF032B" ,0xbf254a ,0x0 ,64 *1024 ,64 }, - {"SST25VF064C" ,0xbf254b ,0x0 ,64 *1024 ,128 }, - {"SST25WF512" ,0xbf2501 ,0x0 ,64 *1024 ,1 }, - {"SST25WF010" ,0xbf2502 ,0x0 ,64 *1024 ,2 }, - {"SST25WF020" ,0xbf2503 ,0x0 ,64 *1024 ,4 }, - {"SST25WF040" ,0xbf2504 ,0x0 ,64 *1024 ,8 }, - {"SST25WF080" ,0xbf2505 ,0x0 ,64 *1024 ,16 }, + {"SST25VF040B" ,0xbf258d ,0x0 ,64 *1024 ,8 }, + {"SST25VF080B" ,0xbf258e ,0x0 ,64 *1024 ,16 }, + {"SST25VF016B" ,0xbf2541 ,0x0 ,64 *1024 ,32 }, + {"SST25VF032B" ,0xbf254a ,0x0 ,64 *1024 ,64 }, + {"SST25VF064C" ,0xbf254b ,0x0 ,64 *1024 ,128 }, + {"SST25WF512" ,0xbf2501 ,0x0 ,64 *1024 ,1 }, + {"SST25WF010" ,0xbf2502 ,0x0 ,64 *1024 ,2 }, + {"SST25WF020" ,0xbf2503 ,0x0 ,64 *1024 ,4 }, + {"SST25WF040" ,0xbf2504 ,0x0 ,64 *1024 ,8 }, + {"SST25WF080" ,0xbf2505 ,0x0 ,64 *1024 ,16 }, #endif #ifdef CONFIG_SPI_FLASH_WINBOND /* WINBOND */ - {"W25P80" ,0xef2014 ,0x0 ,64 *1024 ,16 }, - {"W25P16" ,0xef2015 ,0x0 ,64 *1024 ,32 }, - {"W25P32" ,0xef2016 ,0x0 ,64 *1024 ,64 }, - {"W25X40" ,0xef3013 ,0x0 ,64 *1024 ,8 }, - {"W25X16" ,0xef3015 ,0x0 ,64 *1024 ,32 }, - {"W25X32" ,0xef3016 ,0x0 ,64 *1024 ,64 }, - {"W25X64" ,0xef3017 ,0x0 ,64 *1024 ,128 }, - {"W25Q80BL" ,0xef4014 ,0x0 ,64 *1024 ,16 }, - {"W25Q16CL" ,0xef4015 ,0x0 ,64 *1024 ,32 }, - {"W25Q32BV" ,0xef4016 ,0x0 ,64 *1024 ,64 }, - {"W25Q64CV" ,0xef4017 ,0x0 ,64 *1024 ,128 }, - {"W25Q128BV" ,0xef4018 ,0x0 ,64 *1024 ,256 }, - {"W25Q256" ,0xef4019 ,0x0 ,64 *1024 ,512 }, - {"W25Q80BW" ,0xef5014 ,0x0 ,64 *1024 ,16 }, - {"W25Q16DW" ,0xef6015 ,0x0 ,64 *1024 ,32 }, - {"W25Q32DW" ,0xef6016 ,0x0 ,64 *1024 ,64 }, - {"W25Q64DW" ,0xef6017 ,0x0 ,64 *1024 ,128 }, - {"W25Q128FW" ,0xef6018 ,0x0 ,64 *1024 ,256 }, + {"W25P80" ,0xef2014 ,0x0 ,64 *1024 ,16 }, + {"W25P16" ,0xef2015 ,0x0 ,64 *1024 ,32 }, + {"W25P32" ,0xef2016 ,0x0 ,64 *1024 ,64 }, + {"W25X40" ,0xef3013 ,0x0 ,64 *1024 ,8 }, + {"W25X16" ,0xef3015 ,0x0 ,64 *1024 ,32 }, + {"W25X32" ,0xef3016 ,0x0 ,64 *1024 ,64 }, + {"W25X64" ,0xef3017 ,0x0 ,64 *1024 ,128 }, + {"W25Q80BL" ,0xef4014 ,0x0 ,64 *1024 ,16 }, + {"W25Q16CL" ,0xef4015 ,0x0 ,64 *1024 ,32 }, + {"W25Q32BV" ,0xef4016 ,0x0 ,64 *1024 ,64 }, + {"W25Q64CV" ,0xef4017 ,0x0 ,64 *1024 ,128 }, + {"W25Q128BV" ,0xef4018 ,0x0 ,64 *1024 ,256 }, + {"W25Q256" ,0xef4019 ,0x0 ,64 *1024 ,512 }, + {"W25Q80BW" ,0xef5014 ,0x0 ,64 *1024 ,16 }, + {"W25Q16DW" ,0xef6015 ,0x0 ,64 *1024 ,32 }, + {"W25Q32DW" ,0xef6016 ,0x0 ,64 *1024 ,64 }, + {"W25Q64DW" ,0xef6017 ,0x0 ,64 *1024 ,128 }, + {"W25Q128FW" ,0xef6018 ,0x0 ,64 *1024 ,256 }, #endif /* * Note:
Signature · 1 line
1.8.3
PATCH v3 12/28 sf: probe: Add support for SST_WP
In reply to a message not in the archiveMost of the SST flashes needs to write up using SST_WP, AAI Word Program, so added a flag param on spi_flash_params table.
SST flashes, which supports SST_WP need to use a WP write sst_write_wp instead of common flash write.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_internal.h | 5 ++ drivers/mtd/spi/spi_flash_ops.c | 93 ++++++++++++++++++++ drivers/mtd/spi/spi_flash_probe.c | 160 ++++++++++++++++++----------------- include/spi_flash.h | 7 ++ 4 files changed, 188 insertions(+), 77 deletions(-)
drivers/mtd/spi/spi_flash_internal.h +5 -0
@@ -75,6 +75,11 @@ int spi_flash_cmd_write(struct spi_slave *spi, const u8 *cmd, size_t cmd_len,int spi_flash_cmd_write_multi (struct spi_flash *flash,u32 offset,size_t len,const void *buf); +#ifdef CONFIG_SPI_FLASH_SST +int sst_write_wp (struct spi_flash *flash,u32 offset,size_t len, +const void *buf); +#endif +/* * Enable writing on the SPI flash. */
drivers/mtd/spi/spi_flash_ops.c +93 -0
96 lines not on this page · raw message
drivers/mtd/spi/spi_flash_probe.c +83 -77
196 lines not on this page · raw message
include/spi_flash.h +7 -0
@@ -17,6 +17,13 @@#include <linux/types.h> #include <linux/compiler.h> +/* SST specific macros */ +#ifdef CONFIG_SPI_FLASH_SST +# define SST_WP 0x01/* Supports AAI word program */ +# define CMD_SST_BP 0x02/* Byte Program */ +# define CMD_SST_AAI_WP 0xAD/* Auto Address Incr Word Program */ +#endif +struct spi_flash {struct spi_slave *spi;
Signature · 1 line
1.8.3
PATCH v3 13/28 sf: probe: Add support to clear flash BP# bits
In reply to a message not in the archiveFew of the flashes(Atmel, Macronix and SST) require to clear BP# bits in flash power ups.
So clear these BP# bits at probe time, so-that the flash is ready for user operations.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 6 ++++++ include/spi_flash.h | 5 +++++ 2 files changed, 11 insertions(+)
drivers/mtd/spi/spi_flash_probe.c +6 -0
@@ -203,6 +203,12 @@ struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode) flash->sector_size = params->sector_size; flash->size = flash->sector_size * params->nr_sectors; +/* Flash powers up read-only, so clear BP# bits */ +if (((params->jedec >>16 ) ==SPI_FLASH_CFI_MFR_ATMEL ) || + ((params->jedec >>16 ) ==SPI_FLASH_CFI_MFR_MACRONIX ) || + ((params->jedec >>16 ) ==SPI_FLASH_CFI_MFR_SST )) +spi_flash_cmd_write_status (flash,0 ); +return flash; }
include/spi_flash.h +5 -0
@@ -17,6 +17,11 @@#include <linux/types.h> #include <linux/compiler.h> +/* SPI flash CFI Manufacture ID's */ +#define SPI_FLASH_CFI_MFR_ATMEL 0x1f +#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2 +#define SPI_FLASH_CFI_MFR_SST 0xbf +/* SST specific macros */ #ifdef CONFIG_SPI_FLASH_SST # define SST_WP 0x01/* Supports AAI word program */
Signature · 1 line
1.8.3
PATCH v3 14/28 sf: probe: Add support for erase sector selection flag
In reply to a message not in the archiveSECT_4K, SECT_32K and SECT_64K opeartions are performed to to specific flash by adding a SECT* flag on respective spi_flash_params.flag param.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_ops.c | 8 +- drivers/mtd/spi/spi_flash_probe.c | 166 ++++++++++++++++++++------------------ include/spi_flash.h | 10 ++- 3 files changed, 100 insertions(+), 84 deletions(-)
drivers/mtd/spi/spi_flash_ops.c +2 -6
@@ -153,17 +153,13 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)u8 cmd[4 ];int ret =-1 ; - erase_size = flash->sector_size; + erase_size = flash->erase_size;if (offset % erase_size || len % erase_size) {debug ("SF: Erase offset/length not multiple of erase size\n" );return -1 ; } -if (erase_size ==4096 ) - cmd[0 ] =CMD_ERASE_4K ; -else - cmd[0 ] =CMD_ERASE_64K ; - + cmd[0 ] = flash->erase_cmd;while (len) {#ifdef CONFIG_SPI_FLASH_BAR u8 bank_sel;
drivers/mtd/spi/spi_flash_probe.c +89 -77
192 lines not on this page · raw message
include/spi_flash.h +9 -1
@@ -22,6 +22,10 @@#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2#define SPI_FLASH_CFI_MFR_SST 0xbf +/* SECT flags */ +#define SECT_4K (1 << 0) +#define SECT_32K (1 << 1) +/* SST specific macros */ #ifdef CONFIG_SPI_FLASH_SST # define SST_WP 0x01/* Supports AAI word program */
@@ -38,8 +42,10 @@ struct spi_flash {u32 size;/* Write (page) size */ u32 page_size; -/* Erase (sector) size */ +/* Sector size */ u32 sector_size; +/* Erase size */ +u32 erase_size;#ifdef CONFIG_SPI_FLASH_BAR /* Bank read cmd */ u8 bank_read_cmd;
@@ -50,6 +56,8 @@ struct spi_flash {#endif /* Poll cmd - for flash erase/program */ u8 poll_cmd; +/* Erase cmd 4K, 32K, 64K */ +u8 erase_cmd;void *memory_map;/* Address of read-only SPI flash access */ int (*read)(struct spi_flash *flash, u32 offset,
Signature · 1 line
1.8.3
PATCH v3 14/28 sf: probe: Add support for erase sector selection flag
Hi Jagannadha,
Jagannadha Sutradharudu Teki <[email protected]>
Quoted 3 lines · writes:
SECT_4K,SECT_32KandSECT_64Kopeartions are performed to to specific flash by adding a SECT* flag on respective spi_flash_params.flag param.
[...]
[drivers/mtd/spi/spi_flash_ops.c]
Quoted 7 lines
drivers/mtd/spi/spi_flash_ops.c +1
-1@@ -153,17 +153,13 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)u8 cmd[4 ];int ret =-1 ; - erase_size = flash->sector_size; + erase_size = flash->erase_size;if (offset % erase_size || len % erase_size) {
drivers/mtd/spi/spi_flash_ops.c int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len) · line 162
Quoted 10 lines
drivers/mtd/spi/spi_flash_ops.c +1
-5debug ("SF: Erase offset/length not multiple of erase size\n" );return -1 ; } -if (erase_size ==4096 ) - cmd[0 ] =CMD_ERASE_4K ; -else - cmd[0 ] =CMD_ERASE_64K ; - + cmd[0 ] = flash->erase_cmd;
[...]
[drivers/mtd/spi/spi_flash_probe.c]
[...]
drivers/mtd/spi/spi_flash_probe.c struct spi_flash_params { · line 124
Quoted 1 line
drivers/mtd/spi/spi_flash_probe.c +1
-0+ {"W25Q32BV", 0xef4016, 0x0, 64 * 1024, 64, SEC_4K},
[...]
I don't quite see the point of this patch. AFAICT, at least the Winbond chips support _both_ sector-sized and block-sized (32KiB, 64KiB) erases. The latter are just a more efficient way of erasing larger regions. So selecting the command to use should be based on the size and alignment of the region that's going to be erased, not based on the size of the chip.
In addition, a couple of typos (SEC_* instead of SECT_*) break the build.
Sascha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20130921/5ea9ed3c/attachment.pgp>
PATCH v3 14/28 sf: probe: Add support for erase sector selection flag
Hi Sascha,
Yes I understand your point, this time I just refer the old code. See the old code will also use the 4K sector erase.
May be we can modify this flag once the old gets stabilized, request for inputs..
Quoted 50 lines · Sascha Silbe
Hi Jagannadha,
Jagannadha Sutradharudu Teki <[email protected]>
Quoted 3 lines · writes:
SECT_4K,SECT_32KandSECT_64Kopeartions are performed to to specific flash by adding a SECT* flag on respective spi_flash_params.flag param.[...]
[drivers/mtd/spi/spi_flash_ops.c]Quoted 7 lines
drivers/mtd/spi/spi_flash_ops.c +1
-1@@ -153,17 +153,13 @@ int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len)u8 cmd[4 ];int ret =-1 ; - erase_size = flash->sector_size; + erase_size = flash->erase_size;if (offset % erase_size || len % erase_size) {drivers/mtd/spi/spi_flash_ops.c int spi_flash_cmd_erase(struct spi_flash *flash, u32 offset, size_t len) · line 162
Quoted 10 lines
drivers/mtd/spi/spi_flash_ops.c +1
-5debug ("SF: Erase offset/length not multiple of erase size\n" );return -1 ; } -if (erase_size ==4096 ) - cmd[0 ] =CMD_ERASE_4K ; -else - cmd[0 ] =CMD_ERASE_64K ; - + cmd[0 ] = flash->erase_cmd;[...]
[drivers/mtd/spi/spi_flash_probe.c]
[...]drivers/mtd/spi/spi_flash_probe.c struct spi_flash_params { · line 124
Quoted 1 line
drivers/mtd/spi/spi_flash_probe.c +1
-0+ {"W25Q32BV", 0xef4016, 0x0, 64 * 1024, 64, SEC_4K},[...]
I don't quite see the point of this patch. AFAICT, at least the Winbond chips support _both_ sector-sized and block-sized (32KiB, 64KiB) erases. The latter are just a more efficient way of erasing larger regions. So selecting the command to use should be based on the size and alignment of the region that's going to be erased, not based on the size of the chip.
In addition, a couple of typos (SEC_* instead of SECT_*) break the build.
Sascha
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 8 lines
Thanks, Jagan. -------- Jagannadha Sutradharudu Teki, E: jagannadh.teki at gmail.com, P: +91-9676773388 Engineer - System Software Hacker U-boot - SPI Custodian and Zynq APSOC Ln: http://www.linkedin.com/in/jaganteki
PATCH v3 15/28 sf: probe: Add support for flag status polling
In reply to a message not in the archivePATCH v3 16/28 sf: probe: Move BAR config to spi_flash_validate_ids
In reply to a message not in the archiveMoved BAR config to spi_flash_validate_ids, so its better to have all flash initalization at once.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_internal.h | 5 ----- drivers/mtd/spi/spi_flash_probe.c | 24 +++++++++++------------- include/spi_flash.h | 3 +++ 3 files changed, 14 insertions(+), 18 deletions(-)
drivers/mtd/spi/spi_flash_internal.h +0 -5
@@ -31,11 +31,6 @@#define SPI_FLASH_16MB_BOUN 0x1000000 -/* Manufacture ID's */ -#define SPI_FLASH_SPANSION_IDCODE0 0x01 -#define SPI_FLASH_STMICRO_IDCODE0 0x20 -#define SPI_FLASH_WINBOND_IDCODE0 0xef -#ifdef CONFIG_SPI_FLASH_BAR /* Bank addr access commands */ # define CMD_BANKADDR_BRWR 0x17
drivers/mtd/spi/spi_flash_probe.c +11 -13
@@ -219,6 +219,12 @@ struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode)if (params->flags &E_FSR ) flash->poll_cmd =CMD_FLAG_STATUS ; +#ifdef CONFIG_SPI_FLASH_BAR +/* Configure the BAR - discover bank cmds and read current bank */ +if (spi_flash_bank_config (flash, idcode[0 ]) <0 ) +return NULL ; +#endif +/* Flash powers up read-only, so clear BP# bits */ if (((params->jedec >> 16) == SPI_FLASH_CFI_MFR_ATMEL) || ((params->jedec >> 16) == SPI_FLASH_CFI_MFR_MACRONIX) ||
@@ -236,12 +242,12 @@ int spi_flash_bank_config(struct spi_flash *flash, u8 idcode0)/* discover bank cmds */ switch (idcode0) { -case SPI_FLASH_SPANSION_IDCODE0 : +case SPI_FLASH_CFI_MFR_SPANSION : flash->bank_read_cmd =CMD_BANKADDR_BRRD ; flash->bank_write_cmd =CMD_BANKADDR_BRWR ;break ; -case SPI_FLASH_STMICRO_IDCODE0 : -case SPI_FLASH_WINBOND_IDCODE0 : +case SPI_FLASH_CFI_MFR_STMICRO : +case SPI_FLASH_CFI_MFR_WINBOND : flash->bank_read_cmd =CMD_EXTNADDR_RDEAR ; flash->bank_write_cmd =CMD_EXTNADDR_WREAR ;break ;
@@ -299,7 +305,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs, {struct spi_slave *spi;struct spi_flash *flash =NULL ; -u8 idcode[5 ], *idp; +u8 idcode[5 ];int ret;/* Setup spi_slave */
@@ -329,18 +335,10 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,#endif /* Validate ID's from flash dev table */ - idp = idcode; - flash =spi_flash_validate_ids (spi, idp); + flash =spi_flash_validate_ids (spi, idcode);if (!flash) goto err_read_id; -#ifdef CONFIG_SPI_FLASH_BAR -/* Configure the BAR - discover bank cmds and read current bank */ - ret =spi_flash_bank_config (flash, *idp); -if (ret <0 ) - goto err_read_id; -#endif -#ifdef CONFIG_OF_CONTROL if (spi_flash_decode_fdt (gd->fdt_blob, flash)) {debug ("SF: FDT decode error\n" );
include/spi_flash.h +3 -0
@@ -20,7 +20,10 @@/* SPI flash CFI Manufacture ID's */ #define SPI_FLASH_CFI_MFR_ATMEL 0x1f#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2 +#define SPI_FLASH_CFI_MFR_SPANSION 0x01#define SPI_FLASH_CFI_MFR_SST 0xbf +#define SPI_FLASH_CFI_MFR_STMICRO 0x20 +#define SPI_FLASH_CFI_MFR_WINBOND 0xef/* SECT flags */ #define SECT_4K (1 << 0)
Signature · 1 line
1.8.3
PATCH v3 17/28 sf: Add proper comment style on spi_flash structure
In reply to a message not in the archiveAdded proper comment style on spi_flash structure to make more readable.
---
Changes for v3:
- none
Changes for v2:
- none
include/spi_flash.h | 63 +++++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 28 deletions(-)
include/spi_flash.h +35 -28
@@ -37,39 +37,46 @@# define CMD_SST_AAI_WP 0xAD/* Auto Address Incr Word Program */ #endif +/** +* struct spi_flash - SPI flash structure +* +* @spi: SPI slave +* @name: Name of SPI flash +* @size: Total flash size +* @page_size: Write (page) size +* @sector_size: Sector size +* @erase_size: Erase size +* @bank_read_cmd: Bank read cmd +* @bank_write_cmd: Bank write cmd +* @bank_curr: Current flash bank +* @poll_cmd: Poll cmd - for flash erase/program +* @erase_cmd: Erase cmd 4K, 32K, 64K +* @memory_map: Address of read-only SPI flash access +* @read: Flash read ops +* @write: Flash write ops +* @erase: Flash erase ops +*/ struct spi_flash {struct spi_slave *spi; +const char *name; -const char *name; - -/* Total flash size */ -u32 size; -/* Write (page) size */ -u32 page_size; -/* Sector size */ -u32 sector_size; -/* Erase size */ -u32 erase_size; +u32 size; +u32 page_size; +u32 sector_size; +u32 erase_size;#ifdef CONFIG_SPI_FLASH_BAR -/* Bank read cmd */ -u8 bank_read_cmd; -/* Bank write cmd */ -u8 bank_write_cmd; -/* Current flash bank */ -u8 bank_curr; +u8 bank_read_cmd; +u8 bank_write_cmd; +u8 bank_curr;#endif -/* Poll cmd - for flash erase/program */ -u8 poll_cmd; -/* Erase cmd 4K, 32K, 64K */ -u8 erase_cmd; - -void *memory_map;/* Address of read-only SPI flash access */ -int (*read)(struct spi_flash *flash,u32 offset, -size_t len,void *buf); -int (*write)(struct spi_flash *flash,u32 offset, -size_t len,const void *buf); -int (*erase)(struct spi_flash *flash,u32 offset, -size_t len); +u8 poll_cmd; +u8 erase_cmd; + +void *memory_map; +int (*read)(struct spi_flash *flash,u32 offset,size_t len,void *buf); +int (*write)(struct spi_flash *flash,u32 offset,size_t len, +const void *buf); +int (*erase)(struct spi_flash *flash,u32 offset,size_t len); };/**
Signature · 1 line
1.8.3
PATCH v3 18/28 sf: ramtron: Add support for separate flash driver
In reply to a message not in the archiveCompared to other spi flashes, ramtron has a different probing and implementation on flash ops, hence moved ramtron probe code into ramtron driver.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/Makefile | 6 +- drivers/mtd/spi/ramtron.c | 123 +++++++++++++- drivers/mtd/spi/spi_flash_probe.c | 4 - drivers/mtd/spi/spi_flash_probe_legacy.c | 276 ------------------------------- include/configs/top9000.h | 1 - 5 files changed, 125 insertions(+), 285 deletions(-) delete mode 100644 drivers/mtd/spi/spi_flash_probe_legacy.c
drivers/mtd/spi/Makefile +4 -2
@@ -14,8 +14,10 @@ COBJS-$(CONFIG_SPL_SPI_LOAD) += spi_spl_load.o COBJS-$(CONFIG_SPL_SPI_BOOT) += fsl_espi_spl.o endif -COBJS-$(CONFIG_SPI_FLASH_LEGACY) += spi_flash_probe_legacy.o spi_flash_ops.o spi_flash.o -COBJS-$(CONFIG_SPI_FLASH) += spi_flash_probe.o spi_flash_ops.o spi_flash.o +ifdef CONFIG_CMD_SF +COBJS-y += spi_flash.o +endif +COBJS-$(CONFIG_SPI_FLASH) += spi_flash_probe.o spi_flash_ops.o COBJS-$(CONFIG_SPI_FLASH_ATMEL) += atmel.o COBJS-$(CONFIG_SPI_FLASH_EON) += eon.o COBJS-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.o
drivers/mtd/spi/ramtron.c +121 -2
138 lines not on this page · raw message
drivers/mtd/spi/spi_flash_probe.c +0 -4
@@ -144,10 +144,6 @@ static const struct spi_flash_params spi_flash_params_table[] = {* (W25Q64DW, W25Q64FV_QPI) * (W25Q128FW, W25Q128FV_QPI) */ -/* -* TODO: -* RAMTRON -*/ };struct spi_flash *spi_flash_validate_ids (struct spi_slave *spi,u8 *idcode)
drivers/mtd/spi/spi_flash_probe_legacy.c deleted +0 -276
276 lines not on this page · raw message
include/configs/top9000.h +0 -1
@@ -120,7 +120,6 @@#define CONFIG_ATMEL_SPI0 /* SPI used for FRAM is SPI0 */ #define FRAM_SPI_BUS 0#define FRAM_CS_NUM 0 -#define CONFIG_SPI_FLASH /* RAMTRON FRAM on SPI bus */ #define CONFIG_SPI_FRAM_RAMTRON #define CONFIG_SF_DEFAULT_SPEED 1000000/* be conservative here... */ #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
Signature · 1 line
1.8.3
PATCH v3 19/28 sf: Remove unneeded flash drivers files
In reply to a message not in the archiveNow the common probing is handled in spi_flash_probe.c hence removed the unneeded flash drivers.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/Makefile | 8 - drivers/mtd/spi/atmel.c | 544 ----------------------------------- drivers/mtd/spi/eon.c | 60 ---- drivers/mtd/spi/gigadevice.c | 65 ----- drivers/mtd/spi/macronix.c | 98 ------- drivers/mtd/spi/spansion.c | 141 --------- drivers/mtd/spi/spi_flash_internal.h | 11 - drivers/mtd/spi/sst.c | 238 --------------- drivers/mtd/spi/stmicro.c | 202 ------------- drivers/mtd/spi/winbond.c | 141 --------- 10 files changed, 1508 deletions(-) delete mode 100644 drivers/mtd/spi/atmel.c delete mode 100644 drivers/mtd/spi/eon.c delete mode 100644 drivers/mtd/spi/gigadevice.c delete mode 100644 drivers/mtd/spi/macronix.c delete mode 100644 drivers/mtd/spi/spansion.c delete mode 100644 drivers/mtd/spi/sst.c delete mode 100644 drivers/mtd/spi/stmicro.c delete mode 100644 drivers/mtd/spi/winbond.c
drivers/mtd/spi/Makefile +0 -8
@@ -18,14 +18,6 @@ ifdef CONFIG_CMD_SF COBJS-y += spi_flash.o endif COBJS-$(CONFIG_SPI_FLASH) += spi_flash_probe.o spi_flash_ops.o -COBJS-$(CONFIG_SPI_FLASH_ATMEL) += atmel.o -COBJS-$(CONFIG_SPI_FLASH_EON) += eon.o -COBJS-$(CONFIG_SPI_FLASH_GIGADEVICE) += gigadevice.o -COBJS-$(CONFIG_SPI_FLASH_MACRONIX) += macronix.o -COBJS-$(CONFIG_SPI_FLASH_SPANSION) += spansion.o -COBJS-$(CONFIG_SPI_FLASH_SST) += sst.o -COBJS-$(CONFIG_SPI_FLASH_STMICRO) += stmicro.o -COBJS-$(CONFIG_SPI_FLASH_WINBOND) += winbond.o COBJS-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.o COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o
drivers/mtd/spi/atmel.c deleted +0 -544
544 lines not on this page · raw message
drivers/mtd/spi/eon.c deleted +0 -60
60 lines not on this page · raw message
drivers/mtd/spi/gigadevice.c deleted +0 -65
65 lines not on this page · raw message
drivers/mtd/spi/macronix.c deleted +0 -98
98 lines not on this page · raw message
drivers/mtd/spi/spansion.c deleted +0 -141
141 lines not on this page · raw message
drivers/mtd/spi/spi_flash_internal.h +0 -11
@@ -127,14 +127,3 @@ int spi_flash_cmd_wait_ready(struct spi_flash *flash, unsigned long timeout);/* Erase sectors. */ int spi_flash_cmd_erase (struct spi_flash *flash,u32 offset,size_t len); - -/* Manufacturer-specific probe functions */ -struct spi_flash *spi_flash_probe_spansion (struct spi_slave *spi,u8 *idcode); -struct spi_flash *spi_flash_probe_atmel (struct spi_slave *spi,u8 *idcode); -struct spi_flash *spi_flash_probe_eon (struct spi_slave *spi,u8 *idcode); -struct spi_flash *spi_flash_probe_macronix (struct spi_slave *spi,u8 *idcode); -struct spi_flash *spi_flash_probe_sst (struct spi_slave *spi,u8 *idcode); -struct spi_flash *spi_flash_probe_stmicro (struct spi_slave *spi,u8 *idcode); -struct spi_flash *spi_flash_probe_winbond (struct spi_slave *spi,u8 *idcode); -struct spi_flash *spi_fram_probe_ramtron (struct spi_slave *spi,u8 *idcode); -struct spi_flash *spi_flash_probe_gigadevice (struct spi_slave *spi,u8 *idcode);
drivers/mtd/spi/sst.c deleted +0 -238
238 lines not on this page · raw message
drivers/mtd/spi/stmicro.c deleted +0 -202
202 lines not on this page · raw message
drivers/mtd/spi/winbond.c deleted +0 -141
141 lines not on this page · raw message
Signature · 1 line
1.8.3
PATCH v3 20/28 sf: probe: Add support for EN25Q64
In reply to a message not in the archiveAdd support for EON EN25Q64 SPI flash.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi_flash_probe.c +1 -0
@@ -49,6 +49,7 @@ static const struct spi_flash_params spi_flash_params_table[] = {#endif #ifdef CONFIG_SPI_FLASH_EON /* EON */ {"EN25Q32B", 0x1c3016, 0x0, 64 * 1024, 64, 0}, + {"EN25Q64", 0x1c3017, 0x0, 64 * 1024, 128, SECT_4K}, {"EN25Q128B", 0x1c3018, 0x0, 64 * 1024, 256, 0}, #endif #ifdef CONFIG_SPI_FLASH_GIGADEVICE /* GIGADEVICE */
Signature · 1 line
1.8.3
PATCH v3 21/28 sf: probe: Add support for S25FL256S_256K
In reply to a message not in the archiveAdd support for Spansion S25FL256S_256K SPI flash.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +2 -1
@@ -75,6 +75,7 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"S25FL032P", 0x010215, 0x4d00, 64 * 1024, 64, 0}, {"S25FL064P", 0x010216, 0x4d00, 64 * 1024, 128, 0}, {"S25FL128S_64K", 0x012018, 0x4d01, 64 * 1024, 256, 0}, + {"S25FL256S_256K", 0x010219, 0x4d00, 64 * 1024, 512, 0}, {"S25FL256S_64K", 0x010219, 0x4d01, 64 * 1024, 512, 0}, {"S25FL512S_64K", 0x010220, 0x4d01, 64 * 1024, 1024, 0}, #endif
@@ -195,7 +196,7 @@ struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode) flash->read = spi_flash_cmd_read_fast;/* Compute the flash size */ - flash->page_size =256 ; + flash->page_size = (ext_jedec ==0x4d00 ) ?512 :256 ; flash->sector_size = params->sector_size; flash->size = flash->sector_size * params->nr_sectors;
Signature · 1 line
1.8.3
PATCH v3 22/28 sf: probe: Add support for S25FL512S_256K
In reply to a message not in the archiveAdd support for Spansion S25FL512S_256K SPI flash.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi_flash_probe.c +1 -0
@@ -77,6 +77,7 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"S25FL128S_64K", 0x012018, 0x4d01, 64 * 1024, 256, 0}, {"S25FL256S_256K", 0x010219, 0x4d00, 64 * 1024, 512, 0}, {"S25FL256S_64K", 0x010219, 0x4d01, 64 * 1024, 512, 0}, + {"S25FL512S_256K", 0x010220, 0x4d00, 64 * 1024, 1024, 0}, {"S25FL512S_64K", 0x010220, 0x4d01, 64 * 1024, 1024, 0}, #endif #ifdef CONFIG_SPI_FLASH_STMICRO /* STMICRO */
Signature · 1 line
1.8.3
PATCH v3 23/28 sf: probe: Use print_size arg as page_size
In reply to a message not in the archiveUse flash->page_size arg in print_size() instead of flash->sector_size while printing detected flas part details.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +1 -1
@@ -346,7 +346,7 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,#endif #ifndef CONFIG_SPL_BUILD printf ("SF: Detected %s with page size " , flash->name); -print_size (flash->sector_size,", total " ); +print_size (flash->page_size,", total " );print_size (flash->size,"" );if (flash->memory_map)printf (", mapped at %p" , flash->memory_map);
Signature · 1 line
1.8.3
PATCH v3 24/28 sf: probe: Print erase_size while printing flash details
In reply to a message not in the archiveIncluded erase_size while printing probed flash details.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mtd/spi/spi_flash_probe.c +2 -1
@@ -346,7 +346,8 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,#endif #ifndef CONFIG_SPL_BUILD printf ("SF: Detected %s with page size " , flash->name); -print_size (flash->page_size,", total " ); +print_size (flash->page_size,", erase size " ); +print_size (flash->erase_size,", total " );print_size (flash->size,"" );if (flash->memory_map)printf (", mapped at %p" , flash->memory_map);
Signature · 1 line
1.8.3
PATCH v3 25/28 sf: probe: Simply the BAR configuration logic
In reply to a message not in the archive---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_internal.h | 3 -- drivers/mtd/spi/spi_flash_probe.c | 56 +++++++++++------------------------- include/spi_flash.h | 3 -- 3 files changed, 16 insertions(+), 46 deletions(-)
drivers/mtd/spi/spi_flash_internal.h +0 -3
@@ -97,9 +97,6 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr);#ifdef CONFIG_SPI_FLASH_BAR /* Program the bank address register */ int spi_flash_cmd_bankaddr_write (struct spi_flash *flash,u8 bank_sel); - -/* Configure the BAR - discover the bank cmds */ -int spi_flash_bank_config (struct spi_flash *flash,u8 idcode0);#endif /*
drivers/mtd/spi/spi_flash_probe.c +16 -40
72 lines not on this page · raw message
include/spi_flash.h +0 -3
@@ -20,10 +20,7 @@/* SPI flash CFI Manufacture ID's */ #define SPI_FLASH_CFI_MFR_ATMEL 0x1f#define SPI_FLASH_CFI_MFR_MACRONIX 0xc2 -#define SPI_FLASH_CFI_MFR_SPANSION 0x01#define SPI_FLASH_CFI_MFR_SST 0xbf -#define SPI_FLASH_CFI_MFR_STMICRO 0x20 -#define SPI_FLASH_CFI_MFR_WINBOND 0xef/* SECT flags */ #define SECT_4K (1 << 0)
Signature · 1 line
1.8.3
PATCH v3 26/28 sf: ops: Add static qualifier to spi_flash_cmd_bankaddr_write
In reply to a message not in the archive---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_internal.h | 5 ----- drivers/mtd/spi/spi_flash_ops.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/mtd/spi/spi_flash_internal.h +0 -5
@@ -94,11 +94,6 @@ static inline int spi_flash_cmd_write_disable(struct spi_flash *flash)/* Program the status register. */ int spi_flash_cmd_write_status (struct spi_flash *flash,u8 sr); -#ifdef CONFIG_SPI_FLASH_BAR -/* Program the bank address register */ -int spi_flash_cmd_bankaddr_write (struct spi_flash *flash,u8 bank_sel); -#endif -/* * Same as spi_flash_cmd_read() except it also claims/releases the SPI * bus. Used as common part of the ->read() operation.
drivers/mtd/spi/spi_flash_ops.c +1 -1
@@ -39,7 +39,7 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr) }#ifdef CONFIG_SPI_FLASH_BAR -int spi_flash_cmd_bankaddr_write (struct spi_flash *flash,u8 bank_sel) +static int spi_flash_cmd_bankaddr_write (struct spi_flash *flash,u8 bank_sel) {u8 cmd;int ret;
Signature · 1 line
1.8.3
PATCH v3 27/28 sf: probe: Add support for MX25L25635F
In reply to a message not in the archiveAdd support for Macronix MX25L25635F SPI flash.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi_flash_probe.c +1 -0
@@ -63,6 +63,7 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"MX25L3205D", 0xc22016, 0x0, 64 * 1024, 64, 0}, {"MX25L6405D", 0xc22017, 0x0, 64 * 1024, 128, 0}, {"MX25L12805", 0xc22018, 0x0, 64 * 1024, 256, 0}, + {"MX25L25635F", 0xc22019, 0x0, 64 * 1024, 512, 0}, {"MX25L12855E", 0xc22618, 0x0, 64 * 1024, 256, 0}, #endif #ifdef CONFIG_SPI_FLASH_SPANSION /* SPANSION */
Signature · 1 line
1.8.3
PATCH v3 28/28 sf: probe: Add support for MX25L51235F
In reply to a message not in the archiveAdd support for Macronix MX25L51235F SPI flash.
---
Changes for v3:
- none
Changes for v2:
- none
drivers/mtd/spi/spi_flash_probe.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/spi/spi_flash_probe.c +1 -0
@@ -64,6 +64,7 @@ static const struct spi_flash_params spi_flash_params_table[] = { {"MX25L6405D", 0xc22017, 0x0, 64 * 1024, 128, 0}, {"MX25L12805", 0xc22018, 0x0, 64 * 1024, 256, 0}, {"MX25L25635F", 0xc22019, 0x0, 64 * 1024, 512, 0}, + {"MX25L51235F", 0xc2201A, 0x0, 64 * 1024, 1024, 0}, {"MX25L12855E", 0xc22618, 0x0, 64 * 1024, 256, 0}, #endif #ifdef CONFIG_SPI_FLASH_SPANSION /* SPANSION */
Signature · 1 line
1.8.3