From nobody Sun Feb 8 10:33:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AAEE5CDC9; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708683023; cv=none; b=NPQrqAEimxl97ndlqhUiG15yy5B5PBj3NqSpFyk8t7fv0PJODuay05gfJ6C/0LhXWkn9kubKYzr6N9qcQvWQE0pYirK0tL1Exp4dA/uiD7MJ9C2RKGdY6keE+bd/YU/b5+41nWFxCUajzJGu3kCPYnpIk6GXfUNlbf5DfuhpDj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708683023; c=relaxed/simple; bh=VDASn16XHrLArVByFssljGzmfnx3iO+5GYIVlAb71rE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=To8+9GnpwjLoAxNcaimVXQ3b+92HpVR+IQNxE3IIVbvbZjhlHlnFGZSHMgmVsFjZjtfnW7QgQYuGKAcBE0BiYL/u3ZCCWVDis6nT888j6IVYUe+teLX8Iq34qGG//5AWTthICO5XDlMdgHKp8sRweA0wpbI1a2MzyfkdmMnTnTQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uEz3FMCV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uEz3FMCV" Received: by smtp.kernel.org (Postfix) with ESMTPS id A40F2C433C7; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708683022; bh=VDASn16XHrLArVByFssljGzmfnx3iO+5GYIVlAb71rE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uEz3FMCVFHZ2f0Y/uJSxdXiserLR63OK+2LAqLrXBxnYwYPZyD+obRcT6jZWeOi6a gbaBj5V6BhxjQWw/zvUFray6c5w1PvpG6K8BFfhq05Bgtehp5bO+AkFSsl1Ld6SJU7 G1NsBbhRy6EjH/4qOmwUGxHk7VCCmjEsyHbdI3kh2Mxg5dIWteNapd8tC8QkmvksiQ Yi3CNGAR1WkKZiNtPKgLrgqsT/6yUbZecHUtc1v8YPP8ryZREgv/drIP5hD1Uzz+t4 tZGlG+Z2Amo/kGDKNlr9cn53GazkseGgDF5MgDxHfwjUamTWiHbMc4n3yMGlgs7+8O iGjzAIwf26XXw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88EB6C54E4A; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Fri, 23 Feb 2024 18:10:19 +0800 Subject: [PATCH v2 1/2] dt-bindings: simple-pm-bus: Add optional resets Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240223-b4-bus-v2-1-da8ba83c1a5f@outlook.com> References: <20240223-b4-bus-v2-0-da8ba83c1a5f@outlook.com> In-Reply-To: <20240223-b4-bus-v2-0-da8ba83c1a5f@outlook.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708683020; l=1517; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=ycKXPbq/zZox0Tf/d90/44XzLN+X/N07MSaWt6t/K2E=; b=agOw8170TwGFqV8jVC0eJJD007zcKmXbtsVJ7/McHN+JkYskRh7W/CLBCbTwN9IkhIkfE3ixC RQGbOxnuHdhAzTsd3e/4fXB+HmhrsluteP4CT/LZ/dUTfl8av+2qs2R X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: From: Yang Xiwen For some on-soc buses, it is also needed to deassert the resets before access. Document it in the binding. Reviewed-by: Geert Uytterhoeven Signed-off-by: Yang Xiwen --- Documentation/devicetree/bindings/bus/simple-pm-bus.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml b/Doc= umentation/devicetree/bindings/bus/simple-pm-bus.yaml index 182134d7a6a3..430638104980 100644 --- a/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml +++ b/Documentation/devicetree/bindings/bus/simple-pm-bus.yaml @@ -14,8 +14,9 @@ description: | driver, as it's typically initialized by the boot loader. =20 However, its bus controller is part of a PM domain, or under the control - of a functional clock. Hence, the bus controller's PM domain and/or - clock must be enabled for child devices connected to the bus (either + of a functional clock, and it might have a reset control signal. Hence, + the bus controller's PM domain and/or clock must be enabled, reset contr= ol + signal must be deasserted for child devices connected to the bus (either on-SoC or externally) to function. =20 While "simple-pm-bus" follows the "simple-bus" set of properties, as @@ -49,6 +50,8 @@ properties: # Required if clocks is absent, optional otherwise minItems: 1 =20 + resets: true + required: - compatible - '#address-cells' --=20 2.43.0 From nobody Sun Feb 8 10:33:17 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 303FA5CDCA; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708683023; cv=none; b=mBaxSjv0tEyewQnqTluikvrC26ctbT/JFPMHyiySsVPJPRsPR2x7urJWB2iKPGrhLv+MRQR0+S12EQVWfCwtB55C7BflfjhpEFGt/ItVM69iXNzsYvI58XUvs3HC9tH4ahr/F8cKuxUp7ISJ1ml8eBEk8/sEDWAAx5Q/qq0J54s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708683023; c=relaxed/simple; bh=3U04gKlXchbJ+V24kjC1E8jAr7x4b4Y+oBUhHQOFzN8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rvfFjkctzNdGFZdnf91wH6kZMhq96bOCIp3uKDg2ehYWaKwIhCRc/IMIanWY1syYmPI/grJFnVOaiKffHpqbHAblqbOKzFj8GL7qSGFA6l+XsaZx5X/Msjz2UHu/BEMRoKmEEZCOKEVM+2B7L1UdeshmtisatsD4MSZAcZKEJa4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TjvB0QSU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TjvB0QSU" Received: by smtp.kernel.org (Postfix) with ESMTPS id C09F2C43394; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708683022; bh=3U04gKlXchbJ+V24kjC1E8jAr7x4b4Y+oBUhHQOFzN8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=TjvB0QSUvgv3PAcFdrwn2kV1C+sRbekO9orDxO/UtNg7IS0KzkVpTGPUsLWNvnxs/ CJDWj9WiATpH+kx80xaX4LNPwSj2aMyKV2O+iV6DQLzWZxW9UTQ2E4/GIRptnv58xP pb7/fn7KxkjQIjvOCSSkZWW7m/BO6OzEh33fNP/UD927b5R2Q3ioMM243pvAZT84Id GWN4eIjpUxbI8qonSW8503WE7fneIXyRRuKqknjU+0GcLkYudP0BqgbOD62M1vDz/s Sh4XpbZadxwKIHL93olNJNXuuVJDneG7db/HAFIcKVcZvIRGDEFzsSXW0/g7gUavTY +MlMfz9ppnVjQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8092C5478C; Fri, 23 Feb 2024 10:10:22 +0000 (UTC) From: Yang Xiwen via B4 Relay Date: Fri, 23 Feb 2024 18:10:20 +0800 Subject: [PATCH v2 2/2] drivers: bus: simple-pm-bus: Get and deassert resets exclusively Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240223-b4-bus-v2-2-da8ba83c1a5f@outlook.com> References: <20240223-b4-bus-v2-0-da8ba83c1a5f@outlook.com> In-Reply-To: <20240223-b4-bus-v2-0-da8ba83c1a5f@outlook.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Philipp Zabel Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yang Xiwen X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708683020; l=2336; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=IavnxoIeWBK3APBnyHNZI/y56/+6lr1F3uzJe1D+hR0=; b=MP/vK9i/hsQIRpsFr8imCB448rwViVkMEJMYN2xWPt0Iguka38Nnv3GNOFlLDLlttOq20rWiG hBYhuRFxbd1BPzl4xoRlQ8X0jYQE6ZXq9r0vXmfusoz4ngVIahx9XGT X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen Reply-To: From: Yang Xiwen Simple Power-Managed bus controller may need functional reset(s) to be deasserted before child devices connected to the bus can be accessed. Get the reset(s) as an array and assert/deassert the reset(s) when the bus is being power managed. One example is that HiSilicon USB2 INNO PHY test bus needs to deassert the reset to the bus before accessing its registers. Reviewed-by: Geert Uytterhoeven Signed-off-by: Yang Xiwen --- drivers/bus/simple-pm-bus.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c index 50870c827889..f2e98eac0bb4 100644 --- a/drivers/bus/simple-pm-bus.c +++ b/drivers/bus/simple-pm-bus.c @@ -16,15 +16,17 @@ #include #include #include +#include =20 struct simple_pm_bus { struct clk_bulk_data *clks; + struct reset_control *rsts; int num_clks; }; =20 static int simple_pm_bus_probe(struct platform_device *pdev) { - const struct device *dev =3D &pdev->dev; + struct device *dev =3D &pdev->dev; const struct of_dev_auxdata *lookup =3D dev_get_platdata(dev); struct device_node *np =3D dev->of_node; const struct of_device_id *match; @@ -62,6 +64,10 @@ static int simple_pm_bus_probe(struct platform_device *p= dev) if (bus->num_clks < 0) return dev_err_probe(&pdev->dev, bus->num_clks, "failed to get clocks\n"= ); =20 + bus->rsts =3D devm_reset_control_array_get_optional_exclusive(dev); + if (IS_ERR(bus->rsts)) + return dev_err_probe(&pdev->dev, PTR_ERR(bus->rsts), "failed to get rese= ts\n"); + dev_set_drvdata(&pdev->dev, bus); =20 dev_dbg(&pdev->dev, "%s\n", __func__); @@ -92,7 +98,7 @@ static int simple_pm_bus_runtime_suspend(struct device *d= ev) =20 clk_bulk_disable_unprepare(bus->num_clks, bus->clks); =20 - return 0; + return reset_control_assert(bus->rsts); } =20 static int simple_pm_bus_runtime_resume(struct device *dev) @@ -106,6 +112,12 @@ static int simple_pm_bus_runtime_resume(struct device = *dev) return ret; } =20 + ret =3D reset_control_deassert(bus->rsts); + if (ret) { + dev_err(dev, "failed to deassert resets: %d\n", ret); + return ret; + } + return 0; } =20 --=20 2.43.0