[LEDE-DEV] [PATCH] ar71xx: fix flash fast read for flash chips > 16 MB

Christian Beier dontmind at freeshell.org
Thu Feb 22 11:13:23 PST 2018


From: Christian Beier <cb at shoutrlabs.com>

SPI fast flash read only is supported on devices using 3-byte-addressing.
As chips bigger than 16MB use 4-byte-addressing, reading fails with
-EOPNOTSUPP.

This commit sets the fast flash read callback spi->master->spi_flash_read
to NULL for chips that use 4-byte-addressing.

Fixes https://bugs.openwrt.org/index.php?do=details&task_id=1376.

Signed-off-by: Christian Beier <cb at shoutrlabs.com>
---
 ...-m25p80-disable-fast-flash-read-for-4b-addressing.patch | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 target/linux/ar71xx/patches-4.9/415-mtd-m25p80-disable-fast-flash-read-for-4b-addressing.patch

diff --git a/target/linux/ar71xx/patches-4.9/415-mtd-m25p80-disable-fast-flash-read-for-4b-addressing.patch b/target/linux/ar71xx/patches-4.9/415-mtd-m25p80-disable-fast-flash-read-for-4b-addressing.patch
new file mode 100644
index 0000000000..048f50cbcd
--- /dev/null
+++ b/target/linux/ar71xx/patches-4.9/415-mtd-m25p80-disable-fast-flash-read-for-4b-addressing.patch
@@ -0,0 +1,14 @@
+diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
+index 1343e5d..1e89067 100644
+--- a/drivers/mtd/devices/m25p80.c
++++ b/drivers/mtd/devices/m25p80.c
+@@ -245,6 +245,9 @@ static int m25p_probe(struct spi_device *spi)
+ 	if (ret)
+ 		return ret;
+ 
++	if (nor->addr_width > 3)
++		spi->master->spi_flash_read = NULL;
++
+ 	return mtd_device_parse_register(&nor->mtd,
+ 			data ? data->part_probes : NULL,
+ 			&ppdata,
-- 
2.11.0




More information about the Lede-dev mailing list