From patchwork Tue Oct 1 08:29:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 11168225 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 D2BDD15AB for ; Tue, 1 Oct 2019 08:31:14 +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 B08C1215EA for ; Tue, 1 Oct 2019 08:31:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="A1Surw74" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B08C1215EA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aosc.io 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=x+KX+IjqXXpxZxlm66YsDHXqF609Ruf6rNesStJHfyo=; b=A1Surw744MEdsL z5AqrS42/1wpcfv71s19/Jo7aUv9PmfBrLMkZpNPNor0LHAC6tGK7NmFbNKMny7vsftcHhjkj7ytC 6qE+qoXt5n1sA/ZAaYTguWVWJ4ZuWCfrXhjIN8vzeQiiTi9iEjjQv8njfOvzxI6RMmtpDeNXMpfkH AX6YehsGmAugMmYOW/JPI0rLrca5cHmVtBIVaYPF3qaI+6lgWItFQM804atQkqnOyGW4DbRGwqbmB 7gU0iJne+YfiIlW8iqyGIqJ3IU0nNAJ+DeaO+jVuq5+RAin0sXWedAF+Zxcq/tEtwNlU6N34755xu evwMNVOgvMVC7oSfoWbw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFDYw-0000FW-9T; Tue, 01 Oct 2019 08:31:14 +0000 Received: from haggis.mythic-beasts.com ([2a00:1098:0:86:1000:0:2:1]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFDYt-0000F2-Di for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2019 08:31:12 +0000 Received: from [199.195.250.187] (port=57966 helo=hermes.aosc.io) by haggis.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1iFDYo-00015B-S8; Tue, 01 Oct 2019 09:31:07 +0100 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id C4D1A82B04; Tue, 1 Oct 2019 08:30:57 +0000 (UTC) From: Icenowy Zheng To: "David S . Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Andrew Lunn , Florian Fainelli , Heiner Kallweit Subject: [PATCH 1/3] dt-bindings: add binding for RTL8211E Ethernet PHY Date: Tue, 1 Oct 2019 16:29:10 +0800 Message-Id: <20191001082912.12905-2-icenowy@aosc.io> In-Reply-To: <20191001082912.12905-1-icenowy@aosc.io> References: <20191001082912.12905-1-icenowy@aosc.io> MIME-Version: 1.0 X-BlackCat-Spam-Score: 65 X-Spam-Status: No, score=6.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191001_013111_458831_391F3924 X-CRM114-Status: GOOD ( 14.17 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2a00:1098:0:86:1000:0:2:1 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Icenowy Zheng , 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: Icenowy Zheng Some RTL8211E Ethernet PHY have an issue that needs a workaround, and a way to indicate the need of the workaround should be added. Add the binding for a DT property that indicates this workaround. Signed-off-by: Icenowy Zheng --- .../bindings/net/realtek,rtl8211e.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/realtek,rtl8211e.yaml diff --git a/Documentation/devicetree/bindings/net/realtek,rtl8211e.yaml b/Documentation/devicetree/bindings/net/realtek,rtl8211e.yaml new file mode 100644 index 000000000000..264e93cafbec --- /dev/null +++ b/Documentation/devicetree/bindings/net/realtek,rtl8211e.yaml @@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/realtek,rtl8211e.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Realtek RTL8211E Ethernet PHY + +properties: + realtek,config-magic-for-pine64: + description: + Enabling specific hacks for some broken RTL8211E chips known to be + used by Pine64+ boards. + +examples: + - | + &mdio { + ext_phy: ethernet-phy@0 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <0>; + realtek,config-magic-for-pine64; + }; + }; From patchwork Tue Oct 1 08:29:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 11168227 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 2FCD4112B for ; Tue, 1 Oct 2019 08:32:30 +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 0D268215EA for ; Tue, 1 Oct 2019 08:32:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="o1rxLMaA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D268215EA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aosc.io 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=RyZZCQmXzB5Kzh97knbbzI6u2+a+0K+cGjtnk5aPsZs=; b=o1rxLMaAolDixN jLuMMuoo7Hk212Cp4h7Nf3cI3UJ9M7P6q17U6JqayJaaV2TAZ4gSZ4uOInWwzB7MqngR+vVTD9YuM cm0XYKyGFEyOs8ksBby37Asjx8Whj1OZZHMUI6jrfN1JT5Ee61rKou5ePgQviOjIi4Ti0MOxr+Bsz f801VQiYN1vP9XFITQJtuvduOHZEywmk/KBjIDuo7TH5lK6kzXwpnStl8fQ4lwkGGezmP1Aex+9rz UjHCPejy8WyFGLaSeL2R8aun4Es63ToUiBUD2DkOM65ajYX+VmA+g0TwGMBNjVldBJAFTXXp/Jxpt H81SnFR54/SFWLBYtSeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFDa6-0000ZG-Qp; Tue, 01 Oct 2019 08:32:26 +0000 Received: from balrog.mythic-beasts.com ([2a00:1098:0:82:1000:0:2:1]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFDa4-0000Yt-7d for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2019 08:32:25 +0000 Received: from [199.195.250.187] (port=42641 helo=hermes.aosc.io) by balrog.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1iFDZy-0001De-MX; Tue, 01 Oct 2019 09:32:19 +0100 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id 5342182B0F; Tue, 1 Oct 2019 08:32:12 +0000 (UTC) From: Icenowy Zheng To: "David S . Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Andrew Lunn , Florian Fainelli , Heiner Kallweit Subject: [PATCH 2/3] net: phy: realtek: add config hack for broken RTL8211E on Pine64+ boards Date: Tue, 1 Oct 2019 16:29:11 +0800 Message-Id: <20191001082912.12905-3-icenowy@aosc.io> In-Reply-To: <20191001082912.12905-1-icenowy@aosc.io> References: <20191001082912.12905-1-icenowy@aosc.io> MIME-Version: 1.0 X-BlackCat-Spam-Score: 65 X-Spam-Status: No, score=6.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191001_013224_273885_79326895 X-CRM114-Status: GOOD ( 16.62 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2a00:1098:0:82:1000:0:2:1 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org, Icenowy Zheng Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some RTL8211E chips have broken GbE function, which needs a hack to fix. Currently only some Pine64+ boards are known to used this broken batch of RTL8211E chips. Enable this hack when a certain device tree property is set. As this hack is not documented on the datasheet at all, it contains magic numbers, and could not be revealed. These magic numbers are received from Realtek via Pine64. Signed-off-by: Icenowy Zheng --- drivers/net/phy/realtek.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 677c45985338..f696f2085368 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -9,6 +9,7 @@ * Copyright (c) 2004 Freescale Semiconductor, Inc. */ #include +#include #include #include @@ -32,6 +33,12 @@ #define RTL8211E_TX_DELAY BIT(1) #define RTL8211E_RX_DELAY BIT(2) #define RTL8211E_MODE_MII_GMII BIT(3) +/* The following number resides in the same register with + * the delay bits and mode bit above. However, no known + * document can explain this, and this value is directly + * received from Realtek via Pine64. + */ +#define RTL8211E_CONF_MAGIC_PINE64 0xb400 #define RTL8201F_ISR 0x1e #define RTL8201F_IER 0x13 @@ -196,6 +203,7 @@ static int rtl8211e_config_init(struct phy_device *phydev) { int ret = 0, oldpage; u16 val; + struct device_node *of_node = phydev->mdio.dev.of_node; /* enable TX/RX delay for rgmii-* modes, and disable them for rgmii. */ switch (phydev->interface) { @@ -234,6 +242,12 @@ static int rtl8211e_config_init(struct phy_device *phydev) ret = __phy_modify(phydev, 0x1c, RTL8211E_TX_DELAY | RTL8211E_RX_DELAY, val); + if (of_node && + of_property_read_bool(of_node, "realtek,config-magic-for-pine64")) { + ret = __phy_modify(phydev, 0x1c, GENMASK(15, 8), + RTL8211E_CONF_MAGIC_PINE64); + } + err_restore_page: return phy_restore_page(phydev, oldpage, ret); } From patchwork Tue Oct 1 08:29:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Icenowy Zheng X-Patchwork-Id: 11168229 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 C99D8112B for ; Tue, 1 Oct 2019 08:32: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 A5576215EA for ; Tue, 1 Oct 2019 08:32: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="kERt4U5Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A5576215EA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aosc.io 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=+EbYtTId5T3Yuy8EJNd2ENZ8vjJubtjL7MPLcC2rRko=; b=kERt4U5YOKKN8u rez2QoCYkFzRJhnzRzHUS1mRXk+8QJnl//bnw2kjpUc+kgFEVqyh/bpWQbG5+Lod00MCx7h7WlJPp 3ukBxfNieo/XFC/Pt9ddTFAAQ7GaTloqpQ64LfedXzXWPd1CZgr4krSF/HMuIHoLO3KC6GrJ4IRt2 LPn0Uh9g0wv6kes0gPxYeVgmKpiLKd0VT7Qqo1QiowLSaebGHOylXAcpW0hcJ+xzLiUsMgaRMU7Nv koHpjfMpiPdGT1tBG6n1NZoV0aQ2jr6TznBr4Zj01xcdKxOcAp+yk6ums1iNMPyOXLzyjEF/Yr92Q +5G72UhmMX4+kHPadA+Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFDaH-0000kh-O9; Tue, 01 Oct 2019 08:32:37 +0000 Received: from balrog.mythic-beasts.com ([2a00:1098:0:82:1000:0:2:1]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iFDaA-0000dK-56 for linux-arm-kernel@lists.infradead.org; Tue, 01 Oct 2019 08:32:31 +0000 Received: from [199.195.250.187] (port=42658 helo=hermes.aosc.io) by balrog.mythic-beasts.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1iFDa5-0001IN-29; Tue, 01 Oct 2019 09:32:25 +0100 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id 5F36E82B13; Tue, 1 Oct 2019 08:32:20 +0000 (UTC) From: Icenowy Zheng To: "David S . Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Andrew Lunn , Florian Fainelli , Heiner Kallweit Subject: [PATCH 3/3] arm64: allwinner: a64: dts: apply hack for RTL8211E on Pine64+ Date: Tue, 1 Oct 2019 16:29:12 +0800 Message-Id: <20191001082912.12905-4-icenowy@aosc.io> In-Reply-To: <20191001082912.12905-1-icenowy@aosc.io> References: <20191001082912.12905-1-icenowy@aosc.io> MIME-Version: 1.0 X-BlackCat-Spam-Score: 65 X-Spam-Status: No, score=6.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191001_013230_342030_92E97DBB X-CRM114-Status: GOOD ( 13.35 ) X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [2a00:1098:0:82:1000:0:2:1 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 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: devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-arm-kernel@lists.infradead.org, Icenowy Zheng Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Some of the Pine64+ boards are known to use a batch of broken RTL8211E PHYs. A magic number that is in an undocumented field of a register is passed from Realtek via Pine64. Add the property to apply the hack to the Pine64+ device tree. Signed-off-by: Icenowy Zheng --- arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts index 24f1aac366d6..4d68f850d03a 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts @@ -61,5 +61,6 @@ ext_rgmii_phy: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; + realtek,config-magic-for-pine64; }; };