[PATCH] mtd: spi-nor: Provide default address width and latency for map selection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



JESD216 allows "variable address length" and "variable latency" in
Configuration Detection Command Descriptors, in other words "as-is".
And they are still unset during Sector Map Parameter Table parsing,
which led to "map_id" determined erroneously as 0 for, e.g. S25FS128S.

Fixes: b038e8e3b ("mtd: spi-nor: parse SFDP Sector Map Parameter Table")
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@xxxxxxxxx>
---
 drivers/mtd/spi-nor/spi-nor.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 828d03e..5557c89 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -2893,6 +2893,16 @@ static const u32 *spi_nor_get_map_in_use(struct spi_nor *nor, const u32 *smpt)
 		nor->read_opcode = SMPT_CMD_OPCODE(smpt[i]);
 		addr = smpt[i + 1];
 
+		/*
+		 * JESD216 allows to omit particular address length or latency
+		 * specification in the header and at this point they are still
+		 * unset, so we need some heuristics. One example is S25FS128S.
+		 */
+		if (!nor->addr_width)
+			nor->addr_width = 3;
+		if (!nor->read_dummy)
+			nor->read_dummy = 8;
+
 		err = spi_nor_read_raw(nor, addr, 1, &data_byte);
 		if (err)
 			goto out;
-- 
2.4.6


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux