Patchwork [U-Boot,RESEND,v2,08/20] sf: probe: Add support for S25FL* flash parts

login
register
mail settings
Submitter Jagannadha Sutradharudu Teki
Date Aug. 6, 2013, 4:17 p.m.
Message ID <90b1d9f1-4c63-43c6-989f-55a6571689c7@TX2EHSMHS011.ehs.local>
Download mbox | patch
Permalink /patch/265129/
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show

Comments

Jagannadha Sutradharudu Teki - Aug. 6, 2013, 4:17 p.m.
Added 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.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
---
Changes for v2:
	- Enable CONFIG_SPI_FLASH_SPANSION

 drivers/mtd/spi/spi_flash_probe.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)
Wolfgang Denk - Aug. 6, 2013, 7:49 p.m.
Dear Jagannadha Sutradharudu Teki,

In message <90b1d9f1-4c63-43c6-989f-55a6571689c7@TX2EHSMHS011.ehs.local> you wrote:
> Added 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.
> 
> Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
> ---
> Changes for v2:
> 	- Enable CONFIG_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
Jagannadha Sutradharudu Teki - Aug. 6, 2013, 7:54 p.m.
Hi Wolfgang Denk,

On Wed, Aug 7, 2013 at 1:19 AM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Jagannadha Sutradharudu Teki,
>
> In message <90b1d9f1-4c63-43c6-989f-55a6571689c7@TX2EHSMHS011.ehs.local> you wrote:
>> Added 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.
>>
>> Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
>> ---
>> Changes for v2:
>>       - Enable CONFIG_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);
>

Yes I knew this.
Any better way we handle " quoted string split across lines" w.r.t recent codes.
Request for suggestion.

--
Thanks,
Jagan.
Wolfgang Denk - Aug. 6, 2013, 8:05 p.m.
Dear Jagan,

In message <64c2a6cb-98f6-4cde-a615-ecd37a96b6ea@DB8EHSMHS012.ehs.local> you wrote:
>
> > 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);
> 
> 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

Patch

diff --git a/drivers/mtd/spi/spi_flash_probe.c b/drivers/mtd/spi/spi_flash_probe.c
index 347455f..c1daab3 100644
--- a/drivers/mtd/spi/spi_flash_probe.c
+++ b/drivers/mtd/spi/spi_flash_probe.c
@@ -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;
 	}