[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260201165817.53-2-sanjaikumar.vs@dicortech.com>
Date: Sun, 1 Feb 2026 16:58:16 +0000
From: Sanjaikumar V S <sanjaikumarvs@...il.com>
To: tudor.ambarus@...aro.org,
pratyush@...nel.org,
michael.walle@...nel.org
Cc: linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Sanjaikumar V S <sanjaikumar.vs@...ortech.com>,
stable@...r.kernel.org
Subject: [PATCH 1/2] mtd: spi-nor: sst: Fix write enable before AAI sequence
When writing to SST flash starting at an odd address, a single byte is
first programmed using the byte program (BP) command. After this
operation completes, the flash hardware automatically clears the Write
Enable Latch (WEL) bit.
If an AAI (Auto Address Increment) word program sequence follows, it
requires WEL to be set. Without re-enabling writes, the AAI sequence
fails.
Add spi_nor_write_enable() after the odd-address byte program, but only
when an AAI sequence will follow (len > 2 bytes remaining).
Cc: stable@...r.kernel.org
Signed-off-by: Sanjaikumar V S <sanjaikumar.vs@...ortech.com>
---
drivers/mtd/spi-nor/sst.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c
index 175211fe6a5e..fe714e6d0914 100644
--- a/drivers/mtd/spi-nor/sst.c
+++ b/drivers/mtd/spi-nor/sst.c
@@ -210,6 +210,13 @@ static int sst_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
to++;
actual++;
+
+ /* BP clears WEL, re-enable if AAI sequence follows */
+ if (actual < len - 1) {
+ ret = spi_nor_write_enable(nor);
+ if (ret)
+ goto out;
+ }
}
/* Write out most of the data here. */
--
2.43.0
Powered by blists - more mailing lists