[PATCH 2/2] mtd: spi-nor: Reset flash device on resume

Srikanth Boyapally srikanth.boyapally at amd.com
Fri Nov 20 03:01:15 PST 2026


From: Sai Krishna Potthuri <sai.krishna.potthuri at amd.com>

Reset the SPI NOR device before reinitializing it during resume.
This ensures that the flash is brought back to a known state before
spi_nor_init() restores the device configuration.

Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri at amd.com>
Signed-off-by: Srikanth Boyapally <srikanth.boyapally at amd.com>
---
 drivers/mtd/spi-nor/core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 11227f8fa8ea..29bce6b7348d 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -45,6 +45,9 @@
 #define SPI_NOR_SRST_SLEEP_MIN 200
 #define SPI_NOR_SRST_SLEEP_MAX 400
 
+/* Perform a device reset */
+static int spi_nor_hw_reset(struct spi_nor *nor);
+
 /**
  * spi_nor_get_cmd_ext() - Get the command opcode extension based on the
  *			   extension type.
@@ -3191,6 +3194,10 @@ static void spi_nor_resume(struct mtd_info *mtd)
 	struct device *dev = nor->dev;
 	int ret;
 
+	ret = spi_nor_hw_reset(nor);
+	if (ret)
+		dev_err(dev, "device reset failed during resume()\n");
+
 	/* re-initialize the nor chip */
 	ret = spi_nor_init(nor);
 	if (ret)

-- 
2.43.0




More information about the linux-mtd mailing list