All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: "Marek Behún" <kabel@kernel.org>,
	"Gregory CLEMENT" <gregory.clement@bootlin.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Wolfram Sang" <wsa@kernel.org>,
	"Sasha Levin" <sashal@kernel.org>,
	linux-i2c@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 08/11] i2c: mv64xxx: Fix random system lock caused by runtime PM
Date: Mon, 19 Apr 2021 16:45:33 -0400	[thread overview]
Message-ID: <20210419204536.6924-8-sashal@kernel.org> (raw)
In-Reply-To: <20210419204536.6924-1-sashal@kernel.org>

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 b0fb97823d6a..ba1eef0797a0 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -217,6 +217,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


  parent reply	other threads:[~2021-04-19 20:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-19 20:45 [PATCH AUTOSEL 4.14 01/11] HID: alps: fix error return code in alps_input_configured() Sasha Levin
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 02/11] HID: wacom: Assign boolean values to a bool variable Sasha Levin
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 03/11] ARM: dts: Fix swapped mmc order for omap3 Sasha Levin
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 04/11] net: geneve: check skb is large enough for IPv4/IPv6 header Sasha Levin
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 05/11] s390/entry: save the caller of psw_idle Sasha Levin
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 06/11] xen-netback: Check for hotplug-status existence before watching Sasha Levin
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 07/11] cavium/liquidio: Fix duplicate argument Sasha Levin
2021-04-19 20:45 ` Sasha Levin [this message]
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 09/11] ia64: fix discontig.c section mismatches Sasha Levin
2021-04-19 20:45   ` Sasha Levin
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 10/11] ia64: tools: remove duplicate definition of ia64_mf() on ia64 Sasha Levin
2021-04-19 20:45 ` [PATCH AUTOSEL 4.14 11/11] readdir: make sure to verify directory entry for legacy interfaces too Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210419204536.6924-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=gregory.clement@bootlin.com \
    --cc=kabel@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=samuel@sholland.org \
    --cc=stable@vger.kernel.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.