From: Stefan Eichenberger <eichest@gmail.com>
To: Mehmet Fide <mehmet.fide@gmail.com>
Cc: Andi Shyti <andi.shyti@kernel.org>,
Oleksij Rempel <o.rempel@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Frank Li <Frank.Li@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Stefan Eichenberger <stefan.eichenberger@toradex.com>,
linux-i2c@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
mehmet.fide@screeningeagle.com
Subject: Re: [PATCH] i2c: imx: acknowledge the count byte of an atomic block read
Date: Mon, 16 Nov 2026 18:59:30 +0100 [thread overview]
Message-ID: <avtEgpw9YpIzCj5p@eichest-laptop> (raw)
In-Reply-To: <20261116122707.1349139-1-mehmet.fide@gmail.com>
On Mon, Nov 16, 2026 at 01:27:06PM +0100, Mehmet Fide wrote:
> From: Mehmet Fide <mehmet.fide@screeningeagle.com>
>
> i2c_smbus_xfer_emulated() sends the read message of an SMBus block read
> with a length of 1 and I2C_M_RECV_LEN. i2c_imx_prepare_read() clears
> I2CR_TXAK only for a message longer than one byte, so the atomic read
> does not acknowledge the count byte. The target stops sending, the rest
> of the block is read as 0xff and the transfer reports success.
>
> The test for I2C_M_RECV_LEN was dropped when the read was split into
> i2c_imx_prepare_read() and its callers. Commit a5d0b9e32745 ("i2c: imx:
> fix emulated smbus block read") added it back to the interrupt driven
> read only. The DMA read never gets an I2C_M_RECV_LEN message.
>
> Fixes: b460b15b3cc2 ("i2c: imx: separate atomic, dma and non-dma use case")
> Cc: stable@vger.kernel.org # v6.13+
> Signed-off-by: Mehmet Fide <mehmet.fide@screeningeagle.com>
> ---
>
> Notes:
> Reported by the Sashiko review of "i2c: imx: test the block read flag of
> the message that is read":
> https://sashiko.dev/#/bug/linux-09e3015b-fc03-4410-809b-82964cdfac9c
>
> Tested on a Colibri VF50 on the Iris carrier, kernel at this base, with
> the M41T0 RTC at 0x68. The core takes the atomic path only after
> SYSTEM_RUNNING, so a test-only hook called xfer_atomic() with interrupts
> disabled, with the two messages that i2c_smbus_xfer_emulated() builds
> for a block read. Register 0x04 (0x13) as count byte: without the patch
> 0x13 and then 0xff (50 of 50, return 2); with it the next registers,
> the same bytes as the interrupt driven read (50 of 50). With a count
> byte of 1 (register 0x05): 01 ff before, 01 01 after (50 of 50 each).
>
> drivers/i2c/busses/i2c-imx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index ccf08cd63151..1a3fc245d6ba 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1283,7 +1283,7 @@ static int i2c_imx_prepare_read(struct imx_i2c_struct *i2c_imx,
> * Reset the I2CR_TXAK flag initially for SMBus block read since the
> * length is unknown
> */
> - if (msgs->len - 1)
> + if ((msgs->len - 1) || (msgs->flags & I2C_M_RECV_LEN))
> temp &= ~I2CR_TXAK;
> if (use_dma)
> temp |= I2CR_DMAEN;
>
> base-commit: 25e7ab89f4774b0f842cee0e8a20c11f755924d5
> --
> 2.56.0
Thanks for the fix.
Reviewed-by: Stefan Eichenberger <eichest@gmail.com>
prev parent reply other threads:[~2026-11-16 17:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 12:27 Mehmet Fide
2026-11-16 17:59 ` Stefan Eichenberger [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=avtEgpw9YpIzCj5p@eichest-laptop \
--to=eichest@gmail.com \
--cc=Frank.Li@nxp.com \
--cc=andi.shyti@kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mehmet.fide@gmail.com \
--cc=mehmet.fide@screeningeagle.com \
--cc=o.rempel@pengutronix.de \
--cc=s.hauer@pengutronix.de \
--cc=stable@vger.kernel.org \
--cc=stefan.eichenberger@toradex.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
all inboxes | Powered by JetHome®