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

Carlos Song
2025-05-28T01:50:56Z

> -----Original Message-----
> From: KUCHARCZYK Lukasz <lukasz.kucharczyk@leica-geosystems.com>
> Sent: Tuesday, May 27, 2025 8:03 PM
> To: Carlos Song <carlos.song@nxp.com>; Oleksij Rempel
> <o.rempel@pengutronix.de>; stefan.eichenberger@toradex.com; Pengutronix
> Kernel Team <kernel@pengutronix.de>; Andi Shyti <andi.shyti@kernel.org>;
> Shawn Guo <shawnguo@kernel.org>; Sascha Hauer <s.hauer@pengutronix.de>;
> Fabio Estevam <festevam@gmail.com>
> Cc: open list:FREESCALE IMX I2C DRIVER <linux-i2c@vger.kernel.org>; open
> list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE <imx@lists.linux.dev>;
> moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
> <linux-arm-kernel@lists.infradead.org>; open list
> <linux-kernel@vger.kernel.org>; GEO-CHHER-bsp-development
> <bsp-development.geo@leica-geosystems.com>;
> customers.leicageo@pengutronix.de
> Subject: [EXT] RE: [PATCH] i2c: imx: fix emulated smbus block read
>
> [You don't often get email from lukasz.kucharczyk@leica-geosystems.com.
> Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> > -----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).
>

Good, thank you for your work!
Reviewed-by: Carlos Song <carlos.song@nxp.com>

> Lukasz