Skip to content

Commit a058b24

Browse files
Alain Volmatwsakernel
authored andcommitted
i2c: stm32f7: perform I2C_ISR read once at beginning of event isr
Move readl_relaxed of I2C_ISR register at beginning of event isr so that it done once for both master & slave handling. Signed-off-by: Alain Volmat <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent bf12998 commit a058b24

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

drivers/i2c/busses/i2c-stm32f7.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,15 +1419,13 @@ static bool stm32f7_i2c_is_slave_busy(struct stm32f7_i2c_dev *i2c_dev)
14191419
return i == busy;
14201420
}
14211421

1422-
static irqreturn_t stm32f7_i2c_slave_isr_event(struct stm32f7_i2c_dev *i2c_dev)
1422+
static irqreturn_t stm32f7_i2c_slave_isr_event(struct stm32f7_i2c_dev *i2c_dev, u32 status)
14231423
{
14241424
void __iomem *base = i2c_dev->base;
1425-
u32 cr2, status, mask;
1425+
u32 cr2, mask;
14261426
u8 val;
14271427
int ret;
14281428

1429-
status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR);
1430-
14311429
/* Slave transmitter mode */
14321430
if (status & STM32F7_I2C_ISR_TXIS) {
14331431
i2c_slave_event(i2c_dev->slave_running,
@@ -1531,11 +1529,11 @@ static irqreturn_t stm32f7_i2c_isr_event_thread(int irq, void *data)
15311529
u32 status, mask;
15321530
int ret;
15331531

1534-
if (!i2c_dev->master_mode)
1535-
return stm32f7_i2c_slave_isr_event(i2c_dev);
1536-
15371532
status = readl_relaxed(i2c_dev->base + STM32F7_I2C_ISR);
15381533

1534+
if (!i2c_dev->master_mode)
1535+
return stm32f7_i2c_slave_isr_event(i2c_dev, status);
1536+
15391537
/* NACK received */
15401538
if (status & STM32F7_I2C_ISR_NACKF) {
15411539
dev_dbg(i2c_dev->dev, "<%s>: Receive NACK (addr %x)\n",

0 commit comments

Comments
 (0)