<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote">2015-11-08 4:42 GMT+08:00 Shonn Lu <span dir="ltr"><<a href="mailto:countrysideboy@qq.com" target="_blank">countrysideboy@qq.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Signed-off-by: Shonn Lu <<a href="mailto:countrysideboy@qq.com">countrysideboy@qq.com</a>><br>
---<br>
 .../0064-reset-m25p80-when-shutdown.patch          | 24 ++++++++++++++++++++++<br>
 1 file changed, 24 insertions(+)<br>
 create mode 100644 target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch<br>
<br>
diff --git a/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch<br>
new file mode 100644<br>
index 0000000..76f916a<br>
--- /dev/null<br>
+++ b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch<br>
@@ -0,0 +1,24 @@<br>
+--- a/drivers/mtd/devices/m25p80.c<br>
++++ b/drivers/mtd/devices/m25p80.c<br>
+@@ -319,6 +319,12 @@<br>
+ {<br>
+       struct m25p     *flash = spi_get_drvdata(spi);<br>
+<br>
++    //        play4fun: add spi flash reset code<br>
++      flash->command[0] = 0x66;<br>
++      spi_write(flash->spi, flash->command, 1);<br>
++      flash->command[0] = 0x99;<br>
++      spi_write(flash->spi, flash->command, 1);<br>
++<br>
+       /* Clean up MTD stuff. */<br>
+       return mtd_device_unregister(&flash->mtd);<br>
+ }<br>
+@@ -382,6 +388,8 @@<br>
+       .id_table       = m25p_ids,<br>
+       .probe  = m25p_probe,<br>
+       .remove = m25p_remove,<br>
++      //      play4fun add shutdown method to reset spi flash<br>
++      .shutdown = m25p_remove,<br>
+<br>
+       /* REVISIT: many of these chips have deep power-down modes, which<br>
+        * should clearly be entered on suspend() to minimize power use.<br>
<span class=""><font color="#888888">--<br>
1.9.1<br>
_______________________________________________<br>
openwrt-devel mailing list<br>
<a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a><br>
<a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" rel="noreferrer" target="_blank">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a></font></span></blockquote><div><br></div>This is not enough for w25q256.<div>The Extended Address Register (EAR) must be cleared, or the higher half 16MB may be accessed in 3-byte addressing mode, and this will cause a boot failure. </div></div><br></div></div>