Hi Daniel,
On 30.10.2019 12:27, Daniel Danzberger wrote:
Signed-off-by: Daniel Danzberger <dan...@dd-wrt.com>
---
.../401-mtd-m25p80-fix-shutdown-hang.patch | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
create mode 100644
target/linux/ipq40xx/patches-4.19/401-mtd-m25p80-fix-shutdown-hang.patch
diff --git
a/target/linux/ipq40xx/patches-4.19/401-mtd-m25p80-fix-shutdown-hang.patch
b/target/linux/ipq40xx/patches-4.19/401-mtd-m25p80-fix-shutdown-hang.patch
new file mode 100644
index 0000000000..779f7ec4af
--- /dev/null
+++ b/target/linux/ipq40xx/patches-4.19/401-mtd-m25p80-fix-shutdown-hang.patch
@@ -0,0 +1,21 @@
+diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
+index 270d3c95..39f90436 100644
+--- a/drivers/mtd/devices/m25p80.c
++++ b/drivers/mtd/devices/m25p80.c
+@@ -256,9 +256,16 @@ static int m25p_remove(struct spi_mem *spimem)
+ static void m25p_shutdown(struct spi_mem *spimem)
+ {
+ struct m25p *flash = spi_mem_get_drvdata(spimem);
++ u8 command[1];
++
++ command[0] = 0x66;
++ spi_write(spimem->spi, command, 1);
++ command[0] = 0x99;
++ spi_write(spimem->spi, command, 1);
This is not the correct way to solve 'broken' hardware designs (I assume
your board has incorrect bootstrap configuration and boots from 32M SPI
NOR in default 3-byte addressing mode instead of 4-byte or the flash IC
isn't reset during SOC reset).
I remember discussing this topic at least several times during reviews
of some MediaTek based boards back in 2018, please see great explanation
from Mathias here: [0].
Since kernel 4.19 we have an official 'solution' for that, look for
'broken-flash-reset' property description in [1] documentation and
deeper explanation in [2].
[0] https://github.com/lede-project/source/pull/620#issuecomment-295401936
[1]
https://www.kernel.org/doc/Documentation/devicetree/bindings/mtd/jedec%2Cspi-nor.txt
[2]
https://github.com/torvalds/linux/commit/bb276262e88dae52cc717bb636b7468f66bb234e
--
Cheers,
Piotr
+
+ spi_nor_restore(&flash->spi_nor);
+ }
++
+ /*
+ * Do NOT add to this array without reading the following:
+ *
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel