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

From: Srikanth Boyapally

Date: Fri Nov 20 2026 - 06:02:41 EST


From: Sai Krishna Potthuri <sai.krishna.potthuri@xxxxxxx>

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@xxxxxxx>
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@xxxxxxx>
---
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