i2c: omap24xx_i2c: Use new function __omap24_i2c_xfer_msg()
authorAniket Limaye <a-limaye@ti.com>
Tue, 22 Apr 2025 10:19:50 +0000 (15:49 +0530)
committerHeiko Schocher <hs@denx.de>
Tue, 22 Apr 2025 11:03:37 +0000 (13:03 +0200)
commit520b57ee4763a81a165eabf700a585ae67d79aa7
tree1c8f43646b34d669c150cc2f20a16d714da10d7d
parent640f9f33a17ad799d63a8b6f44ce494193d64656
i2c: omap24xx_i2c: Use new function __omap24_i2c_xfer_msg()

Remove __omap24_i2c_read/write() usage from omap_i2c_xfer() in favour of
the more flexible __omap24_i2c_xfer_msg().
Consequently, these are also no longer needed when DM_I2C is enabled.

New function __omap24_i2c_xfer_msg() will take care of individual read
OR write transfers with a target device. It goes through below sequence:
- Program the provided Target Chip address (OMAP_I2C_SA_REG)
- Program the provided Data len (OMAP_I2C_CNT_REG)
- Program the provided Control register flags (OMAP_I2C_CON_REG)
- Read from or Write to the provided Data buffer (OMAP_I2C_DATA_REG)

For a detailed programming guide, refer to the TRM[0] (12.1.3.4 I2C
Programming Guide).

This patch by itself should be a transparent change. However this is
needed for implementing a proper Repeated Start (Sr) functionality for
i2c_msgs.

Previous implementation for omap_i2c_xfer called __omap24_i2c_read/write
functions, with hardcoded addr=0 and alen=0 for each i2c_msg. Each of
these calls would program the registers always with a Stop bit set, not
allowing for a repeated start between i2c_msgs in the same xfer().

[0]: https://www.ti.com/lit/zip/spruj28 (TRM)

Signed-off-by: Aniket Limaye <a-limaye@ti.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
drivers/i2c/omap24xx_i2c.c