From: Andi Shyti <andi.shyti@kernel.org>
To: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Cc: Michal Simek <michal.simek@amd.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Raviteja Narayanam <raviteja.narayanam@xilinx.com>,
Wolfram Sang <wsa@kernel.org>,
Manikanta Guntupalli <manikanta.guntupalli@amd.com>,
Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v6 1/3] i2c: xiic: preserve PEC byte length in SMBus block read setup
Date: Thu, 24 Sep 2026 22:09:22 +0200 [thread overview]
Message-ID: <arWC6PFh3YVgU1Pd@zenone.zhora.eu> (raw)
In-Reply-To: <20260923-i2c-xiic-v6-1-3a15b6397f5a@nexthop.ai>
Hi Abdurraham,
there is still another issue here.
...
> @@ -546,23 +552,26 @@ static void xiic_smbus_block_read_setup(struct xiic_i2c *i2c)
> * Receive fifo depth should set to Rx fifo capacity minus 1
> */
> rfd_set = IIC_RX_FIFO_DEPTH - 1;
> - i2c->rx_msg->len = rxmsg_len + 1;
> - } else if ((rxmsg_len == 1) ||
> - (rxmsg_len == 0)) {
> + i2c->rx_msg->len = rxmsg_len + 1 + pec_len;
> + } else if (1 + rxmsg_len + pec_len < SMBUS_BLOCK_READ_MIN_LEN) {
> /*
> - * Minimum of 3 bytes required to exit cleanly. 1 byte
> - * already received, Second byte is being received. Have
> - * to set NACK in read_rx before receiving the last byte
> + * The HW needs SMBUS_BLOCK_READ_MIN_LEN bytes on the
> + * bus to exit cleanly: by the time the ISR reads the
> + * length byte the second byte is already being clocked
> + * in, too late to NACK. Pad the drain target and record
> + * the real length, trimmed back on completion so the
> + * PEC check sees the right byte.
> */
> rfd_set = 0;
> i2c->rx_msg->len = SMBUS_BLOCK_READ_MIN_LEN;
> + i2c->smbus_actual_len = 1 + rxmsg_len + pec_len;
> } else {
> /*
> * When Rx msg len less than Rx fifo capacity
> * Receive fifo depth should set to Rx msg len minus 2
> */
> rfd_set = rxmsg_len - 2;
what if rxmsg is 1? Before this could never happen because we
were checking for rxmsg_len == 0 or 1 and we were ending up here
for values greater than 1.
In patch 2 you fix things, but we don't want to have dependencies
between patches.
Andi
> - i2c->rx_msg->len = rxmsg_len + 1;
> + i2c->rx_msg->len = rxmsg_len + 1 + pec_len;
> }
> xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rfd_set);
next prev parent reply other threads:[~2026-09-24 20:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 1:45 [PATCH v6 0/3] i2c: xiic: fix SMBus block read and PEC support Abdurrahman Hussain
2026-09-24 1:45 ` [PATCH v6 1/3] i2c: xiic: preserve PEC byte length in SMBus block read setup Abdurrahman Hussain
2026-09-24 20:09 ` Andi Shyti [this message]
2026-09-25 0:09 ` Abdurrahman Hussain
2026-09-24 1:45 ` [PATCH v6 2/3] i2c: xiic: defer RX_FULL until all trailing bytes are in FIFO Abdurrahman Hussain
2026-09-24 1:45 ` [PATCH v6 3/3] i2c: xiic: don't clobber msg->len to signal block-read completion Abdurrahman Hussain
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=arWC6PFh3YVgU1Pd@zenone.zhora.eu \
--to=andi.shyti@kernel.org \
--cc=abdurrahman@nexthop.ai \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manikanta.guntupalli@amd.com \
--cc=michal.simek@amd.com \
--cc=raviteja.narayanam@xilinx.com \
--cc=shubhrajyoti.datta@amd.com \
--cc=stable@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@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