From: "Michael Walle" <mwalle@kernel.org>
To: "Sanjaikumar V S" <sanjaikumarvs@gmail.com>,
<linux-mtd@lists.infradead.org>
Cc: <tudor.ambarus@linaro.org>, <pratyush@kernel.org>,
<miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
<linux-kernel@vger.kernel.org>,
"Sanjaikumar V S" <sanjaikumar.vs@dicortech.com>,
<stable@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] mtd: spi-nor: sst: Fix write enable before AAI sequence
Date: Mon, 23 Feb 2026 09:18:49 +0100 [thread overview]
Message-ID: <DGM6ZPOT1WCR.157JI0LW4W3E8@kernel.org> (raw)
In-Reply-To: <20260220094236.28-2-sanjaikumarvs@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1850 bytes --]
Hi,
On Fri Feb 20, 2026 at 10:42 AM CET, Sanjaikumar V S wrote:
> From: Sanjaikumar V S <sanjaikumar.vs@dicortech.com>
>
> 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@vger.kernel.org
> Signed-off-by: Sanjaikumar V S <sanjaikumar.vs@dicortech.com>
Very strange. If that is correct, it actually never worked
correctly.
Fixes: b199489d37b2 ("mtd: spi-nor: add the framework for SPI NOR")
You've said, you didn't test this. Shouldn't it be pretty easy to
write to an odd offset? Also, from reading the code, it looks like
if write ends on an odd offset, it doesn't work either?
> ---
> 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) {
For brevity, I'd drop the repeated condition and just do the
write_enable unconditionally.
-michael
> + ret = spi_nor_write_enable(nor);
> + if (ret)
> + goto out;
> + }
> }
>
> /* Write out most of the data here. */
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
next prev parent reply other threads:[~2026-02-23 8:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260220094236.28-1-sanjaikumarvs@gmail.com>
2026-02-20 9:42 ` [PATCH v2 1/2] mtd: spi-nor: sst: Fix write enable before AAI sequence Sanjaikumar V S
2026-02-23 8:18 ` Michael Walle [this message]
2026-02-23 9:17 ` Sanjaikumar V S
2026-02-23 9:29 ` Michael Walle
2026-03-06 22:36 ` Hendrik Donner
2026-03-13 11:46 ` Pratyush Yadav
2026-03-13 12:50 ` Hendrik Donner
2026-03-13 13:39 ` Pratyush Yadav
2026-02-20 9:42 ` [PATCH v2 2/2] mtd: spi-nor: core: Fix AAI mode when dirmap is not available Sanjaikumar V S
2026-02-23 10:17 ` [PATCH v3 0/2] mtd: spi-nor: Fix SST AAI write mode Sanjaikumar V S
2026-02-23 10:17 ` [PATCH v3 1/2] mtd: spi-nor: sst: Fix write enable before AAI sequence Sanjaikumar V S
2026-02-23 10:17 ` [PATCH v3 2/2] mtd: spi-nor: core: Fix AAI mode when dirmap is not available Sanjaikumar V S
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DGM6ZPOT1WCR.157JI0LW4W3E8@kernel.org \
--to=mwalle@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=sanjaikumar.vs@dicortech.com \
--cc=sanjaikumarvs@gmail.com \
--cc=stable@vger.kernel.org \
--cc=tudor.ambarus@linaro.org \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox