Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2829465pxb; Mon, 19 Apr 2021 15:21:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMHCW/FO4mP9TGp76zmIKrwmZJ0QxOORhkvjLaseV47mtXzHiswstvzjxkqlemf0ztzyJw X-Received: by 2002:a17:90a:b001:: with SMTP id x1mr1496769pjq.122.1618870892247; Mon, 19 Apr 2021 15:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618870892; cv=none; d=google.com; s=arc-20160816; b=cxeQJCk5T0FY1hGrwPUP8QbVwpEHoyW/eTenXbpujwexfMrU5/bYqyMnbH1FieRi/A VHg2a8Ois5z1b56Dz2MTJ9Iq4kk98mQ1BSuboFzjZDXdcxDorOKXPOcj6VlHcPPwAWD7 xFC03TCc1FFNDR7VxJkot1wIwk6f5UXgbJgSPzyEU7gukZ2nM9RWAm5zvdLBA4VMCmGQ VtLPUiVHMpl96LS+BSk33o8hI21qGuK0aB1e5W3WbOo53LLrN2aN0FYqziSoKNt/VSJl 13N5vG85p07FthJmK24xZPL+fLsrF3Q9aEprV+BsxNC3G/w/CIa/8ZXD2YP8wrLuSvGT iPmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fe3vgarIFzl/evczBccPBTmOvnsbGPPjSkmJwti+//c=; b=X4QAGg2lD/RAOqg/7LUWXNb6pcKXju80mLTrcdgbOylNnJgfcTzte0gr38t7pGDu6f YIFYWEs4fxOabG0f3LnM1bHL0zktUxGAZpoiAqTKlzzFIMECTkf3ulEkDXQx7gG0X4Sy xQ5ThYnDtlRq1A+w3C4/LKLnIdQVAF7JW7dAZUjOthR9v2cz4NsBRl6Q5+aDYrOh3Nya LHG8skI2LQuPdWDY09rIVZG+wdZjuwsVuZbdDUvGy/SdzZpi3QVDxVHSkT0cXUva3yP+ ZImyxhgRnXQOzJ3bIxBCM1eifyMTM0mPClhNHa+vmXBl2HifaGyy0CvQuEeUToHSNKxi alEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pA/Zas2L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w3si17347039pgk.397.2021.04.19.15.21.20; Mon, 19 Apr 2021 15:21:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pA/Zas2L"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242600AbhDSUpZ (ORCPT + 99 others); Mon, 19 Apr 2021 16:45:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:54296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242428AbhDSUoj (ORCPT ); Mon, 19 Apr 2021 16:44:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D24FF613C6; Mon, 19 Apr 2021 20:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1618865048; bh=D/0VPNZQe0Wm9G3YYl/k56JPejxtAWIdGzAxgNJGWnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pA/Zas2L+UAJQ89lAB6n9vQ4803o/299sv4KyEbgtBli44K8LDBnIilfAKJqe2OcJ vtYL2oq1Uj7q3j464a9jTOaSjV0iDFrfpZQkf0F+7lm/4neMOEAIg7r52YOtTeRYR1 aMgXhZhRP7pwlx1kVN4LUgk3p+1iOVUvw55WAvy28tdXHbpmmTCwEihWTz84bfR5T1 KLcmmVCPLnG8bWSAWOAf2eeN0/FYf9vBjBXi4wtySxxMpVlJ3OwQuEwaWluhxUTBHh x57tQlvcG9JZ15X1s0RQg1nREse6VGPIj2Wn3dnqKD7zc6x+4Ktidiq0dEaw8Y6TpG 3xcSRrOrx//rw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Marek=20Beh=C3=BAn?= , Gregory CLEMENT , Samuel Holland , Wolfram Sang , Sasha Levin , linux-i2c@vger.kernel.org Subject: [PATCH AUTOSEL 5.11 17/23] i2c: mv64xxx: Fix random system lock caused by runtime PM Date: Mon, 19 Apr 2021 16:43:36 -0400 Message-Id: <20210419204343.6134-17-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210419204343.6134-1-sashal@kernel.org> References: <20210419204343.6134-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marek BehĂșn [ 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 Acked-by: Gregory CLEMENT Reviewed-by: Samuel Holland Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- 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