From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F19B606A31A for ; Tue, 1 Dec 2026 18:32:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=ccEqD81d DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=xyoteeERArK9s6LQG3kdMq5yd91w3NYG6jchKDwCAAE=; b=ccEqD81dzXgbdE /EWcB2t+n6dBBdRA/K2LLIx8pBCGZrJAPEAOxJ2ajx9rFFEcmToXYDQiopEEJylvEWMe81Ca4cyZ+ p8hBWNG2cpaQb4L0Je+F7CoUR6WuU0Pc+MNDE8U+UxfEbF0bgntJQF8mT+ksA1gjZwBxEBrjuuFwv YbZ80JC0sNnhHMYVd8e7zZ/dSSgKtgztAbw27aJdVxvhxC01tU764JGNOCnlt6tZCzf7ypcDuPerA XmP6UJypF4T7s1TxKtBGKO9dWFyc5/G7f+IKObuovLPYSY6M0KWAAJDdpFVibXgvvIKJBKFTd/6y0 /7aCRb4pW8G+g1lgO4Wg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYSeE-000000094sr-3I9x; Tue, 01 Dec 2026 18:32:14 +0000 Received: from nbd.name ([46.4.11.11]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYSe9-000000094mF-41Kv; Tue, 01 Dec 2026 18:32:11 +0000 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-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_103209_997847_36C1F2A1 X-CRM114-Status: GOOD ( 13.92 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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