i2c: designware: Do not enable interrupts shortly in polling mode
authorJarkko Nikula <jarkko.nikula@linux.intel.com>
Tue, 13 Feb 2024 12:48:43 +0000 (14:48 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Tue, 27 Feb 2024 00:51:32 +0000 (01:51 +0100)
commit64b6426a6e97a95c044fd2fff3f0adf7c1edb60c
treed193ac39b1bc39a55ad9ae10512c9245d3a1fd6a
parent535677e44d57a31e1363529b5ecddb92653d7136
i2c: designware: Do not enable interrupts shortly in polling mode

I was testing the polling mode txgbe_i2c_dw_xfer_quirk() on a HW where
the i2c-designware has interrupt connected and shared with other device.
I noticed there is a bogus interrupt for each transfer.

Reason for this that both polling mode functions call the
i2c_dw_xfer_init() which enable interrupts then followed by immediate
disable by the same polling mode functions. This is enough to trigger
TX_EMPTY interrupt.

Fix this by introducing a __i2c_dw_write_intr_mask() helper that unmasks
interrupts conditionally and use it in i2c_dw_xfer_init().

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Tested-by: Jiawen Wu <jiawenwu@trustnetic.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
drivers/i2c/busses/i2c-designware-core.h
drivers/i2c/busses/i2c-designware-master.c