From patchwork Tue Aug 20 14:53:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11103959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 68E0C912 for ; Tue, 20 Aug 2019 14:54:24 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 472A6214DA for ; Tue, 20 Aug 2019 14:54:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="VyGECk/d"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="qluk3iBQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 472A6214DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0j5+NvGdR4nTDvCsqt2hued5J2qxnWiA7+LFw/avQmA=; b=VyGECk/dHKu6Oq 1KPQcvN98Znsvm1BCtri3mh5lQ4X3lTReEo1FMcA8G8DuHnQYYVIe7Jz7gCkPJet1dpTg4IsTB/ua LswTA+cu6PRwWxpjvSQTbEzCm/Fwsd6iRIzHNpKjhKnFtW4I9+m35019wzboym6LcsLBF/xA2lOze NUPFivNo7VNYlKUtLGCpyK8FdV0Q51A8TEAG4pU36aPylFAIhuyUeL/LioT+GCUJPf6/XC6f5sJX7 NMzK19SfsDwqec2XuPtklCZEZysCXCLiozgA0ZneuSXc+Ed7TPIZumlelVQjwevNItD79RA/VOm3k YedYQFIewLgD9yrW954w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i05Wh-0001Xv-GH; Tue, 20 Aug 2019 14:54:23 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i05W7-00013Q-Bb for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2019 14:53:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1566312825; bh=pjJHOWO7nxttAsWYJkOKvdkuaULnN0PZZ0RAx5PpN9o=; h=From:To:Cc:Subject:Date:References:From; b=qluk3iBQwrjiEBjSIXnZAafxX6k9lhkgFCeddtDvIAl7JMO+Qt0ZDOCav+zNhQtUW 4i/wOMDdMxpBqkyqrB67GP86/7lpBKTY0FbsdQVpLRS/nayXCeyRz+0IjEubxfNo2q JljrlnPu7zifGmGGs1Y4aDWbZA/PkOP+uwRrjCRI= From: megous@megous.com To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin Subject: [PATCH 1/6] dt-bindings: net: sun8i-a83t-emac: Add phy-supply property Date: Tue, 20 Aug 2019 16:53:38 +0200 Message-Id: <20190820145343.29108-2-megous@megous.com> In-Reply-To: <20190820145343.29108-1-megous@megous.com> References: <20190820145343.29108-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190820_075347_738030_BC72B072 X-CRM114-Status: UNSURE ( 7.14 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Ondrej Jirman This is already supported by the driver, but is missing from the bindings. Signed-off-by: Ondrej Jirman Reviewed-by: Rob Herring --- .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml index 3fb0714e761e..304f244e9ab5 100644 --- a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml +++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml @@ -43,6 +43,10 @@ properties: Phandle to the device containing the EMAC or GMAC clock register + phy-supply: + description: + PHY regulator + required: - compatible - reg From patchwork Tue Aug 20 14:53:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11103955 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 83931912 for ; Tue, 20 Aug 2019 14:54:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 61EC922DA9 for ; Tue, 20 Aug 2019 14:54:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="sfzFHbYX"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="JQloAJ9J" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 61EC922DA9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qlRnvUCyU/OCmc3ceM7sIi2iGjeDRtVysncAZtquJL0=; b=sfzFHbYXDPLpHP OAQO0HI83hNR5ZRe8U4s25s7jkv9elIB/LmA9DMUf4DqO6bFqni/bWgHROqHE5euFq9IhXoKvJOp8 bWAhpe/bS9ZnGRUviUlX2zCXCvdjAkNygAo7uyjE80xdN5A5ZceN6UTR+sl2MCDCDv2cZgye7eUmL 22jD/BiAo35hpxafOoQ0pJulog87r4Peq4r5SWyssaehXoX/nQ4K+ulurvYfe6dhrNtNcRqCRAXUW LOB7Kux6tfG7nJcwhJ1WTZxadowZoKSI81g5bW29+UG05UfEHINs4brbh/suwOovgtFmEW2c4YNjn c6GGm4QZr3sK4qIdfC0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i05WM-0001HE-OR; Tue, 20 Aug 2019 14:54:02 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i05W7-00013R-Bc for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2019 14:53:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1566312825; bh=wIAxljKfYwADgH+42GDkJIwLygOIg7HG/xvcRvcY98U=; h=From:To:Cc:Subject:Date:References:From; b=JQloAJ9JgxomMDFTbsLxbkyZJgYGUbjBaehlsq8CDjjsR5kp8P2V0WYdgIg7+puj6 AFMc4kQ/MwZPB+37mMTvujOxThMU3fqh605btYUrm9Kj8JtaQRpcl2rhfqL4tJ35CM I13XbUfgxDkjIsR5LBRq5X2HaxW5C+MsAGAiCREI= From: megous@megous.com To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin Subject: [PATCH 2/6] dt-bindings: net: sun8i-a83t-emac: Add phy-io-supply property Date: Tue, 20 Aug 2019 16:53:39 +0200 Message-Id: <20190820145343.29108-3-megous@megous.com> In-Reply-To: <20190820145343.29108-1-megous@megous.com> References: <20190820145343.29108-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190820_075347_738030_8E84F7B8 X-CRM114-Status: UNSURE ( 6.63 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Ondrej Jirman Some PHYs require separate power supply for I/O pins in some modes of operation. Add phy-io-supply property, to allow enabling this power supply. Signed-off-by: Ondrej Jirman --- .../devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml index 304f244e9ab5..782e202aa124 100644 --- a/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml +++ b/Documentation/devicetree/bindings/net/allwinner,sun8i-a83t-emac.yaml @@ -47,6 +47,10 @@ properties: description: PHY regulator + phy-io-supply: + description: + PHY I/O pins regulator + required: - compatible - reg From patchwork Tue Aug 20 14:53:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11103963 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 395AE174A for ; Tue, 20 Aug 2019 14:54:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1761D22DA9 for ; Tue, 20 Aug 2019 14:54:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="A+XRMuUb"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="YlHw2Dih" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1761D22DA9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gymjF+Gu94UNYw5ReTDDTxP4rn6mIMlW834W16ayt9Q=; b=A+XRMuUbr7+s2+ 0RnWhdZ0Ar9ewQdBcDppB3IYHKa3OdBoKAubftZW4akZbBHjGCRKWdWEA4Vqh952b0Tu5zMzN7iEI Ksog6/vV7NfmKZYg7EuAQijsb0FeX0EB2yXOH6zGFrD2/ijYSjJAWPY2M6JXyB84469wJL3Y9KPoD /OF1WvvBpmORTE6/krj1sJRCGt0XNNq98DcQYos+a1Vzwqtwm6+BPGYqGpsobZ7UlgM5q330EprLp gazQBNLzNPyhdqoapHMkjO5UuzpFdU9B6RUuOFENP0iJ2WkltF6PCDqrrupD7x1ozL5SNpbUkqaV3 o2h3zeypLObZ2E5dfWDA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i05XD-00020K-HS; Tue, 20 Aug 2019 14:54:55 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i05W7-00013S-J6 for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2019 14:53:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1566312826; bh=BmUD9BF7ZWHwfIwmCa4uNboL8E51kehruNiRWEgChOs=; h=From:To:Cc:Subject:Date:References:From; b=YlHw2Dihm2NXzNp1zXkFKZN/lDdmrVAGr6ZDu+rY6O6dYeqmdgN0A83O/0NDFzmTa MwI3Lq5KMIkfmJzFuQPpfM1Q/zoE9oTxK8lsvn+/6iD+bOjPtAe8y5kVFdMvOwXQqw +2gulGYP98IVdqI8xiM7wtztu84yRSq4lyKyiv4s= From: megous@megous.com To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin Subject: [PATCH 3/6] net: stmmac: sun8i: Use devm_regulator_get for PHY regulator Date: Tue, 20 Aug 2019 16:53:40 +0200 Message-Id: <20190820145343.29108-4-megous@megous.com> In-Reply-To: <20190820145343.29108-1-megous@megous.com> References: <20190820145343.29108-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190820_075347_798340_57B5BC1A X-CRM114-Status: GOOD ( 13.04 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Ondrej Jirman Use devm_regulator_get instead of devm_regulator_get_optional and rely on dummy supply. This avoids NULL checks before regulator_enable/disable calls. This path also improves error reporting, because we now report both use of dummy supply and error during registration with more detail, instead of generic info level message "No regulator found" that was reported previously on errors and lack of regulator property in DT. Finally, we'll be adding further optional regulators, and the overall code will be simpler. Signed-off-by: Ondrej Jirman --- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 4083019c547a..3e951a11aec3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -528,12 +528,10 @@ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv) struct sunxi_priv_data *gmac = priv; int ret; - if (gmac->regulator) { - ret = regulator_enable(gmac->regulator); - if (ret) { - dev_err(&pdev->dev, "Fail to enable regulator\n"); - return ret; - } + ret = regulator_enable(gmac->regulator); + if (ret) { + dev_err(&pdev->dev, "Fail to enable regulator\n"); + return ret; } ret = clk_prepare_enable(gmac->tx_clk); @@ -992,8 +990,7 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv) clk_disable_unprepare(gmac->tx_clk); - if (gmac->regulator) - regulator_disable(gmac->regulator); + regulator_disable(gmac->regulator); } static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable) @@ -1129,12 +1126,12 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) } /* Optional regulator for PHY */ - gmac->regulator = devm_regulator_get_optional(dev, "phy"); + gmac->regulator = devm_regulator_get(dev, "phy"); if (IS_ERR(gmac->regulator)) { - if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER) - return -EPROBE_DEFER; - dev_info(dev, "No regulator found\n"); - gmac->regulator = NULL; + ret = PTR_ERR(gmac->regulator); + if (ret != -EPROBE_DEFER) + dev_err(dev, "Failed to get PHY regulator (%d)\n", ret); + return ret; } /* The "GMAC clock control" register might be located in the From patchwork Tue Aug 20 14:53:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11103961 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D94D912 for ; Tue, 20 Aug 2019 14:54:39 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3BF93214DA for ; Tue, 20 Aug 2019 14:54:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="MaOFkP5A"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="OUSQL0xW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3BF93214DA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=btTTzfSxdZcsC2we6DOZgR3GsDecG3IAY+diYn9hNpM=; b=MaOFkP5AmgwivZ 0bs09gf8LSleN09NNceZgS2B1GNyjK67+5Egce3GTmO92/J6DHfYX2+SC2puBdqYKs6uHVDv+wjMc gNwzWGj5sRK8ZjWjOwpuraNc7ih2nlgvMNygIaG2BkLsYiNwvKfylnpDrJpeA/ce3GS/b1DvV1Vkq 4HcacLEG7OJEdi0BqfH4M/od1FnxaWTWEbY1w68JrZl00fCQDGYzfnMtuR7j04cM6db3X5/TMOTWA fV5jlOUNGcmaAwIv2GCXZQx+v9OR3IGnrxbhaChAZ8TEPjccDg3YrUvMWrc9CxoXbPAxFrQ6+U+mu nq2iwnnxsHgyJ1JYEyOw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i05Ww-0001lS-Nv; Tue, 20 Aug 2019 14:54:38 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i05W7-00013T-TK for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2019 14:53:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1566312826; bh=fJp1/iHxqT8rIRrQhM5u30ZJqn3FLJCfRTqKNHdiDpk=; h=From:To:Cc:Subject:Date:References:From; b=OUSQL0xWoyyXiFXG3/LwHN+ZkRJ0/NRPLbNEZ28F4MzGzDOMyvlvwINEM5mFJYNBR be7A368YMVBuW/BTSfCfJpd3WPAJFNcr60QlNdWdrKPxhUsesiBpVmvMoqsy48u2/Q a46vrrjCQAzAMqZWEPxmeFnRIKmjGU0LoyfmSZ0s= From: megous@megous.com To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin Subject: [PATCH 4/6] net: stmmac: sun8i: Rename PHY regulator variable to regulator_phy Date: Tue, 20 Aug 2019 16:53:41 +0200 Message-Id: <20190820145343.29108-5-megous@megous.com> In-Reply-To: <20190820145343.29108-1-megous@megous.com> References: <20190820145343.29108-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190820_075348_274500_BEAA9494 X-CRM114-Status: GOOD ( 13.39 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Ondrej Jirman We'll be adding further optional regulators, and this makes it clearer what the regulator is for. Signed-off-by: Ondrej Jirman --- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 3e951a11aec3..e7df30d3cab1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -57,19 +57,21 @@ struct emac_variant { }; /* struct sunxi_priv_data - hold all sunxi private data - * @tx_clk: reference to MAC TX clock - * @ephy_clk: reference to the optional EPHY clock for the internal PHY - * @regulator: reference to the optional regulator - * @rst_ephy: reference to the optional EPHY reset for the internal PHY - * @variant: reference to the current board variant - * @regmap: regmap for using the syscon - * @internal_phy_powered: Does the internal PHY is enabled - * @mux_handle: Internal pointer used by mdio-mux lib + * @tx_clk: reference to MAC TX clock + * @ephy_clk: reference to the optional EPHY clock for + * the internal PHY + * @regulator_phy: reference to the optional regulator + * @rst_ephy: reference to the optional EPHY reset for + * the internal PHY + * @variant: reference to the current board variant + * @regmap: regmap for using the syscon + * @internal_phy_powered: Does the internal PHY is enabled + * @mux_handle: Internal pointer used by mdio-mux lib */ struct sunxi_priv_data { struct clk *tx_clk; struct clk *ephy_clk; - struct regulator *regulator; + struct regulator *regulator_phy; struct reset_control *rst_ephy; const struct emac_variant *variant; struct regmap_field *regmap_field; @@ -528,9 +530,9 @@ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv) struct sunxi_priv_data *gmac = priv; int ret; - ret = regulator_enable(gmac->regulator); + ret = regulator_enable(gmac->regulator_phy); if (ret) { - dev_err(&pdev->dev, "Fail to enable regulator\n"); + dev_err(&pdev->dev, "Fail to enable PHY regulator\n"); return ret; } @@ -990,7 +992,7 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv) clk_disable_unprepare(gmac->tx_clk); - regulator_disable(gmac->regulator); + regulator_disable(gmac->regulator_phy); } static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable) @@ -1126,9 +1128,9 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) } /* Optional regulator for PHY */ - gmac->regulator = devm_regulator_get(dev, "phy"); - if (IS_ERR(gmac->regulator)) { - ret = PTR_ERR(gmac->regulator); + gmac->regulator_phy = devm_regulator_get(dev, "phy"); + if (IS_ERR(gmac->regulator_phy)) { + ret = PTR_ERR(gmac->regulator_phy); if (ret != -EPROBE_DEFER) dev_err(dev, "Failed to get PHY regulator (%d)\n", ret); return ret; From patchwork Tue Aug 20 14:53:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11103965 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 10A13174A for ; Tue, 20 Aug 2019 14:55:13 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E2DDD22DA7 for ; Tue, 20 Aug 2019 14:55:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="o0IyU3is"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="XI5z9DBn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E2DDD22DA7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=lvSTO+XIE653o4/eAeqdnwdD/pXOhsgswGgbeoJ49AU=; b=o0IyU3is6OY2zM RW9UsBMbAOQxciwSxe+THMr1CPwM9/N0P+30ir+MtFXC7Fr11ezau5lDxwGThkLJmQUTqSDrW1O6k YnNHAhtMnfsMf+yD64a2yoBhBvZuinvOH3C1Zlr7JeXI7ZSIqwGaUx7JDU+Hlg8pYJUh2e7UpJZcV Z1D0Q0G25lSUEfCxDCg/J1XQ+NfDl5pV0G/Dj7j9goZeWsZsrR9xcH+C+67a/H9ZNxSLX+fS4Z5Tp a0J+dnFhGhFNIgLbm3euUQlgFflihIYL4PryGITokqd8zMbKz1LYhlW8aiRCLqxiIwwKechWURWO2 IkDhcbraprnRZH8B9AqQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i05XU-0003KG-Ar; Tue, 20 Aug 2019 14:55:12 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i05WA-00014m-Rm for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2019 14:53:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1566312826; bh=4hhK28dgS8BmhfHSH/CC6uoVklNXHuscBoxMGcS+N/w=; h=From:To:Cc:Subject:Date:References:From; b=XI5z9DBnNdOUqFw25KNQyt9MWq35cijMPrMPxwWFujdoAioSTERrxgfz/4Bgv2BoY LnJJavS2Z5Ic3cP0TpH8b795HjbJ4uOUXZsAj60ug3CNw3S0q57v5h7TtLAQ7x87ID yLHJzWbAsNjcbG4da6MFfZ19DXmU85CokPZfpB3U= From: megous@megous.com To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin Subject: [PATCH 5/6] net: stmmac: sun8i: Add support for enabling a regulator for PHY I/O pins Date: Tue, 20 Aug 2019 16:53:42 +0200 Message-Id: <20190820145343.29108-6-megous@megous.com> In-Reply-To: <20190820145343.29108-1-megous@megous.com> References: <20190820145343.29108-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190820_075351_323788_DE48EDF9 X-CRM114-Status: GOOD ( 13.89 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Ondrej Jirman Orange Pi 3 has two regulators that power the Realtek RTL8211E. According to the phy datasheet, both regulators need to be enabled at the same time. Add support for the second optional regulator, "phy-io", to the glue driver. Signed-off-by: Ondrej Jirman --- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index e7df30d3cab1..e96337b7cd12 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -61,6 +61,8 @@ struct emac_variant { * @ephy_clk: reference to the optional EPHY clock for * the internal PHY * @regulator_phy: reference to the optional regulator + * @regulator_phy_io: reference to the optional regulator for + * PHY I/O pins * @rst_ephy: reference to the optional EPHY reset for * the internal PHY * @variant: reference to the current board variant @@ -72,6 +74,7 @@ struct sunxi_priv_data { struct clk *tx_clk; struct clk *ephy_clk; struct regulator *regulator_phy; + struct regulator *regulator_phy_io; struct reset_control *rst_ephy; const struct emac_variant *variant; struct regmap_field *regmap_field; @@ -530,21 +533,30 @@ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv) struct sunxi_priv_data *gmac = priv; int ret; + ret = regulator_enable(gmac->regulator_phy_io); + if (ret) { + dev_err(&pdev->dev, "Fail to enable PHY I/O regulator\n"); + return ret; + } + ret = regulator_enable(gmac->regulator_phy); if (ret) { dev_err(&pdev->dev, "Fail to enable PHY regulator\n"); - return ret; + goto err_disable_regulator_phy_io; } ret = clk_prepare_enable(gmac->tx_clk); if (ret) { - if (gmac->regulator) - regulator_disable(gmac->regulator); dev_err(&pdev->dev, "Could not enable AHB clock\n"); - return ret; + goto err_disable_regulator_phy; } return 0; +err_disable_regulator_phy: + regulator_disable(gmac->regulator_phy); +err_disable_regulator_phy_io: + regulator_disable(gmac->regulator_phy_io); + return ret; } static void sun8i_dwmac_core_init(struct mac_device_info *hw, @@ -993,6 +1005,7 @@ static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv) clk_disable_unprepare(gmac->tx_clk); regulator_disable(gmac->regulator_phy); + regulator_disable(gmac->regulator_phy_io); } static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable) @@ -1136,6 +1149,16 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) return ret; } + /* Optional regulator for PHY I/O pins */ + gmac->regulator_phy_io = devm_regulator_get(dev, "phy-io"); + if (IS_ERR(gmac->regulator_phy_io)) { + ret = PTR_ERR(gmac->regulator_phy_io); + if (ret != -EPROBE_DEFER) + dev_err(dev, "Failed to get PHY I/O regulator (%d)\n", + ret); + return ret; + } + /* The "GMAC clock control" register might be located in the * CCU address range (on the R40), or the system control address * range (on most other sun8i and later SoCs). From patchwork Tue Aug 20 14:53:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ond=C5=99ej_Jirman?= X-Patchwork-Id: 11103967 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 485B91864 for ; Tue, 20 Aug 2019 14:55:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2489022DA7 for ; Tue, 20 Aug 2019 14:55:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="O009I61I"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=megous.com header.i=@megous.com header.b="pr0wChX5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2489022DA7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=megous.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MIHE6i8W0YDIFtZW8+kW9zFbzC56m1zM17TaDbj8ghw=; b=O009I61InxcFBA /1mhxroOGky8Ioh6E2iPDd9GLatkJPuXS5Xm1FtIH6vS57In9NMfyhYtv7SdZTTjTVDy/dAUFTKzX l7N5GqRgjTnKaU7GD2MCR+D+OFgAMEr9FQRKRISFvRouv68Frr0UFN4xKY/tFHkIze/1wvgPktdwC eQU6iVLtzmBBaBe2BAdQGNC+ZA3q6qEFhtgLkpF9vtwBbQMaGY7kfHqgHr57ccblxIxLiXdHtVCEY qZcNeKKZNzDUMRlNnPMMdLQnmVyvjaZ7wDKktuP9d8PrNz8a3EU0V7dY4I8fg/y3/b05fRg9Bu128 KGmsvdkkUsVrtXK+TX3g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1i05Xk-0003dp-L6; Tue, 20 Aug 2019 14:55:28 +0000 Received: from vps.xff.cz ([195.181.215.36]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1i05WA-00014l-Qq for linux-arm-kernel@lists.infradead.org; Tue, 20 Aug 2019 14:53:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1566312827; bh=/wCPaAVAhM9jkrpOgFjJQndvFQSZ3vor/dhJP6G9DqM=; h=From:To:Cc:Subject:Date:References:From; b=pr0wChX5ZN4OrzzMX3Txai82qwcOk2weMbp798hGCqayc02tBmkgal0EJDif4lKiO 0Z5ZyF08kJhi3AKPIG1VQOkAsPGnlq1Ffa9zqT3kRxYLJPaLRGt+jqjuSwbMnK0NXU NDc9zrMaKXcYD+Jlu6URuc8eMVTnKofwFD/p2/Bo= From: megous@megous.com To: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin Subject: [PATCH 6/6] arm64: dts: allwinner: orange-pi-3: Enable ethernet Date: Tue, 20 Aug 2019 16:53:43 +0200 Message-Id: <20190820145343.29108-7-megous@megous.com> In-Reply-To: <20190820145343.29108-1-megous@megous.com> References: <20190820145343.29108-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190820_075351_323788_E8375EBC X-CRM114-Status: GOOD ( 11.12 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ondrej Jirman , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Ondrej Jirman Orange Pi 3 has two regulators that power the Realtek RTL8211E PHY. According to the datasheet, both regulators need to be enabled at the same time, or that "phy-io" should be enabled slightly earlier than "phy" regulator. RTL8211E/RTL8211EG datasheet says: Note 4: 2.5V (or 1.8/1.5V) RGMII power should be risen simultaneously or slightly earlier than 3.3V power. Rising 2.5V (or 1.8/1.5V) power later than 3.3V power may lead to errors. The driver ensures the regulator enable ordering. The timing is set in DT via startup-delay-us. We also need to wait at least 30ms after power-up/reset, before accessing the PHY registers. All values of RX/TX delay were tested exhaustively and a middle one of the range of working values was chosen. Signed-off-by: Ondrej Jirman --- .../dts/allwinner/sun50i-h6-orangepi-3.dts | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts index eda9d5f640b9..18349e60b8c6 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts @@ -15,6 +15,7 @@ aliases { serial0 = &uart0; + ethernet0 = &emac; }; chosen { @@ -56,6 +57,15 @@ regulator-max-microvolt = <5000000>; regulator-always-on; }; + + reg_gmac_2v5: gmac-2v5 { + compatible = "regulator-fixed"; + regulator-name = "gmac-2v5"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; + enable-active-high; + gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */ + }; }; &cpu0 { @@ -74,6 +84,35 @@ status = "okay"; }; +&emac { + pinctrl-names = "default"; + pinctrl-0 = <&ext_rgmii_pins>; + phy-mode = "rgmii"; + phy-handle = <&ext_rgmii_phy>; + /* + * The board uses 2.5V RGMII signalling. Power sequence to enable + * the phy is to enable GMAC-2V5 and GMAC-3V (aldo2) power rails + * at the same time and to wait 100ms. The driver enables phy-io + * first. Delay is achieved with enable-ramp-delay on reg_aldo2. + */ + phy-supply = <®_aldo2>; + phy-io-supply = <®_gmac_2v5>; + allwinner,rx-delay-ps = <1500>; + allwinner,tx-delay-ps = <700>; + status = "okay"; +}; + +&mdio { + ext_rgmii_phy: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + + reset-gpios = <&pio 3 14 GPIO_ACTIVE_LOW>; /* PD14 */ + reset-assert-us = <15000>; + reset-deassert-us = <40000>; + }; +}; + &hdmi { status = "okay"; }; @@ -136,6 +175,7 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; regulator-name = "vcc33-audio-tv-ephy-mac"; + regulator-enable-ramp-delay = <100000>; }; /* ALDO3 is shorted to CLDO1 */