From nobody Sat Jun 20 00:52:26 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 5F1D3C433F5 for ; Fri, 25 Mar 2022 04:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358237AbiCYETM (ORCPT ); Fri, 25 Mar 2022 00:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348284AbiCYEST (ORCPT ); Fri, 25 Mar 2022 00:18:19 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0C36C6256; Thu, 24 Mar 2022 21:16:45 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 22P43YWj035810; Fri, 25 Mar 2022 12:03:35 +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; Fri, 25 Mar 2022 12:14:11 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , CC: Subject: [PATCH v3 1/3] dt-bindings: net: add reset property for aspeed, ast2600-mdio binding Date: Fri, 25 Mar 2022 12:14:49 +0800 Message-ID: <20220325041451.894-2-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220325041451.894-1-dylan_hung@aspeedtech.com> References: <20220325041451.894-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 22P43YWj035810 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 --- .../devicetree/bindings/net/aspeed,ast2600-mdio.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/net/aspeed,ast2600-mdio.yaml= b/Documentation/devicetree/bindings/net/aspeed,ast2600-mdio.yaml index 1c88820cbcdf..7f43b4fe86a3 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 @@ -39,6 +43,7 @@ examples: reg =3D <0x1e650000 0x8>; #address-cells =3D <1>; #size-cells =3D <0>; + resets =3D <&syscon 35>; =20 ethphy0: ethernet-phy@0 { compatible =3D "ethernet-phy-ieee802.3-c22"; --=20 2.25.1 From nobody Sat Jun 20 00:52:26 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 5D07EC433EF for ; Fri, 25 Mar 2022 04:17:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358193AbiCYESj (ORCPT ); Fri, 25 Mar 2022 00:18:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356447AbiCYESS (ORCPT ); Fri, 25 Mar 2022 00:18:18 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C44FC6272; Thu, 24 Mar 2022 21:16:44 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 22P43ZwR035811; Fri, 25 Mar 2022 12:03:35 +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; Fri, 25 Mar 2022 12:14:12 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , CC: Subject: [PATCH v3 2/3] net: mdio: add reset control for Aspeed MDIO Date: Fri, 25 Mar 2022 12:14:50 +0800 Message-ID: <20220325041451.894-3-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220325041451.894-1-dylan_hung@aspeedtech.com> References: <20220325041451.894-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 22P43ZwR035811 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 --- 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 e2273588c75b..1afb58ccc524 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 @@ -37,6 +38,7 @@ =20 struct aspeed_mdio { void __iomem *base; + struct reset_control *reset; }; =20 static int aspeed_mdio_read(struct mii_bus *bus, int addr, int regnum) @@ -120,6 +122,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; @@ -129,6 +137,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 @@ -139,7 +148,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 Sat Jun 20 00:52:26 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 F22D7C433F5 for ; Fri, 25 Mar 2022 04:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241100AbiCYESd (ORCPT ); Fri, 25 Mar 2022 00:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355876AbiCYESS (ORCPT ); Fri, 25 Mar 2022 00:18:18 -0400 Received: from twspam01.aspeedtech.com (twspam01.aspeedtech.com [211.20.114.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 910FDC626E; Thu, 24 Mar 2022 21:16:44 -0700 (PDT) Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 22P43Zb8035813; Fri, 25 Mar 2022 12:03:35 +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; Fri, 25 Mar 2022 12:14:12 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , CC: Subject: [PATCH v3 3/3] ARM: dts: aspeed: add reset properties into MDIO nodes Date: Fri, 25 Mar 2022 12:14:51 +0800 Message-ID: <20220325041451.894-4-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220325041451.894-1-dylan_hung@aspeedtech.com> References: <20220325041451.894-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 22P43Zb8035813 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 --- 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 c32e87fad4dc..ab20ea8d829d 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