RE: [PATCH] i2c: imx: fix emulated smbus block read

KUCHARCZYK Lukasz
2025-05-27T12:02:42Z

> -----Original Message-----
> From: Carlos Song <carlos.song@nxp.com>
> Sent: 27 May 2025 12:46
> Subject: RE: [PATCH] i2c: imx: fix emulated smbus block read
>
> I2C SMBUS block read need first read one byte from data length offset then
> I2C will know how many bytes need to continue read. For this issue you can
> meet " Error: Read failed " when using i2cget -f -y bus address offset s to test.
>
> So you apply this change to make i2c-imx controller can behavior like this:
>
> S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Count] A [Data] A [Data] A ... A
> [Data] NA P
>
> Do I understand this right?

hi Carlos; thanks for the message! Yes, exactly, that's correct.

I run into this issue while trying to integrate a smart battery into a
IMX8-based system. Fetching of properties that rely on data block read
operation (i.e., ManufacturerName, DeviceName, DeviceChemistry and
ManufacturerData) was failing.

With the fix the block read looks just like you described.

Without the fix, the transaction on the bus looked somehow like:
S Addr Wr [A] Comm [A] Sr Addr Rd [A] [Count] NA [0xff] NA [0xff] NA ... [0xff] NA P

(i.e., the Count is not acknowledged and SDA remains high afterwards).

Lukasz