From 325fb9fc577c522242003b124eca933a6b4bcba6 Mon Sep 17 00:00:00 2001 From: Hou Zhiqiang Date: Thu, 21 May 2015 23:34:56 +0800 Subject: mtd: m25p80: add reset process before suspend Make sure the SPI Flash into reset state. Signed-off-by: Hou Zhiqiang Change-Id: I627606256571b80ba80a5a84a25b52685e799b0c Reviewed-on: http://git.am.freescale.net:8181/36725 Tested-by: Review Code-CDREVIEW Reviewed-by: Mingkai Hu Reviewed-by: Honghua Yin 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 #include #include +#include #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; } -- cgit v0.10.2