mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-27 12:32:50 +00:00
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>
This commit is contained in:
committed by
Andi Shyti
parent
535677e44d
commit
64b6426a6e
@@ -352,6 +352,14 @@ static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev)
|
||||
dev->status &= ~STATUS_ACTIVE;
|
||||
}
|
||||
|
||||
static inline void __i2c_dw_write_intr_mask(struct dw_i2c_dev *dev,
|
||||
unsigned int intr_mask)
|
||||
{
|
||||
unsigned int val = dev->flags & ACCESS_POLLING ? 0 : intr_mask;
|
||||
|
||||
regmap_write(dev->map, DW_IC_INTR_MASK, val);
|
||||
}
|
||||
|
||||
void __i2c_dw_disable(struct dw_i2c_dev *dev);
|
||||
|
||||
extern void i2c_dw_configure_master(struct dw_i2c_dev *dev);
|
||||
|
||||
@@ -250,7 +250,7 @@ static void i2c_dw_xfer_init(struct dw_i2c_dev *dev)
|
||||
|
||||
/* Clear and enable interrupts */
|
||||
regmap_read(dev->map, DW_IC_CLR_INTR, &dummy);
|
||||
regmap_write(dev->map, DW_IC_INTR_MASK, DW_IC_INTR_MASTER_MASK);
|
||||
__i2c_dw_write_intr_mask(dev, DW_IC_INTR_MASTER_MASK);
|
||||
}
|
||||
|
||||
static int i2c_dw_check_stopbit(struct dw_i2c_dev *dev)
|
||||
@@ -300,7 +300,6 @@ static int amd_i2c_dw_xfer_quirk(struct i2c_adapter *adap, struct i2c_msg *msgs,
|
||||
dev->msgs = msgs;
|
||||
dev->msgs_num = num_msgs;
|
||||
i2c_dw_xfer_init(dev);
|
||||
regmap_write(dev->map, DW_IC_INTR_MASK, 0);
|
||||
|
||||
/* Initiate messages read/write transaction */
|
||||
for (msg_wrt_idx = 0; msg_wrt_idx < num_msgs; msg_wrt_idx++) {
|
||||
@@ -384,7 +383,6 @@ static int txgbe_i2c_dw_xfer_quirk(struct i2c_adapter *adap, struct i2c_msg *msg
|
||||
dev->msgs = msgs;
|
||||
dev->msgs_num = num_msgs;
|
||||
i2c_dw_xfer_init(dev);
|
||||
regmap_write(dev->map, DW_IC_INTR_MASK, 0);
|
||||
|
||||
for (msg_idx = 0; msg_idx < num_msgs; msg_idx++) {
|
||||
buf = msgs[msg_idx].buf;
|
||||
|
||||
Reference in New Issue
Block a user