From: "Michael Walle" <mwalle@kernel.org>
To: "Sanjaikumar V S" <sanjaikumarvs@gmail.com>
Cc: <linux-kernel@vger.kernel.org>, <linux-mtd@lists.infradead.org>,
<miquel.raynal@bootlin.com>, <pratyush@kernel.org>,
<richard@nod.at>, <sanjaikumar.vs@dicortech.com>,
<stable@vger.kernel.org>, <tudor.ambarus@linaro.org>,
<vigneshr@ti.com>
Subject: Re: [PATCH v2 1/2] mtd: spi-nor: sst: Fix write enable before AAI sequence
Date: Mon, 23 Feb 2026 10:29:20 +0100 [thread overview]
Message-ID: <DGM8HPC181AF.3FCCS4MIE4A43@kernel.org> (raw)
In-Reply-To: <20260223091733.47-1-sanjaikumarvs@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1884 bytes --]
Hi,
On Mon Feb 23, 2026 at 10:17 AM CET, Sanjaikumar V S wrote:
>> Raises concern about writes ending at odd offsets potentially
>> having the same issue
>
> The odd end address case (trailing byte) is already handled in the
> existing code at lines 243-255:
>
> /* Write out trailing byte if it exists. */
> if (actual != len) {
> ret = spi_nor_write_enable(nor);
> ...
> ret = sst_nor_write_data(nor, to, 1, buf + actual);
> }
Ah, I must be blind. I stopped reading at the write_disable.
> So write_enable is already called before writing the trailing
> byte. My patch only addresses the odd start case where BP clears
> WEL before the AAI sequence begins.
>
>> Suggests simplifying the conditional logic by removing the length
>> check
>
> The condition `if (actual < len - 1)` avoids an unnecessary
> write_enable when len == 1 (single byte write at odd address, no
> AAI follows). But if you prefer unconditional write_enable for
> simplicity, I can change it in v3.
I know, but I actually don't like repeating the condition in the for
loop. So I'd prefer to have a local "needs_write_enable" boolean
which will be set to true. But then, I wouldn't care too much if
there is a write enable followed by a write disable for a rare case.
>> Notes the patch lacks runtime testing
>
> I don't have the hardware setup to test odd-address writes at the
> moment. The fix is based on code analysis. I have tested patch 2/2
> (dirmap fallback) on hardware.
I'm hesitant - because like I said, if there is really a bug - it
would have never worked correctly, since day 1. But yeah, I've also
read the datasheet and it clearly states that the byte write will
clear the write enable latch.
> Please let me know if you'd like me to send a v3 with the
> simplified unconditional write_enable.
Please see above.
-michael
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
next prev parent reply other threads:[~2026-02-23 9:29 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 9:42 [PATCH v2 0/2] mtd: spi-nor: Fix SST AAI write mode Sanjaikumar V S
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
2026-02-23 9:17 ` Sanjaikumar V S
2026-02-23 9:29 ` Michael Walle [this message]
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=DGM8HPC181AF.3FCCS4MIE4A43@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