From patchwork Fri Apr 26 22:40:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stijn Tintel X-Patchwork-Id: 1928403 X-Patchwork-Delegate: stijn@linux-ipv6.be Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=BTaaj/sk; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linux-ipv6.be header.i=@linux-ipv6.be header.a=rsa-sha256 header.s=502B7754-045F-11E5-BBC5-64595FD46BE8 header.b=KqxZRjBD; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VR75M0CbXz23jG for ; Sat, 27 Apr 2024 08:42:14 +1000 (AEST) 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:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=SrZRkjcNJRQQxTB0ym9OaL8aGosDQkFuEeD2NkSYLsc=; b=BTaaj/skV5wyTR omju6XHeOO1mChFlp5rWVLMX4LWFza0l6Pjg6VIKES4CuFN+FWhjfDsLkhK/FQdL/doCq+uXBLtxV VkhKnujj4KfuwLBuqvcPLpQ7hVMAD/aVjFpgwRW4/s57ed8z7SrLTw9B3fLWDu2NPG5bkaVocLB4/ blE7kKyXm4HTHnijeEv7Hpt1DB1L+rg6eLE/x/Epkiti5MJrPRBST0OnKja0+R+ngu91J5ycBoj9j ml28sCfzFgI+ZHSuv8XEwi9NM78lNnhoYIw2pwqUUyk3iyMvdObHVlhVRxCzE56o6UkkFm3o84mu7 gN44i2HDrmlE6dU0htmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0UF7-0000000EFHn-13Di; Fri, 26 Apr 2024 22:40:33 +0000 Received: from mail.tintel.eu ([2001:41d0:a:6e77:0:ff:fe5c:6a54]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0UEy-0000000EF7E-1bC7 for openwrt-devel@lists.openwrt.org; Fri, 26 Apr 2024 22:40:26 +0000 Received: from localhost (localhost [IPv6:::1]) by mail.tintel.eu (Postfix) with ESMTP id 61ECB483EB91 for ; Sat, 27 Apr 2024 00:40:09 +0200 (CEST) Received: from mail.tintel.eu ([IPv6:::1]) by localhost (mail.tintel.eu [IPv6:::1]) (amavis, port 10032) with ESMTP id w7I0yWcPQUSe for ; Sat, 27 Apr 2024 00:40:09 +0200 (CEST) Received: from localhost (localhost [IPv6:::1]) by mail.tintel.eu (Postfix) with ESMTP id DDF8245D4893 for ; Sat, 27 Apr 2024 00:40:08 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.tintel.eu DDF8245D4893 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-ipv6.be; s=502B7754-045F-11E5-BBC5-64595FD46BE8; t=1714171208; bh=qaHdcVstyI/v6+ftg1mI66bHbHRyLEDVS1X+noxEKdM=; h=From:To:Date:Message-ID:MIME-Version; b=KqxZRjBD+zEHqBGFVDLKgqzUaOn7ZmDfeLFY8dHbFHEWi5nf0xQqWuvyjsNTW+/hK UsljgA6IQoyd0Ez4WjQn5Hoq2HbBmUbTOKnOvonnCf0RizGOoR9LCZgqJ5yEFhV77G zN+x1aQIFtD7jQTuUpi+Ep5O41HJacElFIuZVLg0= X-Virus-Scanned: amavis at mail.tintel.eu Received: from mail.tintel.eu ([IPv6:::1]) by localhost (mail.tintel.eu [IPv6:::1]) (amavis, port 10026) with ESMTP id cMgaQ1CJFzdq for ; Sat, 27 Apr 2024 00:40:08 +0200 (CEST) Received: from taz.sof.bg.adlevio.net (unknown [IPv6:2001:67c:21bc:20::10]) by mail.tintel.eu (Postfix) with ESMTPS id 81A07483EB8D for ; Sat, 27 Apr 2024 00:40:08 +0200 (CEST) From: stijn@linux-ipv6.be To: openwrt-devel@lists.openwrt.org Subject: [PATCH 1/2] realtek/rtl839x: respect phy-is-integrated property Date: Sat, 27 Apr 2024 01:40:07 +0300 Message-ID: <20240426224008.3400172-1-stijn@linux-ipv6.be> X-Mailer: git-send-email 2.43.2 MIME-Version: 1.0 X-Rspamd-Pre-Result: action=no action; module=multimap; Matched map: IP_WHITELIST X-Rspamd-Server: skulls X-Rspamd-Queue-Id: 81A07483EB8D X-Spamd-Result: default: False [2.59 / 15.00]; RDNS_NONE(1.00)[]; R_SPF_FAIL(1.00)[-all:c]; R_MISSING_CHARSET(0.50)[]; ONCE_RECEIVED(0.10)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[linux-ipv6.be : No valid SPF, No valid DKIM,none]; MX_GOOD(-0.01)[]; FROM_NO_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:200533, ipnet:2001:67c:21bc::/48, country:BG]; DIRECT_TO_MX(0.00)[git-send-email 2.43.2]; R_DKIM_NA(0.00)[]; ARC_NA(0.00)[]; IP_WHITELIST(0.00)[2001:67c:21bc:20::10]; FROM_EQ_ENVFROM(0.00)[] X-Rspamd-Action: no action X-Rspamd-Pre-Result: action=no action; module=multimap; Matched map: IP_WHITELIST X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_154024_917178_8B055693 X-CRM114-Status: GOOD ( 11.08 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Respect the phy-is-integrated property on ethernet-phy nodes. There are RTL8393M switches where the PHYs at address 48 and 49 are provided by an external RTL8214FC. Hardcoding them to use the internal SerDes makes it impossible to use the ports connected to such [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Respect the phy-is-integrated property on ethernet-phy nodes. There are RTL8393M switches where the PHYs at address 48 and 49 are provided by an external RTL8214FC. Hardcoding them to use the internal SerDes makes it impossible to use the ports connected to such an external PHY. Respect the phy-is-integrated property on ethernet-phy nodes as a first step to support such ports. The potential impact for this should be limited to RTL8393 based switches, and looking at the commit messages and device tree files of the supported switches based on this SoC, the SFP and/or combo ports are either not working (D-Link DGS-1210-52, Netgear GS750E, TP-Link SG2452P/T1600G-52PS), use PHYs at a different address (Panasonic SwitchM48EG PN28480K), or already have the phy-is-integrated property set on the PHYs at address 48 and 49. Signed-off-by: Stijn Tintel Acked-by: Daniel Golle --- .../realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c index 54e592aeaa..71e7937336 100644 --- a/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-5.15/drivers/net/ethernet/rtl838x_eth.c @@ -1658,7 +1658,7 @@ static int rtl839x_mdio_read_paged(struct mii_bus *bus, int mii_id, u16 page, in int err; struct rtl838x_eth_priv *priv = bus->priv; - if (mii_id >= 48 && mii_id <= 49 && priv->id == 0x8393) + if (priv->phy_is_internal[mii_id]) return rtl839x_read_sds_phy(mii_id, regnum); if (regnum & (MII_ADDR_C45 | MII_ADDR_C22_MMD)) { @@ -1797,7 +1797,7 @@ static int rtl839x_mdio_write_paged(struct mii_bus *bus, int mii_id, u16 page, struct rtl838x_eth_priv *priv = bus->priv; int err; - if (mii_id >= 48 && mii_id <= 49 && priv->id == 0x8393) + if (priv->phy_is_internal[mii_id]) return rtl839x_write_sds_phy(mii_id, regnum, value); if (regnum & (MII_ADDR_C45 | MII_ADDR_C22_MMD)) { From patchwork Fri Apr 26 22:40:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stijn Tintel X-Patchwork-Id: 1928404 X-Patchwork-Delegate: stijn@linux-ipv6.be Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Rwbe/Oyd; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linux-ipv6.be header.i=@linux-ipv6.be header.a=rsa-sha256 header.s=502B7754-045F-11E5-BBC5-64595FD46BE8 header.b=yinX6QTX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VR75f48BCz23jG for ; Sat, 27 Apr 2024 08:42:30 +1000 (AEST) 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:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VM06isUa68lJOMVUbggcr6id93oeBpR98TmRB8C7620=; b=Rwbe/OydXGaBPS LB35hVDfe//b++d531U4gELi8MP3dSCO3RhmF/TC0Rtim5a0QLH4xqCL7mNS7/IP137UUiF0UqbH7 YD+bccEvW0u0o/4e3PdGb39lGihOy1ibZBcyp+10TS0G9InjmtOOoi5ciEM+yGE0hs4VNWqQX1B+T VlEvieW2s2yLaIJai/SZ/6r1dwu2DHBq0kIXRzuC5hCdi9eLbyyfEnLuPIR96pQmIdYu35spanTz2 XTpAC6DNxpk5oZ0cFENwbeNTMUieyy0ykrs2z42h+pfFi33Pdsh48OP8On/HDTY2PWH4t1abl0Rll fjjKGneaZIvr7nYnyIaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0UF4-0000000EFET-2ZlG; Fri, 26 Apr 2024 22:40:30 +0000 Received: from mail.tintel.eu ([51.83.127.189]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0UEy-0000000EF7F-1aZ8 for openwrt-devel@lists.openwrt.org; Fri, 26 Apr 2024 22:40:26 +0000 Received: from localhost (localhost [IPv6:::1]) by mail.tintel.eu (Postfix) with ESMTP id 002FA483EB8D for ; Sat, 27 Apr 2024 00:40:10 +0200 (CEST) Received: from mail.tintel.eu ([IPv6:::1]) by localhost (mail.tintel.eu [IPv6:::1]) (amavis, port 10032) with ESMTP id obdAv96jG__H for ; Sat, 27 Apr 2024 00:40:09 +0200 (CEST) Received: from localhost (localhost [IPv6:::1]) by mail.tintel.eu (Postfix) with ESMTP id 9330245D4893 for ; Sat, 27 Apr 2024 00:40:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.tintel.eu 9330245D4893 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-ipv6.be; s=502B7754-045F-11E5-BBC5-64595FD46BE8; t=1714171209; bh=8BPWQvAJrJgDsiwMY5UMwA/21bzmyiQtZPD2qeYFt5c=; h=From:To:Date:Message-ID:MIME-Version; b=yinX6QTXtuS/+w8OMnlvOXK4PsZzkTq27tUvpOnchu/SNFiDGXlass8ey/ELvms0k /KP9KBe0qfpgCTQilVzIGnsSau3PafjwXFACRb9KFLd3REGee/+dj5UsPjGyfQTjOK pYP1+Cpq4w+svl8U2hbIomHrBn6xO8j4b/N0RWC8= X-Virus-Scanned: amavis at mail.tintel.eu Received: from mail.tintel.eu ([IPv6:::1]) by localhost (mail.tintel.eu [IPv6:::1]) (amavis, port 10026) with ESMTP id yfVKZqMZdc2s for ; Sat, 27 Apr 2024 00:40:09 +0200 (CEST) Received: from taz.sof.bg.adlevio.net (unknown [IPv6:2001:67c:21bc:20::10]) by mail.tintel.eu (Postfix) with ESMTPS id 47209483EB8D for ; Sat, 27 Apr 2024 00:40:09 +0200 (CEST) From: stijn@linux-ipv6.be To: openwrt-devel@lists.openwrt.org Subject: [PATCH 2/2] realtek: add RTL821X_CHIP_ID Date: Sat, 27 Apr 2024 01:40:08 +0300 Message-ID: <20240426224008.3400172-2-stijn@linux-ipv6.be> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240426224008.3400172-1-stijn@linux-ipv6.be> References: <20240426224008.3400172-1-stijn@linux-ipv6.be> MIME-Version: 1.0 X-Rspamd-Pre-Result: action=no action; module=multimap; Matched map: IP_WHITELIST X-Rspamd-Server: skulls X-Rspamd-Queue-Id: 47209483EB8D X-Spamd-Result: default: False [2.59 / 15.00]; RDNS_NONE(1.00)[]; R_SPF_FAIL(1.00)[-all:c]; R_MISSING_CHARSET(0.50)[]; ONCE_RECEIVED(0.10)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[linux-ipv6.be : No valid SPF, No valid DKIM,none]; MX_GOOD(-0.01)[]; FROM_NO_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:200533, ipnet:2001:67c:21bc::/48, country:BG]; DIRECT_TO_MX(0.00)[git-send-email 2.43.2]; R_DKIM_NA(0.00)[]; ARC_NA(0.00)[]; IP_WHITELIST(0.00)[2001:67c:21bc:20::10]; FROM_EQ_ENVFROM(0.00)[] X-Rspamd-Action: no action X-Rspamd-Pre-Result: action=no action; module=multimap; Matched map: IP_WHITELIST X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_154024_873630_2EEC4331 X-CRM114-Status: UNSURE ( 8.94 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: According to the Realtek SDK code, the RTL8214FC, RTL8218B and RTL8218FB all have the same chip ID 0x6276. Let's add a constant for it, as we're using it in more than one location. Signed-off-by: Stijn Tintel --- .../linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org According to the Realtek SDK code, the RTL8214FC, RTL8218B and RTL8218FB all have the same chip ID 0x6276. Let's add a constant for it, as we're using it in more than one location. Signed-off-by: Stijn Tintel --- .../linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c index 56e8a7f49d..490020989f 100644 --- a/target/linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c +++ b/target/linux/realtek/files-5.15/drivers/net/phy/rtl83xx-phy.c @@ -46,6 +46,8 @@ extern struct mutex smi_lock; /* external RTL821X PHY uses register 0x1e to select media page */ #define RTL821XEXT_MEDIA_PAGE_SELECT 0x1e +#define RTL821X_CHIP_ID 0x6276 + #define RTL821X_MEDIA_PAGE_AUTO 0 #define RTL821X_MEDIA_PAGE_COPPER 1 #define RTL821X_MEDIA_PAGE_FIBRE 3 @@ -834,7 +836,7 @@ static int rtl8380_configure_ext_rtl8218b(struct phy_device *phydev) /* Read internal PHY ID */ phy_write_paged(phydev, 31, 27, 0x0002); val = phy_read_paged(phydev, 31, 28); - if (val != 0x6276) { + if (val != RTL821X_CHIP_ID) { phydev_err(phydev, "Expected external RTL8218B, found PHY-ID %x\n", val); return -1; } @@ -1331,7 +1333,7 @@ static int rtl8380_configure_rtl8214fc(struct phy_device *phydev) phy_write_paged(phydev, 0, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); phy_write_paged(phydev, 0x1f, 0x1b, 0x0002); val = phy_read_paged(phydev, 0x1f, 0x1c); - if (val != 0x6276) { + if (val != RTL821X_CHIP_ID) { phydev_err(phydev, "Expected external RTL8214FC, found PHY-ID %x\n", val); return -1; }