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 RESEND v2 1/20 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 v2:
- none
drivers/mtd/spi/Makefile | 2 +- drivers/mtd/spi/spi_flash.c | 569 +------------------------------------- drivers/mtd/spi/spi_flash_ops.c | 314 +++++++++++++++++++++ drivers/mtd/spi/spi_flash_probe.c | 274 ++++++++++++++++++ 4 files changed, 594 insertions(+), 565 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
@@ -13,7 +13,7 @@ ifdef CONFIG_SPL_BUILD COBJS-$(CONFIG_SPL_SPI_LOAD) += spi_spl_load.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 -564
590 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 +274 -0
274 lines not on this page · raw message
Signature · 1 line
1.8.3
PATCH RESEND v2 2/20 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 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 | 230 ++++++++++++-------------- drivers/mtd/spi/spi_flash_probe_legacy.c | 274 +++++++++++++++++++++++++++++++ 3 files changed, 384 insertions(+), 121 deletions(-) create mode 100644 drivers/mtd/spi/spi_flash_probe_legacy.c
drivers/mtd/spi/Makefile +1 -0
@@ -13,6 +13,7 @@ ifdef CONFIG_SPL_BUILD COBJS-$(CONFIG_SPL_SPI_LOAD) += spi_spl_load.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 +109 -121
294 lines not on this page · raw message
drivers/mtd/spi/spi_flash_probe_legacy.c new file +274 -0
274 lines not on this page · raw message
Signature · 1 line
1.8.3
PATCH RESEND v2 3/20 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 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 RESEND v2 4/20 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 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 RESEND v2 5/20 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 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 RESEND v2 6/20 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 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 RESEND v2 7/20 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 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 RESEND v2 8/20 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 v2:
- Enable CONFIG_SPI_FLASH_SPANSION
drivers/mtd/spi/spi_flash_probe.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-)
drivers/mtd/spi/spi_flash_probe.c +23 -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,24 @@ 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 <<16 ) >>16 ) == jedec) +if (((params->jedec <<16 ) >>16 ) == 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 ID: manuf %02x, jedec %04x " +"ext_jedec %04x\n" , idcode[0 ], jedec, ext_jedec);return NULL ; }
Signature · 1 line
1.8.3
PATCH RESEND v2 8/20 sf: probe: Add support for S25FL* flash parts
Dear Jagannadha Sutradharudu Teki,
Quoted 10 lines · In message <[email protected]> you…
Added S25FL* 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 v2:
- EnableCONFIG_SPI_FLASH_SPANSION
Checkpatch reports:
WARNING: quoted string split across lines #194: FILE: drivers/mtd/spi/spi_flash_probe.c:155:
+ printf("SF: Unsupported flash ID: manuf %02x, jedec %04x "
+ "ext_jedec %04x\n", idcode[0], jedec, ext_jedec);
Please fix!
Thanks.
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Old programmers never die, they just become managers.
PATCH RESEND v2 8/20 sf: probe: Add support for S25FL* flash parts
Hi Wolfgang Denk,
Quoted 19 lines · Wolfgang Denk
Dear Jagannadha Sutradharudu Teki,
Quoted 10 lines · In message <[email protected]> you…
Added S25FL* 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 v2:
- EnableCONFIG_SPI_FLASH_SPANSIONCheckpatch reports:
WARNING: quoted string split across lines #194: FILE:
drivers/mtd/spi/spi_flash_probe.c:155:
drivers/mtd/spi/spi_flash_probe.c struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode) · line 155
Quoted 2 lines
drivers/mtd/spi/spi_flash_probe.c +2
-0+printf ("SF: Unsupported flash ID: manuf %02x, jedec %04x " +"ext_jedec %04x\n" , idcode[0 ], jedec, ext_jedec);
Yes I knew this.
Any better way we handle " quoted string split across lines" w.r.t recent codes. Request for suggestion.
--
Thanks,
Jagan.
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH RESEND v2 8/20 sf: probe: Add support for S25FL* flash parts
Dear Jagan,
Quoted 11 lines · In message <[email protected]> you…
drivers/mtd/spi/spi_flash_probe.c struct spi_flash *spi_flash_validate_ids(struct spi_slave *spi, u8 *idcode) · line 155
Quoted 7 lines
Checkpatch reports:
WARNING: quoted string split across lines #194: FILE:
drivers/mtd/spi/spi_flash_probe.c:155:drivers/mtd/spi/spi_flash_probe.c +2
-0+printf ("SF: Unsupported flash ID: manuf %02x, jedec %04x " +"ext_jedec %04x\n" , idcode[0 ], jedec, ext_jedec);Yes I knew this.
Any better way we handle " quoted string split across lines" w.r.t recent codes. Request for suggestion.
Well, do not split the string.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Nobody goes to that restaurant anymore. It's too crowded.
PATCH RESEND v2 9/20 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 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 RESEND v2 10/20 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 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 RESEND v2 11/20 sf: probe: Give proper spacing on flash table params
In reply to a message not in the archiveGiven proper spacing between flash table params.
--- 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 RESEND v2 12/20 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 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 RESEND v2 13/20 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 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
@@ -202,6 +202,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 RESEND v2 14/20 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 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 RESEND v2 15/20 sf: probe: Add support for flag status polling
In reply to a message not in the archivePATCH RESEND v2 16/20 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 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
@@ -218,6 +218,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) ||
@@ -235,12 +241,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 ;
@@ -298,7 +304,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 */
@@ -328,18 +334,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 RESEND v2 17/20 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 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 RESEND v2 18/20 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 v2:
- none
drivers/mtd/spi/Makefile | 6 +- drivers/mtd/spi/ramtron.c | 123 +++++++++++++- drivers/mtd/spi/spi_flash_internal.h | 1 - drivers/mtd/spi/spi_flash_probe.c | 4 - drivers/mtd/spi/spi_flash_probe_legacy.c | 274 ------------------------------- include/configs/top9000.h | 1 - 6 files changed, 125 insertions(+), 284 deletions(-) delete mode 100644 drivers/mtd/spi/spi_flash_probe_legacy.c
drivers/mtd/spi/Makefile +4 -2
@@ -13,8 +13,10 @@ ifdef CONFIG_SPL_BUILD COBJS-$(CONFIG_SPL_SPI_LOAD) += spi_spl_load.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_internal.h +0 -1
@@ -136,5 +136,4 @@ 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/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 -274
274 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 RESEND v2 19/20 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 v2:
- none
drivers/mtd/spi/Makefile | 12 +- 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/ramtron.c | 406 -------------------------- drivers/mtd/spi/spansion.c | 141 --------- drivers/mtd/spi/spi_flash_internal.h | 10 - drivers/mtd/spi/sst.c | 232 --------------- drivers/mtd/spi/stmicro.c | 202 ------------- drivers/mtd/spi/winbond.c | 141 --------- 11 files changed, 2 insertions(+), 1909 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/ramtron.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 +2 -10
@@ -16,16 +16,8 @@ endif 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_FLASH) += spi_flash_probe.o spi_flash_ops.o +COBJS-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.o COBJS-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o COBJS := $(COBJS-y)
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/ramtron.c deleted +0 -406
406 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 -10
@@ -127,13 +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_flash_probe_gigadevice (struct spi_slave *spi,u8 *idcode);
drivers/mtd/spi/sst.c deleted +0 -232
232 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 RESEND v2 20/20 sf: probe: Add support for EN25Q64
In reply to a message not in the archiveAdd support for EON EN25Q64 SPI flash.
---
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