linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM
       [not found] <20210419204343.6134-1-sashal@kernel.org>
@ 2021-04-19 20:43 ` Sasha Levin
  2021-04-20  6:30   ` Marek Behún
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2021-04-19 20:43 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Marek Behún, Gregory CLEMENT, Samuel Holland, Wolfram Sang,
	Sasha Levin, linux-i2c

From: Marek Behún <kabel@kernel.org>

[ Upstream commit 39930213e7779b9c4257499972b8afb8858f1a2d ]

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 e5c02cf54154 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/i2c/busses/i2c-mv64xxx.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 5cfe70aedced..1b55352abbe8 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -220,6 +220,10 @@ mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
 	writel(0, drv_data->reg_base + drv_data->reg_offsets.ext_addr);
 	writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
 		drv_data->reg_base + drv_data->reg_offsets.control);
+
+	if (drv_data->errata_delay)
+		udelay(5);
+
 	drv_data->state = MV64XXX_I2C_STATE_IDLE;
 }
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM
  2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM Sasha Levin
@ 2021-04-20  6:30   ` Marek Behún
  2021-04-25 21:41     ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Behún @ 2021-04-20  6:30 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Gregory CLEMENT, Samuel Holland,
	Wolfram Sang, linux-i2c

On Mon, 19 Apr 2021 16:43:36 -0400
Sasha Levin <sashal@kernel.org> wrote:

> This first appeared with commit e5c02cf54154 ("i2c: mv64xxx: Add runtime
> PM support").

I forgot to add Fixes: tag to this commit. But the bug first appeared with
commit
  e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
which is in 5.12, but not 5.11 or any others.

So this fix is not needed for the stable releases (althogh it does not
break anything on those...).

Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM
  2021-04-20  6:30   ` Marek Behún
@ 2021-04-25 21:41     ` Sasha Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2021-04-25 21:41 UTC (permalink / raw)
  To: Marek Behún
  Cc: linux-kernel, stable, Gregory CLEMENT, Samuel Holland,
	Wolfram Sang, linux-i2c

On Tue, Apr 20, 2021 at 08:30:50AM +0200, Marek Behún wrote:
>On Mon, 19 Apr 2021 16:43:36 -0400
>Sasha Levin <sashal@kernel.org> wrote:
>
>> This first appeared with commit e5c02cf54154 ("i2c: mv64xxx: Add runtime
>> PM support").
>
>I forgot to add Fixes: tag to this commit. But the bug first appeared with
>commit
>  e5c02cf54154 ("i2c: mv64xxx: Add runtime PM support")
>which is in 5.12, but not 5.11 or any others.
>
>So this fix is not needed for the stable releases (althogh it does not
>break anything on those...).

I'll drop it, thanks!

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-25 21:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210419204343.6134-1-sashal@kernel.org>
2021-04-19 20:43 ` [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM Sasha Levin
2021-04-20  6:30   ` Marek Behún
2021-04-25 21:41     ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).