Re: [PATCH] i2c: cadence: Support PEC for SMBus block read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 17, 2022 at 04:52:44PM +0200, Lars-Peter Clausen wrote:
> SMBus packet error checking (PEC) is implemented by appending one
> additional byte of checksum data at the end of the message. This provides
> additional protection and allows to detect data corruption on the I2C bus.
> 
> SMBus block reads support variable length reads. The first byte in the read
> message is the number of available data bytes.
> 
> The combination of PEC and block read is currently not supported by the
> Cadence I2C driver.
>  * When PEC is enabled the maximum transfer length for block reads
>    increases from 33 to 34 bytes.
>  * The I2C core smbus emulation layer relies on the driver updating the
>    `i2c_msg` `len` field with the number of received bytes. The updated
>    length is used when checking the PEC.
> 
> Add support to the Cadence I2C driver for handling SMBus block reads with
> PEC. To determine the maximum transfer length uses the initial `len` value
> of the `i2c_msg`. When PEC is enabled this will be 2, when it is disabled
> it will be 1.
> 
> Once a read transfer is done also increment the `len` field by the amount
> of received data bytes.
> 
> This change has been tested with a UCM90320 PMBus power monitor, which
> requires block reads to access certain data fields, but also has PEC
> enabled by default.
> 
> Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller")
> Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx>

Applied to for-next with the Fixes tag, thanks!

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux