From: Francesco Valla <francesco@valla.it>
To: Markus Breitenberger <bre@breiti.cc>
Cc: srini@kernel.org, alexander.sverdlin@siemens.com,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
Markus Breitenberger <bre@keba.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] eeprom: at25: fix read_poll_timeout argument order
Date: Fri, 11 Sep 2026 18:04:24 +0200 [thread overview]
Message-ID: <aqQlk5A3j4smHlf9@bywater> (raw)
In-Reply-To: <20260826121334.122881-1-bre@breiti.cc>
Hi Markus,
On Wed, Aug 26, 2026 at 02:13:34PM +0200, Markus Breitenberger wrote:
> From: Markus Breitenberger <bre@keba.com>
>
> Commit 8ad6249c51d0 ("eeprom: at25: convert to spi-mem API") passes
> the arguments to read_poll_timeout() in the wrong order. It supplies false
> as sleep_us, USEC_PER_MSEC as timeout_us, and USEC_PER_MSEC * EE_TIMEOUT
> as sleep_before_read.
>
> Consequently, at25_wait_ready() busy-polls with a timeout of only 1 ms
> instead of sleeping between polls and timing out after 25 ms. EEPROMs which
> keep the write-in-progress bit set for longer than 1 ms are reported as
> timed out, although the page may still be programmed after the driver
> returns. A multi-page write is then aborted after the first page, leaving a
> partial write.
>
> This was reproduced with a 25LC080: a 32-byte write spanning two 16-byte
> pages returned -ETIMEDOUT after programming only the first page.
>
This impacted also a device equipped with a M95512W EEPROM from ST, for
which I saw consistent write timeouts (even if on a second read the
memory contains the intended value). I can confirm your fix solved the
issue.
Tested-by: Francesco Valla <francesco@valla.it>
> Pass the polling interval, timeout, and sleep_before_read argument in their
> proper positions.
>
> Fixes: 8ad6249c51d0 ("eeprom: at25: convert to spi-mem API")
> Cc: stable@vger.kernel.org
> Signed-off-by: Markus Breitenberger <bre@keba.com>
> ---
> drivers/nvmem/at25.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvmem/at25.c b/drivers/nvmem/at25.c
> index bc2cfb75d9bb4..9e71c6a859471 100644
> --- a/drivers/nvmem/at25.c
> +++ b/drivers/nvmem/at25.c
> @@ -224,8 +224,8 @@ static int at25_wait_ready(struct at25_data *at25)
> SPI_MEM_OP_DATA_IN(1, bounce, 1));
>
> read_poll_timeout(spi_mem_exec_op, status,
> - status || !(bounce[0] & AT25_SR_nRDY), false,
> - USEC_PER_MSEC, USEC_PER_MSEC * EE_TIMEOUT,
> + status || !(bounce[0] & AT25_SR_nRDY),
> + USEC_PER_MSEC, USEC_PER_MSEC * EE_TIMEOUT, false,
> at25->spimem, &op);
> if (status < 0)
> return status;
> --
> 2.47.3
>
Thank you!
Regards,
Francesco
prev parent reply other threads:[~2026-09-11 17:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 12:13 Markus Breitenberger
2026-08-27 13:25 ` Sverdlin, Alexander
2026-09-11 16:04 ` Francesco Valla [this message]
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=aqQlk5A3j4smHlf9@bywater \
--to=francesco@valla.it \
--cc=alexander.sverdlin@siemens.com \
--cc=bre@breiti.cc \
--cc=bre@keba.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srini@kernel.org \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®