This fixes an illegal I2C format of a START condition immediately followed by a STOP condition which is illegal in the I2C protocol[1]. This only happens for the last message in a transfer (the one after which a STOP condition should occur). While the I2C spec says "Many devices however are designed to operate properly under this condition", one of the devices that doesn't seem to operate properly under this condition is an SE050 Secure Element which stops in the middle of a message after a few transfers. Might be related to Errata 3.2[2] but it isn't exactly the same setup as the one for the illegal format here.
This fixes the setup for sending the STOP condition so that the illegal format doesn't exist anymore and the multi-messages transfers still work as expected (tested with SYR828 on RockPro64). While at it, fix a bitfield typo to enable the "controller finished sending the STOP" interrupt which has no impact on the HW (likely because U-Boot doesn't actually make use of interrupts and the interrupt status register of the IP always being up-to-date regardless of the interrupt enabling). Finally, fix the location of the last ACK/NACK comment when receiving multi-word messages. [1] https://www.nxp.com/docs/en/user-guide/UM10204.pdf 3.1.10 The target address and R/W bit point 5 [2] https://www.nxp.com/docs/en/errata/SE050_Erratasheet.pdf Signed-off-by: Quentin Schulz <[email protected]> --- Quentin Schulz (3): rockchip: i2c: fix incorrect STOP flag for the interrupt enable register rockchip: i2c: move ACK comment where it applies rockchip: i2c: fix illegal I2C START/STOP condition drivers/i2c/rk_i2c.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) --- base-commit: c2637036b8f0c90a2cfc59900f7da31eae646b03 change-id: 20251107-rk-i2c-illegal-ef7fdb4b886d Best regards, -- Quentin Schulz <[email protected]>

