All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Walle <mwalle@kernel.org>
To: Dong Aisheng <aisheng.dong@nxp.com>,
	Andi Shyti <andi.shyti@kernel.org>, Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>
Cc: Carlos Song <carlos.song@nxp.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-i2c@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Michael Walle <mwalle@kernel.org>
Subject: [PATCH 2/2] i2c: imx-lpi2c: don't treat a NACK in SMBus block read as an error
Date: Wed,  4 Nov 2026 13:10:36 +0100	[thread overview]
Message-ID: <20261104121108.659820-2-mwalle@kernel.org> (raw)
In-Reply-To: <20261104121108.659820-1-mwalle@kernel.org>

An SMBus device might indicate that a value isn't ready yet by asserting
a NACK.
This will lead to the following error message which will flood the
kernel log for some device like an IPMI SSIF BMC:

   [    4.277005] i2c i2c-5: SMBus read count failed -110

Stop the polling if NDF is set and return -EIO, just like everywhere
else. While at it, drop the MSR_RDF_ASSERTED() macro, it's just one bit,
no need for FIELD_GET.

Fixes: efdc383d1cc2 ("i2c: imx-lpi2c: fix SMBus block read NACK after byte count")
Signed-off-by: Michael Walle <mwalle@kernel.org>
---
 drivers/i2c/busses/i2c-imx-lpi2c.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index f57e800ac3b5..583155802e8a 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -92,7 +92,6 @@
 #define MRDR_RXEMPTY	BIT(14)
 #define MDER_TDDE	BIT(0)
 #define MDER_RDDE	BIT(1)
-#define MSR_RDF_ASSERTED(x) FIELD_GET(MSR_RDF, (x))
 
 #define SCR_SEN		BIT(0)
 #define SCR_RST		BIT(1)
@@ -594,7 +593,10 @@ static int lpi2c_imx_read_init(struct lpi2c_imx_struct *lpi2c_imx,
 		writel((RECV_DATA << 8) | 0x01, lpi2c_imx->base + LPI2C_MTDR);
 
 		ret = readl_poll_timeout(lpi2c_imx->base + LPI2C_MSR, val,
-					 MSR_RDF_ASSERTED(val), 1, 1000);
+					 (val & (MSR_RDF | MSR_NDF)), 1, 1000);
+		if (val & MSR_NDF)
+			return -EIO;
+
 		if (ret) {
 			dev_err(&lpi2c_imx->adapter.dev, "SMBus read count failed %d\n", ret);
 			return ret;
-- 
2.47.3


  reply	other threads:[~2026-11-04 12:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04 12:10 [PATCH 1/2] i2c: imx-lpi2c: fix SMBus block read with PEC Michael Walle
2026-11-04 12:10 ` Michael Walle [this message]
2026-11-05  8:33   ` [PATCH 2/2] i2c: imx-lpi2c: don't treat a NACK in SMBus block read as an error Carlos Song
2026-11-05  8:29 ` [PATCH 1/2] i2c: imx-lpi2c: fix SMBus block read with PEC Carlos Song
2026-11-05  8:41   ` Michael Walle

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=20261104121108.659820-2-mwalle@kernel.org \
    --to=mwalle@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=aisheng.dong@nxp.com \
    --cc=andi.shyti@kernel.org \
    --cc=carlos.song@nxp.com \
    --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=s.hauer@pengutronix.de \
    --cc=wsa+renesas@sang-engineering.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.