[PATCH 2/2] mtd: spi-nor: disable software protection for Winbond flash at startup (again)

Matthias Schiffer mschiffer at universe-factory.net
Wed May 18 06:32:34 PDT 2016


Support for unlocking Winbond flash had been originally added in c6fc217
("mtd: spi-nor: disable protection for Winbond flash at startup"), but was
reverted in 67b9bcd ("mtd: spi-nor: fix Spansion regressions (aliased with
Winbond)"), as some Spansion chips using the Winbond manufacturer ID
weren't working correctly with it.

The actual issue has been fixed meanwhile in 32321e9 ("mtd: spi-nor: wait
until lock/unlock operations are ready") and edf891e ("mtd: spi-nor: wait
for SR_WIP to clear on initial unlock"). After this fix, the Winbond flash
can be unlocked without causing havoc for Spansion chips.

We have verified that everything is working correctly on some Winbond chips
(like the w25q64, which is aliased with the Spansion s25fl064k) and
Spansion chips.

As an additional test, I also tried enabling the initial unlocking code for
the Spansion manufacturer ID. All tested Spansion flash chips showed the
same behaviour: without 32321e9 and edf891e, subsequent reads only returned
zeros (as reported by Felix Fietkau, leading to 67b9bcd), but with 32321e9
and edf891e, the chip continued to work correctly.

Cc: Felix Fietkau <nbd at nbd.name>
Signed-off-by: Matthias Schiffer <mschiffer at universe-factory.net>
---
 drivers/mtd/spi-nor/spi-nor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index d681003..a834e66 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -1306,6 +1306,7 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, enum read_mode mode)
 	    JEDEC_MFR(info) == SNOR_MFR_INTEL ||
 	    JEDEC_MFR(info) == SNOR_MFR_MACRONIX ||
 	    JEDEC_MFR(info) == SNOR_MFR_SST ||
+	    JEDEC_MFR(info) == SNOR_MFR_WINBOND ||
 	    info->flags & SPI_NOR_HAS_LOCK) {
 		write_enable(nor);
 		write_sr(nor, 0);
-- 
2.8.2




More information about the linux-mtd mailing list