<div>Instead of use the <span style="line-height: 1.5;">set_4byte function in spi-nor.c, I use this patch for </span>simplest modification. In fact, set_4byte also send 0xe9 command to the spi flash.</div><div><div><br></div>Signed-off-by: Shonn Lu <countrysideboy@qq.com><br>---<br> .../0064-reset-m25p80-when-shutdown.patch          | 27 ++++++++++++++++++++++<br> 1 file changed, 27 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..aca758d<br>--- /dev/null<br>+++ b/target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch<br>@@ -0,0 +1,27 @@<br>+--- a/drivers/mtd/devices/m25p80.c<br>++++ b/drivers/mtd/devices/m25p80.c<br>+@@ -322,6 +322,16 @@<br>+ {<br>+       struct m25p     *flash = spi_get_drvdata(spi);<br>+ <br>++  if ((&flash->spi_nor)->addr_width > 3) {<br>++       printk(KERN_INFO "m25p80: exit 4-byte address mode\n");<br>++   flash->command[0] = SPINOR_OP_EX4B;  // exit 4-byte address mode: 0xe9<br>++      spi_write(flash->spi, flash->command, 1);<br>++     flash->command[0] = 0x66;  // enable reset<br>++  spi_write(flash->spi, flash->command, 1);  <br>++      flash->command[0] = 0x99;  // reset<br>++ spi_write(flash->spi, flash->command, 1);<br>++     }<br>++<br>+        /* Clean up MTD stuff. */<br>+    return mtd_device_unregister(&flash->mtd);<br>+ }<br>+@@ -385,6 +395,7 @@<br>+         .id_table       = m25p_ids,<br>+  .probe  = m25p_probe,<br>+        .remove = m25p_remove,<br>++      .shutdown = m25p_remove, // add shutdown method to reset spi flash<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>-- <br>1.9.1<br></div>