i2c: octeon: add block-mode i2c operations
authorAryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
Mon, 24 Mar 2025 19:29:46 +0000 (08:29 +1300)
committerAndi Shyti <andi@smida.it>
Mon, 19 May 2025 20:23:55 +0000 (22:23 +0200)
commit63ef02da5ddb725555cd41f125ec0bd8e893da3a
tree3e3f671bf00e68a1087d7da1088826bf13dcaba9
parente1902d658e427601414d3e941d9254100e48c7fc
i2c: octeon: add block-mode i2c operations

Add functions to perform block read and write operations. This applies
for cases where the requested operation is for >8 bytes of data.

When not using the block mode transfer, the driver will attempt a series
of 8 byte i2c operations until it reaches the desired total. For
example, for a 40 byte request the driver will complete 5 separate
transactions. This results in large transactions taking a significant
amount of time to process.

Add block mode such that the driver can request larger transactions, up
to 1024 bytes per transfer.

Many aspects of the block mode transfer is common with the regular 8
byte operations. Use generic functions for parts of the message
construction and sending the message. The key difference for the block
mode is the usage of separate FIFO buffer to store data.

Write to this buffer in the case of a write (before command send).
Read from this buffer in the case of a read (after command send).

Data is written into this buffer by placing data into the MSB onwards.
This means the bottom 8 bits of the data will match the top 8 bits, and
so on and so forth.

Set specific bits in message for block mode, enable block mode transfers
from global i2c management registers, construct message, send message,
read or write from FIFO buffer as required.

The block-mode transactions result in a significant speed increase in
large i2c requests.

Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
Link: https://lore.kernel.org/r/20250324192946.3078712-2-aryan.srivastava@alliedtelesis.co.nz
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-octeon-core.c
drivers/i2c/busses/i2c-octeon-core.h
drivers/i2c/busses/i2c-thunderx-pcidrv.c