new file mode 100644
@@ -0,0 +1,27 @@
+--- a/drivers/mtd/devices/m25p80.c
++++ b/drivers/mtd/devices/m25p80.c
+@@ -322,6 +322,16 @@
+ {
+ struct m25p *flash = spi_get_drvdata(spi);
+
++ if ((&flash->spi_nor)->addr_width > 3) {
++ printk(KERN_INFO "m25p80: exit 4-byte address mode\n");
++ flash->command[0] = SPINOR_OP_EX4B; // exit 4-byte address mode: 0xe9
++ spi_write(flash->spi, flash->command, 1);
++ flash->command[0] = 0x66; // enable reset
++ spi_write(flash->spi, flash->command, 1);
++ flash->command[0] = 0x99; // reset
++ spi_write(flash->spi, flash->command, 1);
++ }
++
+ /* Clean up MTD stuff. */
+ return mtd_device_unregister(&flash->mtd);
+ }
+@@ -385,6 +395,7 @@
+ .id_table = m25p_ids,
+ .probe = m25p_probe,
+ .remove = m25p_remove,
++ .shutdown = m25p_remove, // add shutdown method to reset spi flash
+
+ /* REVISIT: many of these chips have deep power-down modes, which
+ * should clearly be entered on suspend() to minimize power use.
Signed-off-by: Shonn Lu <countrysideboy@qq.com> --- .../0064-reset-m25p80-when-shutdown.patch | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 target/linux/ramips/patches-3.18/0064-reset-m25p80-when-shutdown.patch