i2c: imx-lpi2c: add target mode support
authorCarlos Song <carlos.song@nxp.com>
Mon, 30 Dec 2024 03:38:46 +0000 (11:38 +0800)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 7 Jan 2025 22:46:11 +0000 (23:46 +0100)
commit1ee867e465c1b0216ec02d4c0d334c4e89919cec
tree766098cb726c2916b287a994a6b5a4bf59fd0efb
parentfebe15218072eee5361a36f4510711a7cf7403e1
i2c: imx-lpi2c: add target mode support

LPI2C support master controller and target controller enabled
simultaneously. Both controllers share the same SDA/SCL lines
and interrupt source but has a separate control and status
registers. When target is enabled and an interrupt has been
triggered, target register status will be checked to determine
IRQ source. Then enter the corresponding interrupt handler
function of master or target to handle the interrupt event.

This patch supports basic target data read/write operations in
7-bit target address. LPI2C target mode can be enabled by using
I2C slave backend. I2C slave backend behaves like a standard I2C
client. For simple use and test, Linux I2C slave EEPROM backend
can be used.

Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20241230033846.2302500-1-carlos.song@nxp.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-imx-lpi2c.c