From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj2-f3.google.com (mail-pj2-f3.google.com [74.125.227.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4835F4AF682 for ; Tue, 22 Sep 2026 20:03:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107437; cv=none; b=HM5ev0WA1fKUK6wMf7d3WBJwaCRoEUy06Z+pfQDeXyucpqzGu0YyN+3qIxtWH/Zrt1GHyMmq4GkrZdQNVcHFaNgUEVnFizthUYFTFzKuTiUKJwm6C0dDYqBIYrHxNe2s6ZY26i5/AdNECXgAfxTcdx9gfJBU6EruZZUG/772h8E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107437; c=relaxed/simple; bh=U+Ef+njUhKSDrdsVjIV/jZGXnWIx3qurrLz00hATNN4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Ia9UFmJ6P76aYcaWFzuug1GpdmWm/heVgrrco+Xpk+Y6/b78J2MiYkmhuvbg2/2Or/kp8FElyjkpK8vG++iBwy4YXKku03iO2m/KInEJ3Uttyt+cNNUr629xrySFbYY5CjKgBbjJl1PF1JS+HISaCkutfBNSr5TaDUZvTqsttbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lNOR05T8; arc=none smtp.client-ip=74.125.227.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lNOR05T8" Received: by mail-pj2-f3.google.com with SMTP id d9443c01a7336-2d6fff25530so861255ad.0 for ; Tue, 22 Sep 2026 13:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107428; x=1790712228; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=tLf44y0wjXekRKRabcqObNjHMHH8+Vthi1ry2XuMnz0=; b=lNOR05T8az3xETlzdh1sV+1XBAIwmnE0hhuXGdy47J1hjpX8TJwxTabCtQSgnvDhhR QT1yc6QaYV46Bqgzb6tS6vXrFzt3Qugokk0Om7EvmihwV7zWixML9bZmYtkaugGoWL6M sZ3oYmH/w/aSVsnyuG7XtbSWY+rqMMtCSNDIeKsUC3YSIBtSsF9su2qDTEQvO9dP8WNn OKeNoJyj7FMS+qoJsJJ7MaJqG2GtbXgIa4VOhrcF8+pEFAwtfnkLOxeUl3ypQIT2GgaI kWu8FDu9C/SmRXJr87H1XNApHRFZ3IXUgcjq3GGWYlUyXCQcVrfUGZ1JXQWySRvaIRku 075Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107428; x=1790712228; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=tLf44y0wjXekRKRabcqObNjHMHH8+Vthi1ry2XuMnz0=; b=zUjdNZYEgGBSqZ/WeXkwnFD9vVNXJjhfYN7eSQatMv4gH/VNMCNVpQSepitlYfZ2SW NYAwoKT9udXlggdQbFeN3oM/bf4g7XGtXqR4JP4GntOkUE+icDerwG9Qd0ehGQXOat0r o0lHrt0LJI65xNCOgBHLTxamRkO2UV9zzL3BbbEe8u6tKw0S3c4e8ZfNxdmyOc7dOo6r 1oDnLeX+lmX0nJlo86eRlmeAE2ithBkpO00MR8WHwl+Ei0+lHMgy35QyOLz9rc5qHAqN mlmD/Piad0mBKDdyXszzM20ePCPxybmmwwgJEzCKAA5+sx2oG9Ychof/0jjAwnRYkstM engQ== X-Forwarded-Encrypted: i=1; AKwUvBx5hPDpCd5LOQ1hSbPY4nu5NrwUnvbSgeTmSS95vVVSjpNhIFpNxrMDORXrB59KIjfk8n9sP1HeZuMH6Xk=@vger.kernel.org X-Gm-Message-State: AFuF++k6pG9eM9RomnsWynpnz/+4WLDgDd2tqWfGkG+A8hptQGWgHdDD NflCNfBevbH0js6jt1RkiFrpphXJLSd44fUgR13ijzKA5N9LKfJ+uBTR X-Gm-Gg: AYBFou3jndGCGJL5HAHWURtf50BOrRLHoMlBbygvgoRrtJGuztGn1Ul2JWJCeibjHUV vuQCUyXj6aBj9WTCejZftb3xJSUzc7eTWITtQ7Y/6t/ARUDTB3E5m7tUnGq0IL52JZk3KzYRUDh K142aDPG6mhEdvKTUYa77ERUwxsBnI57E2/2Ljb2dpwj5y+CGzDg5EXtCwRT5b+sSQdFIcoWFX1 mNIZfIDvoNXH1AFNeXGRLZ1ZPGU6fmq9QSbB/hB6hv45iT6H5QFz5W1tl3LMn8OwKJDNrqLPAaW 74NNZTUJ2M2Ri/mp/y2lhRGIpgJj8tMkxcKE4dymlsk8ghbqKS08Z5wMhoQJqK0fu3Mdi15owqy AGufPlC1VXOk9B1PgY0+nuOs3PpD11ptYj/ePbhGTDMwyiqxVmjaaaCZ/icbKRq2kz3NdcCg/95 HkZzLaUJyRWUqciDnCLMtn2EfYnz2BO4hRq9UebzgkDCfZWq9e3h9KwcurzIsYequq96UdngXrH 0yS2M0kMg+bd8fEag== X-Received: by 2002:a17:902:fc4c:b0:2dd:c053:e0f7 with SMTP id d9443c01a7336-2df69ddf21cmr4274665ad.38.1790107427896; Tue, 22 Sep 2026 13:03:47 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:03:47 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 00/11] net: pcs: add basic support for RK3568 XPCS Date: Wed, 23 Sep 2026 04:03:24 +0800 Message-ID: <20260922200336.2201212-1-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This series adds proper SGMII support for the Rockchip RK3568 SoC using the integrated Synopsys DesignWare XPCS, along with necessary fixes and refactoring in the stmmac core and XPCS driver. Motivation ========== The RK3568 integrates a DW XPCS accessed via APB3 and connected to a Naneng Combo SerDes PHY. Several boards (e.g., Ariaboard Photonicat) use this interface for Gigabit Ethernet. However, the current upstream stmmac driver does not support this configuration, and the XPCS driver has issues in SGMII poll mode that cause the link to be reported incorrectly. This series addresses these issues by: - Refactoring stmmac PCS lifetime management to allow platform drivers full control over PCS creation/destruction - Fixing the XPCS driver's SGMII link recovery - Adding a Rockchip XPCS platform glue driver and wiring it up in dwmac-rk Series overview =============== Generic: Patch 1: move XPCS lifetime management to platform drivers PHY: Patch 2: DT binding for Naneng Combo PHY SGMII MAC selection Patch 3: implement the PHY SGMII MAC selection in driver RK3568 XPCS/SGMII: Patch 4: DT binding for Rockchip RK3568 XPCS Patch 5: add XPCS and fixed-clock nodes to rk3568.dtsi Patch 6: add ANRESTART support for SGMII link recovery Patch 7: implement the Rockchip XPCS platform glue driver Patch 8: DT binding for Rockchip DWMAC PCS Patch 9: wire up SGMII support in dwmac-rk Patch 11: update MAINTAINERS Board enablement: Patch 10: enable SGMII LAN port on Photonicat board Changelog ========= Changes since v9: Patch 5 (arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes) - Move the two fixed-clock nodes (clk_gmac0_xpcs_mii and clk_gmac1_xpcs_mii) from between the XPCS node and pipe_phy_grf0 to the top of the root node, alongside the other non-reg nodes, and sort them alphabetically. This addresses a DT coding style violation reported by the Sashiko AI review. No functional change. Patch 7 (net: pcs: xpcs: add Rockchip RK3568 platform glue driver) - Add system suspend/resume callbacks and switch from DEFINE_RUNTIME_DEV_PM_OPS to _DEFINE_DEV_PM_OPS so that system suspend and runtime suspend can use different callbacks. - Mark the XPCS as part of the wakeup path in system suspend via device_set_wakeup_path(). PD_PIPE is shared with SATA and PCIe; without this, genpd would power the domain down once every consumer is suspended, killing the SerDes and breaking MAC WoL. Runtime PM behaviour is unchanged: the runtime callbacks only gate the CSR clock, and dev_pm_genpd_rpm_always_on() already keeps PD_PIPE on at runtime. - Clarify the comment above the power domain access: the XPCS lives in PD_PIPE, and the domain must be powered before any register access. Key design decisions ==================== - The stmmac core now delegates XPCS creation entirely to platform drivers via pcs_init/pcs_exit. This is necessary because the generic XPCS creation logic would override any XPCS set up by the platform driver. - The Rockchip XPCS driver creates a virtual MDIO bus over the APB3 registers and implements address remapping. The generic XPCS core handles all PCS configuration via phylink_pcs_ops. - On RK3568 in SGMII mode, the MAC clock is fixed at 125 MHz and cannot be dynamically changed. In-band mode is used, and the generic stmmac set_clk_tx_rate callback is disabled to prevent incorrect clock updates that would break RX. - The SerDes and power domain are attached to the XPCS device tree node rather than the MAC node. This reflects the actual hardware topology and simplifies the dwmac-rk driver by keeping all PCS-related resources self-contained. It also prepares for possible future QSGMII support, where a single SerDes serves multiple MACs and would be more naturally managed under the XPCS node. Testing ======= Board: Ariaboard Photonicat (RK3568) OS: Armbian (trixie) Kernel: 6.18 (backports) Result: The SGMII interface obtains an IP address, SSH works, and ping traffic passes without loss. Notes ===== - When testing out-band mode with set_clk_tx_rate, only 1000Mbps works on both TX/RX; 10/100Mbps only works on TX side. Dependencies ============ None. All patches apply cleanly on top of torvalds master tree (v7.3). Acknowledgments =============== This work was inspired by and builds upon the excellent work of others: - Serge Semin's Synopsys DesignWare XPCS platform driver (pcs-xpcs-plat.c) - Clément Léger's Renesas MIIC driver (pcs-rzn1-miic.c) - The Rockchip TRM and downstream OEM drivers Thanks in advance, Coia Prant --- Coia Prant (11): net: stmmac: move XPCS lifetime management to platform drivers dt-bindings: phy: rockchip: naneng-combphy: add rockchip,sgmii-mac-sel property phy: rockchip: naneng-combphy: add SGMII MAC selection for RK3568 dt-bindings: net: pcs: add rockchip,rk3568-xpcs support arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes net: pcs: xpcs: add ANRESTART support for SGMII link recovery net: pcs: xpcs: add Rockchip RK3568 platform glue driver dt-bindings: net: rockchip-dwmac: document pcs-handle net: stmmac: dwmac-rk: add SGMII support for RK3568 arm64: dts: rockchip: rk3568-photonicat: enable SGMII LAN port MAINTAINERS: add entry for Rockchip XPCS driver .../net/pcs/rockchip,rk3568-xpcs.yaml | 110 ++++ .../bindings/net/rockchip-dwmac.yaml | 18 + .../phy/phy-rockchip-naneng-combphy.yaml | 13 + MAINTAINERS | 9 + .../boot/dts/rockchip/rk3568-photonicat.dts | 74 ++- arch/arm64/boot/dts/rockchip/rk3568.dtsi | 45 ++ drivers/net/ethernet/stmicro/stmmac/Kconfig | 1 + .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 44 +- .../stmicro/stmmac/dwmac-renesas-gbeth.c | 7 +- .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 130 +++- .../net/ethernet/stmicro/stmmac/dwmac-rzn1.c | 7 +- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 7 +- .../net/ethernet/stmicro/stmmac/stmmac_mdio.c | 39 +- drivers/net/pcs/Kconfig | 25 + drivers/net/pcs/Makefile | 5 +- drivers/net/pcs/pcs-xpcs-rk.c | 619 ++++++++++++++++++ drivers/net/pcs/pcs-xpcs.c | 35 +- .../rockchip/phy-rockchip-naneng-combphy.c | 8 + include/linux/pcs/pcs-xpcs-rk.h | 11 + 19 files changed, 1135 insertions(+), 72 deletions(-) create mode 100644 Documentation/devicetree/bindings/net/pcs/rockchip,rk3568-xpcs.yaml create mode 100644 drivers/net/pcs/pcs-xpcs-rk.c create mode 100644 include/linux/pcs/pcs-xpcs-rk.h -- 2.47.3