Skip to content

Commit 3993021

Browse files
elkablowsakernel
authored andcommitted
i2c: mv64xxx: Fix random system lock caused by runtime PM
I noticed a weird bug with this driver on Marvell CN9130 Customer Reference Board. Sometime after boot, the system locks with the following message: [104.071363] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0 The system does not respond afterwards, only warns about RCU stalls. This first appeared with commit e5c02cf ("i2c: mv64xxx: Add runtime PM support"). With further experimentation I discovered that adding a delay into mv64xxx_i2c_hw_init() fixes this issue. This function is called before every xfer, due to how runtime PM works in this driver. It seems that in order to work correctly, a delay is needed after the bus is reset in this function. Since there already is a known erratum with this controller needing a delay, I assume that this is just another place this needs to be applied. Therefore I apply the delay only if errata_delay is true. Signed-off-by: Marek Behún <kabel@kernel.org> Acked-by: Gregory CLEMENT <gregory.clement@bootlin.com> Reviewed-by: Samuel Holland <samuel@sholland.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent d434405 commit 3993021

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/i2c/busses/i2c-mv64xxx.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
221221
writel(0, drv_data->reg_base + drv_data->reg_offsets.ext_addr);
222222
writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
223223
drv_data->reg_base + drv_data->reg_offsets.control);
224+
225+
if (drv_data->errata_delay)
226+
udelay(5);
227+
224228
drv_data->state = MV64XXX_I2C_STATE_IDLE;
225229
}
226230

0 commit comments

Comments
 (0)