[LEDE-DEV] [PATCH] mtd: Fix the soft reboot problem found on MediaTek devices with 32M Flash.
L. D. Pinney
ldpinney at gmail.com
Wed Jan 11 05:25:11 PST 2017
This patch resets the spi to 3 byte mode needed for devices with more than 16M Flash.
Tested on the Onion Omega2+ (MT7688)
Signed-off-by: L. D. Pinney <ldpinney at gmail.com>
Tested-by: Nita Vesa <werecatf at gmail.com>
---
diff --git a/target/linux/ramips/patches-4.4/101-spi-reset-to-3-byte-mode.patch b/target/linux/ramips/patches-4.4/101-spi-reset-to-3-byte-mode.patch
new file mode 100644
index 0000000..b126411
--- /dev/null
+++ b/target/linux/ramips/patches-4.4/101-spi-reset-to-3-byte-mode.patch
@@ -0,0 +1,24 @@
+Index: linux-4.4.40/drivers/mtd/devices/m25p80.c
+===================================================================
+--- linux-4.4.40.orig/drivers/mtd/devices/m25p80.c
++++ linux-4.4.40/drivers/mtd/devices/m25p80.c
+@@ -261,6 +261,11 @@ static int m25p_remove(struct spi_device
+ {
+ struct m25p *flash = spi_get_drvdata(spi);
+
++ flash->command[0] = 0x66;
++ spi_write(flash->spi, flash->command, 1);
++ flash->command[0] = 0x99;
++ spi_write(flash->spi, flash->command, 1);
++
+ /* Clean up MTD stuff. */
+ return mtd_device_unregister(&flash->spi_nor.mtd);
+ }
+@@ -328,6 +333,7 @@ static struct spi_driver m25p80_driver =
+ .id_table = m25p_ids,
+ .probe = m25p_probe,
+ .remove = m25p_remove,
++ .shutdown = m25p_remove,
+
+ /* REVISIT: many of these chips have deep power-down modes, which
+ * should clearly be entered on suspend() to minimize power use.
More information about the Lede-dev
mailing list