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=1796234686; b=JxF4xvt++zpWxN6nun736LatDwvCYH5A2QCwQaKsr8JWMSobgD3mqt6ZclDwuQus7+8/ UHdoV3Vxdhd4vDqlEmLL2VpN6BAow8ficOE6PEpNrI/YI+VR+U8cwsP1T0ufPT7EAZRLz PmBn5i/c64UFyZeKlzee0pUIEAu5ZS3zZuICJES0Nv9WvPrlKCctao2uP+BrPaFECsjKW NwsT8IEKtPp18QwQzziy9E/pNDdc1eUcYvZGA8h92hnUarS7juPGO1J1a1oblXucQlMEK sjgGjln1Ql8aSY/MYnAo2ke8LZVUyZe1mndt8Z+VMDpvcakY2l2R05F3HTa6x5iRq2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796234686; h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=dCPa3YfdVVLtvzsX6oz9BIeiMLxadopdWfj0843vqn8=; b=JoFtU+3f4ViwvK5Z/LXqANrULDXfR1gEVrSPGmUaxuNsrqDXtA5OGUOOXPV1JYU38IbK xTcDEEy8a/ShzchCJanomS6GeHKjBusfd4iCCceuYvTSJxSEnfuLmV3e5vGozxWi6oH4x daZLMT2NfjsVpq5McL9NJEcn5d3i68cC9Y6gLSa3Ap0U5jibLua4K92bVcYm2Mf3KY3sY qW51b3POPF4rSTR78sMce2NKKUE2b2wmt7Dm42kTSovWO70zzdKpNxM7fR7IyZ1ZJYIbu yAo+1jE+ZP503HpMogd+XQJdd1Z1XoRBY7Gd2VRzHKKytGVbSmpg+j1eCbPfBIO6uOA== 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 2098C606A332; Wed, 2 Dec 2026 18:04:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2098C606A332 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:1404:c8fc:172c:e560:a116:623] (helo=bertha10..) by ds12 with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1xYoh1-00BMWx-0O; Wed, 02 Dec 2026 19:04:35 +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 v5 1/3] i2c: mt7621: assert and deassert the reset line Date: Wed, 2 Dec 2026 19:04:28 +0100 Message-Id: <20261202180430.3572052-2-john@phrozen.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261202180430.3572052-1-john@phrozen.org> References: <20261202180430.3572052-1-john@phrozen.org> X-Mailing-List: linux-i2c@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 v5: - Rebased on next-20261201, no change. 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 e4fd2709fcbe..67b053d3f57e 100644 --- a/drivers/i2c/busses/i2c-mt7621.c +++ b/drivers/i2c/busses/i2c-mt7621.c @@ -70,6 +70,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) @@ -91,7 +92,9 @@ static void mtk_i2c_reset(struct mtk_i2c *i2c) u32 reg; 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"); @@ -306,6 +309,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; i2c->data = device_get_match_data(&pdev->dev); -- 2.34.1