From patchwork Thu Apr 7 07:57:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Hung X-Patchwork-Id: 12804623 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6082AC433EF for ; Thu, 7 Apr 2022 07:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GyAeRGyQ8fawARrhLbS9nlD+i7ndGP4qsA4xgD9wfc4=; b=SW8fnEA857XbMs FyNO5eI4UNriOB4rkme6VbITD8FCVJ3iGd5uBXxZOBigzE3Jvj/O0ebCqeGXXmaflOEbaJNNYOyjI gsJJOPq6qnkV+6zPen8oQ7gvY9rUqB+F03eIDL44WYedOfLqdvYhk7pnhfVlX0KhU9Qu4FWou1GoU LtXbM813CfD3J4PlkfphYLj1t3gtR8BFpTGrMusq9Lwp5X4ZXumCRpU0QBOPua/nKOapZM54gTCwx RGBGDnMXne8o2dDKF+shZTCriv0/WL/lz0+ITiFH+Hipt3Jb6MW8XNEJQBmOHBC2guzwOqgUqodY5 zE7ZSn+kwjQz+bdor16Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncN1R-00AATT-GZ; Thu, 07 Apr 2022 07:57:41 +0000 Received: from [211.20.114.71] (helo=twspam01.aspeedtech.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncN0i-00AAAt-HV for linux-arm-kernel@lists.infradead.org; Thu, 07 Apr 2022 07:57:00 +0000 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 2377id24045433; Thu, 7 Apr 2022 15:44:39 +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; Thu, 7 Apr 2022 15:56:00 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , CC: , Krzysztof Kozlowski Subject: [PATCH RESEND v3 1/3] dt-bindings: net: add reset property for aspeed, ast2600-mdio binding Date: Thu, 7 Apr 2022 15:57:32 +0800 Message-ID: <20220407075734.19644-2-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220407075734.19644-1-dylan_hung@aspeedtech.com> References: <20220407075734.19644-1-dylan_hung@aspeedtech.com> MIME-Version: 1.0 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 2377id24045433 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220407_005657_041498_95023FC1 X-CRM114-Status: UNSURE ( 9.27 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 + resets: + maxItems: 1 + required: - compatible - reg @@ -39,6 +43,7 @@ examples: reg = <0x1e650000 0x8>; #address-cells = <1>; #size-cells = <0>; + resets = <&syscon 35>; ethphy0: ethernet-phy@0 { compatible = "ethernet-phy-ieee802.3-c22"; From patchwork Thu Apr 7 07:57:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Hung X-Patchwork-Id: 12804624 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E308CC433F5 for ; Thu, 7 Apr 2022 07:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B64TOrfvYlI7oczjexB3/7vGzbBVTBUJbnLGemHZ5Ag=; b=GuFB1geXTukIUs ptDuxxRwU5EuwOLH3/UhNDNj9qIvvCuTWQbZYlTakCV+vQCX5mU2j9CyJz0OcXvce6tx5H627akZ7 Yj95zuJ8IbFX9MMEv6v+0iKHOblm8Ix7n1j/DAVurLJPmYbGCGEiDrf6ukCZcXT0TOxoDAWgyBPlW 9j8oJd47delGeHWZQ0/gLuS9UC8rhpVyt2pi8yIwRdE3gCc+9Y+BarRmFwOBcsoXvp0Kyu3/qjoVJ NZMJeoJdBOZZhjn96YnPFZeZquxezJYCO8ZJ/tq4RRKAcKfP36uCJZj3OF/Gtla/q/XpfhECdpTC9 Sx52SwhfCAsjBT3N2vsQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncN26-00AAnC-HA; Thu, 07 Apr 2022 07:58:23 +0000 Received: from [211.20.114.71] (helo=twspam01.aspeedtech.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncN0i-00AAC6-HS for linux-arm-kernel@lists.infradead.org; Thu, 07 Apr 2022 07:57:00 +0000 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 2377ieII045434; Thu, 7 Apr 2022 15:44:40 +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; Thu, 7 Apr 2022 15:56:00 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , CC: Subject: [PATCH RESEND v3 2/3] net: mdio: add reset control for Aspeed MDIO Date: Thu, 7 Apr 2022 15:57:33 +0800 Message-ID: <20220407075734.19644-3-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220407075734.19644-1-dylan_hung@aspeedtech.com> References: <20220407075734.19644-1-dylan_hung@aspeedtech.com> MIME-Version: 1.0 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 2377ieII045434 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220407_005657_023590_E2D651E4 X-CRM114-Status: GOOD ( 13.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 @@ #include #include +#include #include #include #include @@ -37,6 +38,7 @@ struct aspeed_mdio { void __iomem *base; + struct reset_control *reset; }; 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 *pdev) if (IS_ERR(ctx->base)) return PTR_ERR(ctx->base); + ctx->reset = 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 = DRV_NAME; snprintf(bus->id, MII_BUS_ID_SIZE, "%s%d", pdev->name, pdev->id); bus->parent = &pdev->dev; @@ -129,6 +137,7 @@ static int aspeed_mdio_probe(struct platform_device *pdev) rc = 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; } @@ -139,7 +148,11 @@ static int aspeed_mdio_probe(struct platform_device *pdev) static int aspeed_mdio_remove(struct platform_device *pdev) { - mdiobus_unregister(platform_get_drvdata(pdev)); + struct mii_bus *bus = (struct mii_bus *)platform_get_drvdata(pdev); + struct aspeed_mdio *ctx = bus->priv; + + reset_control_assert(ctx->reset); + mdiobus_unregister(bus); return 0; } From patchwork Thu Apr 7 07:57:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Hung X-Patchwork-Id: 12804625 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A2D81C433F5 for ; Thu, 7 Apr 2022 08:00:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EQwFxqiMokyn8ZnedumCUNS8+CEwboSf587/JZXAPWw=; b=jhr2R0uLx0ACOn b6l7sFL5hqOxDCxAxP7K4UmmYRxbOiTzqmjs0kMq32kqby4d27RpuDt/xZfcP2e1BYviIw1UsktFV I0qpc/Qsh8wlznm1oApIWks7n6x08FnMgCflcObZtpphOKqdRQhNpQ6fY499yZ+nUQ2FSnZ0cZ0fE QLT+qk8HzW5fVYmRptBAb4LndzWyck+LnA4ZiIr8YjPuS4devevw5niY96HPfpLyCO7bIgtODYDIn X7Xjbdo846kMY8hndDS8BS6gPEdSY49oibMp+l/N3mIYAb9iWZ1Tc+s9oJBSA4oT2jBNGFim81cF4 1lm4ND1J+WVf7x18M8jw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncN2w-00ABGS-D6; Thu, 07 Apr 2022 07:59:15 +0000 Received: from [211.20.114.71] (helo=twspam01.aspeedtech.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncN0i-00AABx-HU for linux-arm-kernel@lists.infradead.org; Thu, 07 Apr 2022 07:57:00 +0000 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 2377iePu045435; Thu, 7 Apr 2022 15:44:40 +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; Thu, 7 Apr 2022 15:56:01 +0800 From: Dylan Hung To: , , , , , , , , , , , , , , CC: Subject: [PATCH RESEND v3 3/3] ARM: dts: aspeed: add reset properties into MDIO nodes Date: Thu, 7 Apr 2022 15:57:34 +0800 Message-ID: <20220407075734.19644-4-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220407075734.19644-1-dylan_hung@aspeedtech.com> References: <20220407075734.19644-1-dylan_hung@aspeedtech.com> MIME-Version: 1.0 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 2377iePu045435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220407_005657_051580_9BF59906 X-CRM114-Status: UNSURE ( 7.00 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 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 = "disabled"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mdio1_default>; + resets = <&syscon ASPEED_RESET_MII>; }; mdio1: mdio@1e650008 { @@ -191,6 +192,7 @@ mdio1: mdio@1e650008 { status = "disabled"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mdio2_default>; + resets = <&syscon ASPEED_RESET_MII>; }; mdio2: mdio@1e650010 { @@ -201,6 +203,7 @@ mdio2: mdio@1e650010 { status = "disabled"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mdio3_default>; + resets = <&syscon ASPEED_RESET_MII>; }; mdio3: mdio@1e650018 { @@ -211,6 +214,7 @@ mdio3: mdio@1e650018 { status = "disabled"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mdio4_default>; + resets = <&syscon ASPEED_RESET_MII>; }; mac0: ftgmac@1e660000 {