Skip to content

Commit b933d1f

Browse files
Alain Volmatwsakernel
authored andcommitted
i2c: stm32f7: recover the bus on access timeout
When getting an access timeout, ensure that the bus is in a proper state prior to returning the error. Fixes: aeb068c ("i2c: i2c-stm32f7: add driver") Signed-off-by: Alain Volmat <[email protected]> Reviewed-by: Pierre-Yves MORDRET <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 0c21d02 commit b933d1f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/i2c/busses/i2c-stm32f7.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,7 @@ static int stm32f7_i2c_xfer(struct i2c_adapter *i2c_adap,
17121712
i2c_dev->msg->addr);
17131713
if (i2c_dev->use_dma)
17141714
dmaengine_terminate_all(dma->chan_using);
1715+
stm32f7_i2c_wait_free_bus(i2c_dev);
17151716
ret = -ETIMEDOUT;
17161717
}
17171718

@@ -1769,6 +1770,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
17691770
dev_dbg(dev, "Access to slave 0x%x timed out\n", f7_msg->addr);
17701771
if (i2c_dev->use_dma)
17711772
dmaengine_terminate_all(dma->chan_using);
1773+
stm32f7_i2c_wait_free_bus(i2c_dev);
17721774
ret = -ETIMEDOUT;
17731775
goto pm_free;
17741776
}

0 commit comments

Comments
 (0)