From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=46.4.11.11 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796149928; b=o4dEtIq3DWrPlTK6Xkkr9b7KoTqvU44JOmJ9LtW8i+Kwgn8mc1R+R+O8zHE4CyHZu3cC RFrJRsU4cDJUfjziNzWoQDFSlcFbDvIh0elpH6ODfT8+U5nWAFykIfEeoxTW3KWyuFFiw 8YY1O/xoSIUwmhZh/Z5udLtC8tCTFS96DJBmH2q06+vrglM9EegmuONJthIj/uZis9HwC efDeJGUMiAI5KDAL+eiMXjZqhgzPtMUrMmjY0gfeeYKhQrzE8bIyd0Ux+ObvrnIBXN+33 SvMeqD97NUwQHZHHmsm193v03rV+G0OrrRwhT8gqedzWiMxahEEGEDaeVoBBzoJJfuw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796149928; h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=xyoteeERArK9s6LQG3kdMq5yd91w3NYG6jchKDwCAAE=; b=Pi1PhM4x3c8qMUzRzbVsMo/SkTGXF9t0zB0kZRnk2Yna1ovMEORHQYv1k+imtjU6kmpJ 0fdMGQa3SHEhSDKFOw442ToGrn2rHFI7DJV4ao3M5AhAGJrxqJQ2Az/tWq37uRBNYi66c GX2lNWdM94zcv5HZZZ8jmc+c//C18u2sRCLB3F0cA21jEuB4Wzvg+MLIBwyRWlkaYm//H Wwx/fUhcPhc7wND7g2wBkgzx/xTXcAuGOSeVXAH4aZ0P7FczGtbdyo/AOCCffuX05FibC wxa3VJSWEEfobA442MlV5+4yv2fz0AwFrTrEJ/Qlp6Zann5wf9SiyGA0KJxB64InjDQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=phrozen.org; spf=pass smtp.mailfrom=phrozen.org; arc=none smtp.remote-ip=46.4.11.11 Received: from nbd.name (nbd.name [46.4.11.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C79F606A327; Tue, 1 Dec 2026 18:32:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8C79F606A327 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=phrozen.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=phrozen.org Received: from [2a04:4540:1405:15fc:bd72:1c73:6cc3:2cda] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xYSdr-00Aqwn-2d; Tue, 01 Dec 2026 19:31:51 +0100 From: John Crispin To: Stefan Roese , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Philipp Zabel Cc: Christian Marangi , devicetree@vger.kernel.org, lei.dong@airoha.com, Linqi.zhang@airoha.com, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Rajeev.kumar@airoha.com, upstream@airoha.com, Weifeng.xu@airoha.com, zhengping.zhang@airoha.com Subject: [PATCH v4 1/3] i2c: mt7621: assert and deassert the reset line Date: Tue, 1 Dec 2026 19:31:43 +0100 Message-Id: <20261201183145.2953089-2-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261201183145.2953089-1-john@phrozen.org> References: <20261201183145.2953089-1-john@phrozen.org> X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The driver resets the controller with device_reset(), which needs a .reset operation in the reset controller. The EN7581 reset controller implements assert and deassert only, so there every call fails, logs "I2C reset failed!" and leaves the controller as it is, also after a transfer timeout. Get the optional reset line at probe and assert and deassert it. The MT7621 and MT7628 reset controller does the same in its .reset operation, with no delay in between, so nothing changes there. A board without a reset line no longer logs an error, and a reset controller that is not ready yet defers the probe. Suggested-by: Philipp Zabel Reviewed-by: Philipp Zabel Signed-off-by: John Crispin --- Changes in v4: - None. Changes in v3: - Add the Reviewed-by of Philipp. Changes in v2: - New patch. It replaces "clk: en7523: add a reset operation" from the clk series (Philipp). - Link to the discussion: https://lore.kernel.org/r/0c96f978571c569de6552fc11131e45b55cada1b.camel@pengutronix.de drivers/i2c/busses/i2c-mt7621.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mt7621.c b/drivers/i2c/busses/i2c-mt7621.c index 826abb9252e3..d7d1a17c8b55 100644 --- a/drivers/i2c/busses/i2c-mt7621.c +++ b/drivers/i2c/busses/i2c-mt7621.c @@ -65,6 +65,7 @@ struct mtk_i2c { u32 clk_div; u32 flags; struct clk *clk; + struct reset_control *rst; }; static int mtk_i2c_wait_idle(struct mtk_i2c *i2c) @@ -85,7 +86,9 @@ static void mtk_i2c_reset(struct mtk_i2c *i2c) { int ret; - ret = device_reset(i2c->adap.dev.parent); + ret = reset_control_assert(i2c->rst); + if (!ret) + ret = reset_control_deassert(i2c->rst); if (ret) dev_err(i2c->dev, "I2C reset failed!\n"); @@ -288,6 +291,11 @@ static int mtk_i2c_probe(struct platform_device *pdev) return PTR_ERR(i2c->clk); } + i2c->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + if (IS_ERR(i2c->rst)) + return dev_err_probe(&pdev->dev, PTR_ERR(i2c->rst), + "Failed to get reset\n"); + i2c->dev = &pdev->dev; if (of_property_read_u32(pdev->dev.of_node, "clock-frequency", -- 2.34.1