Linux-i2c Archive on
 help / color / Atom feed
From: "Marek Behún" <>
To:, Wolfram Sang <>,
	Gregory CLEMENT <>
Cc: "Samuel Holland" <>,
	"Ondrej Jirman" <>,
	"Marek Behún" <>
Subject: [PATCH] i2c: mv64xxx: Fix random system lock caused by runtime PM
Date: Thu,  8 Apr 2021 04:00:00 +0200
Message-ID: <> (raw)

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 <>
 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 c590d36b5fd1..5c8e94b6cdb5 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -221,6 +221,10 @@ mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
 	writel(0, drv_data->reg_base + drv_data->reg_offsets.ext_addr);
 		drv_data->reg_base + drv_data->reg_offsets.control);
+	if (drv_data->errata_delay)
+		udelay(5);
 	drv_data->state = MV64XXX_I2C_STATE_IDLE;

             reply index

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08  2:00 Marek Behún [this message]
2021-04-10 16:47 ` Marek Behún
2021-04-13 19:58 ` Wolfram Sang
2021-04-14 13:28   ` Gregory CLEMENT
2021-04-14 14:29     ` Marek Behún
2021-04-14 13:42   ` Samuel Holland
2021-04-15 20:13 ` Wolfram Sang

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:

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

  git send-email \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-i2c Archive on

Archives are clonable:
	git clone --mirror linux-i2c/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-i2c linux-i2c/ \
	public-inbox-index linux-i2c

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone