From nobody Sun May 10 18:32:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C058DC433F5 for ; Wed, 27 Apr 2022 03:55:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245312AbiD0D6a (ORCPT ); Tue, 26 Apr 2022 23:58:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355542AbiD0D6V (ORCPT ); Tue, 26 Apr 2022 23:58:21 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E04D13F7A for ; Tue, 26 Apr 2022 20:55:10 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 23R3gSNV032327; Wed, 27 Apr 2022 11:42:28 +0800 (GMT-8) (envelope-from dylan_hung@aspeedtech.com) Received: from DylanHung-PC.aspeed.com (192.168.2.216) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 27 Apr 2022 11:54:58 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , , CC: , Krzysztof Kozlowski Subject: [PATCH net-next v6 1/3] dt-bindings: net: add reset property for aspeed, ast2600-mdio binding Date: Wed, 27 Apr 2022 11:54:59 +0800 Message-ID: <20220427035501.17500-2-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427035501.17500-1-dylan_hung@aspeedtech.com> References: <20220427035501.17500-1-dylan_hung@aspeedtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.2.216] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 23R3gSNV032327 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The AST2600 MDIO bus controller has a reset control bit and must be deasserted before manipulating the MDIO controller. By default, the hardware asserts the reset so the driver only need to deassert it. Regarding to the old DT blobs which don't have reset property in them, the reset deassertion is usually done by the bootloader so the reset property is optional to work with them. Signed-off-by: Dylan Hung Reviewed-by: Krzysztof Kozlowski Reviewed-by: Andrew Jeffery --- .../devicetree/bindings/net/aspeed,ast2600-mdio.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/net/aspeed,ast2600-mdio.yaml= b/Documentation/devicetree/bindings/net/aspeed,ast2600-mdio.yaml index 1c88820cbcdf..f81eda8cb0a5 100644 --- a/Documentation/devicetree/bindings/net/aspeed,ast2600-mdio.yaml +++ b/Documentation/devicetree/bindings/net/aspeed,ast2600-mdio.yaml @@ -20,10 +20,14 @@ allOf: properties: compatible: const: aspeed,ast2600-mdio + reg: maxItems: 1 description: The register range of the MDIO controller instance =20 + resets: + maxItems: 1 + required: - compatible - reg @@ -34,11 +38,13 @@ unevaluatedProperties: false =20 examples: - | + #include mdio0: mdio@1e650000 { compatible =3D "aspeed,ast2600-mdio"; reg =3D <0x1e650000 0x8>; #address-cells =3D <1>; #size-cells =3D <0>; + resets =3D <&syscon ASPEED_RESET_MII>; =20 ethphy0: ethernet-phy@0 { compatible =3D "ethernet-phy-ieee802.3-c22"; --=20 2.25.1 From nobody Sun May 10 18:32:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBEFFC433F5 for ; Wed, 27 Apr 2022 03:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357606AbiD0D6e (ORCPT ); Tue, 26 Apr 2022 23:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357597AbiD0D60 (ORCPT ); Tue, 26 Apr 2022 23:58:26 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C6869CE1 for ; Tue, 26 Apr 2022 20:55:15 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 23R3gTLg032328; Wed, 27 Apr 2022 11:42:29 +0800 (GMT-8) (envelope-from dylan_hung@aspeedtech.com) Received: from DylanHung-PC.aspeed.com (192.168.2.216) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 27 Apr 2022 11:54:59 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v6 2/3] net: mdio: add reset control for Aspeed MDIO Date: Wed, 27 Apr 2022 11:55:00 +0800 Message-ID: <20220427035501.17500-3-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427035501.17500-1-dylan_hung@aspeedtech.com> References: <20220427035501.17500-1-dylan_hung@aspeedtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.2.216] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 23R3gTLg032328 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add reset assertion/deassertion for Aspeed MDIO. There are 4 MDIO controllers embedded in Aspeed AST2600 SOC and share one reset control register SCU50[3]. To work with old DT blobs which don't have the reset property, devm_reset_control_get_optional_shared is used in this change. Signed-off-by: Dylan Hung Reviewed-by: Philipp Zabel Reviewed-by: Andrew Lunn Reviewed-by: Andrew Jeffery --- drivers/net/mdio/mdio-aspeed.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c index 7aa49827196f..944d005d2bd1 100644 --- a/drivers/net/mdio/mdio-aspeed.c +++ b/drivers/net/mdio/mdio-aspeed.c @@ -3,6 +3,7 @@ =20 #include #include +#include #include #include #include @@ -41,6 +42,7 @@ =20 struct aspeed_mdio { void __iomem *base; + struct reset_control *reset; }; =20 static int aspeed_mdio_op(struct mii_bus *bus, u8 st, u8 op, u8 phyad, u8 = regad, @@ -174,6 +176,12 @@ static int aspeed_mdio_probe(struct platform_device *p= dev) if (IS_ERR(ctx->base)) return PTR_ERR(ctx->base); =20 + ctx->reset =3D devm_reset_control_get_optional_shared(&pdev->dev, NULL); + if (IS_ERR(ctx->reset)) + return PTR_ERR(ctx->reset); + + reset_control_deassert(ctx->reset); + bus->name =3D DRV_NAME; snprintf(bus->id, MII_BUS_ID_SIZE, "%s%d", pdev->name, pdev->id); bus->parent =3D &pdev->dev; @@ -184,6 +192,7 @@ static int aspeed_mdio_probe(struct platform_device *pd= ev) rc =3D of_mdiobus_register(bus, pdev->dev.of_node); if (rc) { dev_err(&pdev->dev, "Cannot register MDIO bus!\n"); + reset_control_assert(ctx->reset); return rc; } =20 @@ -194,7 +203,11 @@ static int aspeed_mdio_probe(struct platform_device *p= dev) =20 static int aspeed_mdio_remove(struct platform_device *pdev) { - mdiobus_unregister(platform_get_drvdata(pdev)); + struct mii_bus *bus =3D (struct mii_bus *)platform_get_drvdata(pdev); + struct aspeed_mdio *ctx =3D bus->priv; + + reset_control_assert(ctx->reset); + mdiobus_unregister(bus); =20 return 0; } --=20 2.25.1 From nobody Sun May 10 18:32:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1F0C433EF for ; Wed, 27 Apr 2022 03:55:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357613AbiD0D6j (ORCPT ); Tue, 26 Apr 2022 23:58:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357604AbiD0D6b (ORCPT ); Tue, 26 Apr 2022 23:58:31 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D66826C971 for ; Tue, 26 Apr 2022 20:55:20 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 23R3gTnM032329; Wed, 27 Apr 2022 11:42:29 +0800 (GMT-8) (envelope-from dylan_hung@aspeedtech.com) Received: from DylanHung-PC.aspeed.com (192.168.2.216) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 27 Apr 2022 11:54:59 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v6 3/3] ARM: dts: aspeed: add reset properties into MDIO nodes Date: Wed, 27 Apr 2022 11:55:01 +0800 Message-ID: <20220427035501.17500-4-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220427035501.17500-1-dylan_hung@aspeedtech.com> References: <20220427035501.17500-1-dylan_hung@aspeedtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.168.2.216] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 23R3gTnM032329 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add reset control properties into MDIO nodes. The 4 MDIO controllers in AST2600 SOC share one reset control bit SCU50[3]. Signed-off-by: Dylan Hung Reviewed-by: Andrew Jeffery --- arch/arm/boot/dts/aspeed-g6.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6= .dtsi index 3d5ce9da42c3..6aa1fd5c9359 100644 --- a/arch/arm/boot/dts/aspeed-g6.dtsi +++ b/arch/arm/boot/dts/aspeed-g6.dtsi @@ -181,6 +181,7 @@ mdio0: mdio@1e650000 { status =3D "disabled"; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_mdio1_default>; + resets =3D <&syscon ASPEED_RESET_MII>; }; =20 mdio1: mdio@1e650008 { @@ -191,6 +192,7 @@ mdio1: mdio@1e650008 { status =3D "disabled"; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_mdio2_default>; + resets =3D <&syscon ASPEED_RESET_MII>; }; =20 mdio2: mdio@1e650010 { @@ -201,6 +203,7 @@ mdio2: mdio@1e650010 { status =3D "disabled"; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_mdio3_default>; + resets =3D <&syscon ASPEED_RESET_MII>; }; =20 mdio3: mdio@1e650018 { @@ -211,6 +214,7 @@ mdio3: mdio@1e650018 { status =3D "disabled"; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_mdio4_default>; + resets =3D <&syscon ASPEED_RESET_MII>; }; =20 mac0: ftgmac@1e660000 { --=20 2.25.1