summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHou Zhiqiang <B48286@freescale.com>2015-05-21 15:34:56 (GMT)
committerHonghua Yin <Hong-Hua.Yin@freescale.com>2015-05-22 02:02:32 (GMT)
commit325fb9fc577c522242003b124eca933a6b4bcba6 (patch)
tree393123caf8c65baa9aea52191aca346fbf158132
parentb207d2c887415a6b501249f3c3f067f266cc8b86 (diff)
downloadlinux-fsl-qoriq-325fb9fc577c522242003b124eca933a6b4bcba6.tar.xz
mtd: m25p80: add reset process before suspend
Make sure the SPI Flash into reset state. Signed-off-by: Hou Zhiqiang <B48286@freescale.com> Change-Id: I627606256571b80ba80a5a84a25b52685e799b0c Reviewed-on: http://git.am.freescale.net:8181/36725 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Mingkai Hu <Mingkai.Hu@freescale.com> Reviewed-by: Honghua Yin <Hong-Hua.Yin@freescale.com>
-rw-r--r--drivers/mtd/devices/m25p80.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index fa5e463..d531b1e 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -26,6 +26,7 @@
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <linux/mtd/spi-nor.h>
+#include <linux/delay.h>
#define MAX_CMD_SIZE 6
struct m25p {
@@ -256,9 +257,13 @@ static int m25p_suspend(struct device *dev)
struct m25p *flash = dev_get_drvdata(dev);
struct spi_nor *nor = &flash->spi_nor;
- /* Wait till previous write/erase is done. */
- if (nor->wait_till_ready)
- return nor->wait_till_ready(nor);
+ /*
+ * A minimum de-selection time of 50ns must come between the
+ * RESET ENABLE and RESET MEMORY commands
+ */
+ m25p80_write_reg(nor, SPINOR_OP_RESET_EN, NULL, 0, 0);
+ ndelay(50);
+ m25p80_write_reg(nor, SPINOR_OP_RESET_MEM, NULL, 0, 0);
return 0;
}