From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f1.google.com (mail-pj2-f1.google.com [74.125.227.129]) (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 6EA354A2078 for ; Tue, 15 Sep 2026 12:38:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.129 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475917; cv=none; b=rS/gKR4YDl05GhJM/Q6HF3TvmWKRKLq7E7j0NEBW514b9NIofDFKLZhfUnEali3+N51vfL0G30ZjFwKhOlSSbCsajThuhhttIgjQvfrEK960jugM/vSF5J70v2ngIP2pmrttQ5tnBUhuYJus57XTbsbXJxp5P3xhLQHzTAb3NrE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475917; c=relaxed/simple; bh=gWvVNB1m2Bm2R+CKFSLbBbPCu/GkRF+C5uYpyZkg/fA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LrbJScjmXIr8uEJkRfA/vnBbAAxJMflN38rOYDrOChQzRYyg8oe+RhPtZ6Xe4xnvLJkUJaLqdAIapq31JmWuKlLW4wNtQJm6vpxGCaTRBA6oe2h6t2wt2A18Vn8gro6SvD65XfGn8aeUum+JS/G4eGBMXLLE1lqc1s2dshZ4rXk= 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=rkC4FQOk; arc=none smtp.client-ip=74.125.227.129 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="rkC4FQOk" Received: by mail-pj2-f1.google.com with SMTP id 98e67ed59e1d1-39ded0d7f52so1311881a91.0 for ; Tue, 15 Sep 2026 05:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475914; x=1790080714; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=qN2MkU81Lz1KMvwh0OIvKliZyK5cNgEHJk5t3+uaHA8=; b=rkC4FQOkYSj8jAGGxlWPzH9zM826nS63hyhvDyC+r9+BhTNBnu3uu/2c5yBw34jV3u WtHTBN7p4Zw2+jLlqqM1H94AeHS2XmDNX9hu0ktCYfyEBEKYHK2RaxN/WVcr89/6IY6x Vfv/KJj5CRuSD9txVibIRQbsq3LL7tcNkGD40/ueQCU/DvucIhv1moC8VPBrILuFcrl6 21kMojQMye1zJyH4H4ucA2VwTTcCspMAHscPDxCS7oGRJl50ZzhWmaE/8pJ9vXfPOlEs Ofxku7n1ShwQcO5do2cPycXOP5XN4EE/AQu10mpjmOzQmL8v0PNuZ2cvN59IFBW5rpoV K4OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475914; x=1790080714; h=content-transfer-encoding:mime-version:references:in-reply-to :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=qN2MkU81Lz1KMvwh0OIvKliZyK5cNgEHJk5t3+uaHA8=; b=VgejBWiLGgm05n2PdHpY3ZawdtSVGQ9DEOYMhG8LHNj29xxVPXhjiTAGkzO0CQ91Wx HaDAFIYKAj3jlH6/wRc5+ANlBJhLGJ1T/OoUIUfK9KAwQ7Nhvpxh4pSv5PGauT6Kszk4 GroTrhMlhjWI8BeZg32GCWi4Lgzr7yDHTZ/8TArzUPnyG/8YBfB3D/qBjRYyvfKCuUwA 38crVZFiAdTwFRA5lP655s73K7S+YYY/XEj3BuVIhH9hWfbYzuArqLmKsnSDL5Y93wlN /mPeLoielinRhyGE7T3U5PuraXOC3nQeg5q9Bk/txd8U3iwcWzatvlo+L0O/m4AaT84q tMRA== X-Forwarded-Encrypted: i=1; AKwUvBwYOkOgT2aO5P+2J7x9CgnY3BL64Wj5YL/ifndxNx+TW/yTsEtObq8KEEq25qRy9hOHqJDuufUUv/SIT8M=@vger.kernel.org X-Gm-Message-State: AFuF++n9qDeeqrHntoC50xAqwukiwRpXeRz/75zaeW8yXa5u91SIxjJv 38+u2qcF8RqI/SlaMJ3Gm41bTKIiqYsZvdEikOUY5kpAbhk+PbIlJj/6 X-Gm-Gg: AYBFou0AZofMNH6pzPyEo/znP19VTq59NMVjF0EFjmIe1zesLmTF8boKVGxjH0YQ8bS sqelMwdQYeVZRQUUXd3T2lbZuZnWlMDHOQOzr9rI3hYPfezkd0dTSWDAjj+6ab5TjRhUBLx+91N fDEGei2U+nzfJcrVhsuSXCPNbyrfREWixPCqG2GWblCnD8zvTmItPchkQkKXQcuXo0VOw7ZK93T RwJx+w8BzvVXiaCEOqLVmfTX/g1dfIlhDyJN+Urr3IMNNN2HxHIhtVOhVC1LJejHWG1MGaczkdA 6JwZX+OkbZdqxx+RVtvD6Luo50V7LbO0NK8LUWQqgkZToiDrtXoA8U/AAvWR1VienJI44b6MX32 Fikaw1hvxsVHh/pPbAdUMnnld/79zpF/43DI396m9InPrIOMH0V12tmbMiU73UUUOhexC84YORp iZ4F5Z8EAA4DpRLVcE3sM8KpRXDHGAdJyNB2NvN979ymNBWIPtEVihxgABgJ/59GxTp5cX0Q== X-Received: by 2002:a17:90b:1811:b0:395:7fff:a08f with SMTP id 98e67ed59e1d1-39e106b649dmr1483983a91.0.1789475913321; Tue, 15 Sep 2026 05:38:33 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.38.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:38:32 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 01/11] net: stmmac: move XPCS lifetime management to platform drivers Date: Tue, 15 Sep 2026 20:37:50 +0800 Message-ID: <20260915123802.1561724-2-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The current XPCS creation logic in stmmac_pcs_setup() is problematic for several reasons. First, if a device tree specifies a "pcs-handle" but no select_pcs() callback is provided by the platform driver, the created XPCS is never used. The phylink framework requires select_pcs() to actually return the PCS to the core, so the pcs-handle property becomes effectively useless without the matching callback. This is confusing for developers who expect that specifying a pcs-handle in their device tree should be sufficient to enable the PCS. Second, and more critically, when a platform driver sets pcs_init() and creates an XPCS inside that callback, the common code afterwards still runs unconditionally and overwrites priv->hw->xpcs with the local xpcs variable, which stays NULL. The platform driver has no way to prevent this override because the common code runs after the platform-specific initialization. After commit 93f84152e4ae ("net: stmmac: clean up stmmac_mac_select_pcs()"), the common code no longer falls back to priv->hw->phylink_pcs if select_pcs() is not set. This change reinforces that each platform must manage its own PCS life cycle explicitly, but the XPCS creation code in stmmac_pcs_setup() was not updated to match this new expectation, leaving a gap where platform drivers have no clean way to take control of XPCS creation. Address all of these issues by simplifying the existing pcs_init() and pcs_exit() dispatch in stmmac_pcs_setup() and stmmac_pcs_clean(). The common stmmac_pcs_setup() now calls plat->pcs_init() if present, and stmmac_pcs_clean() calls plat->pcs_exit() if present, removing the confusing and error-prone XPCS creation logic from the common code. Platforms that do not need an XPCS simply leave the callbacks as NULL and no change in behavior occurs. Platforms that do need an XPCS can now create it with the exact configuration they require, including wrapping it with custom phylink_pcs_ops when necessary. The Intel mGbE glue is updated to create its XPCS inside its own pcs_init() implementation, and the renesas-gbeth, rzn1 and socfpga pcs_exit() callbacks now explicitly clear priv->hw->phylink_pcs after destroying the PCS to avoid dangling pointer references. Reviewed-by: Maxime Chevallier Signed-off-by: Coia Prant --- .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 44 +++++++++++++++++-- .../stmicro/stmmac/dwmac-renesas-gbeth.c | 7 ++- .../net/ethernet/stmicro/stmmac/dwmac-rzn1.c | 7 ++- .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 7 ++- .../net/ethernet/stmicro/stmmac/stmmac_mdio.c | 39 +++------------- 5 files changed, 62 insertions(+), 42 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/ne= t/ethernet/stmicro/stmmac/dwmac-intel.c index f5f9fa67ecd77..4308dccbf2570 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -603,13 +603,47 @@ static void common_default_data(struct plat_stmmacene= t_data *plat) plat->mdio_bus_data->needs_reset =3D true; } =20 +static int intel_mgbe_pcs_init(struct stmmac_priv *priv) +{ + struct fwnode_handle *devnode, *pcsnode; + struct dw_xpcs *xpcs; + int addr; + + devnode =3D dev_fwnode(priv->device); + + if (fwnode_property_present(devnode, "pcs-handle")) { + pcsnode =3D fwnode_find_reference(devnode, "pcs-handle", 0); + xpcs =3D xpcs_create_fwnode(pcsnode); + fwnode_handle_put(pcsnode); + } else { + addr =3D ffs(priv->plat->mdio_bus_data->pcs_mask) - 1; + xpcs =3D xpcs_create_mdiodev(priv->mii, addr); + } + + if (IS_ERR(xpcs)) + return PTR_ERR(xpcs); + + xpcs_config_eee_mult_fact(xpcs, priv->plat->mult_fact_100ns); + + priv->hw->xpcs =3D xpcs; + return 0; +} + +static void intel_mgbe_pcs_exit(struct stmmac_priv *priv) +{ + if (!priv->hw->xpcs) + return; + + xpcs_destroy(priv->hw->xpcs); + priv->hw->xpcs =3D NULL; +} + static struct phylink_pcs *intel_mgbe_select_pcs(struct stmmac_priv *priv, phy_interface_t interface) { - /* plat->mdio_bus_data->has_xpcs has been set true, so there - * should always be an XPCS. The original code would always - * return this if present. - */ + if (!priv->hw->xpcs) + return NULL; + return xpcs_to_phylink_pcs(priv->hw->xpcs); } =20 @@ -733,6 +767,8 @@ static int intel_mgbe_common_data(struct pci_dev *pdev, plat->phy_interface =3D=3D PHY_INTERFACE_MODE_1000BASEX) { plat->mdio_bus_data->pcs_mask =3D BIT_U32(INTEL_MGBE_XPCS_ADDR); plat->default_an_inband =3D true; + plat->pcs_init =3D intel_mgbe_pcs_init; + plat->pcs_exit =3D intel_mgbe_pcs_exit; plat->select_pcs =3D intel_mgbe_select_pcs; } =20 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c b/dr= ivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c index 19f34e18bfef2..9af32c26f9c14 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-renesas-gbeth.c @@ -81,8 +81,11 @@ static int renesas_gmac_pcs_init(struct stmmac_priv *pri= v) =20 static void renesas_gmac_pcs_exit(struct stmmac_priv *priv) { - if (priv->hw->phylink_pcs) - miic_destroy(priv->hw->phylink_pcs); + if (!priv->hw->phylink_pcs) + return; + + miic_destroy(priv->hw->phylink_pcs); + priv->hw->phylink_pcs =3D NULL; } =20 static struct phylink_pcs *renesas_gmac_select_pcs(struct stmmac_priv *pri= v, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c b/drivers/net= /ethernet/stmicro/stmmac/dwmac-rzn1.c index 13634965bc19a..01df4776edb3f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rzn1.c @@ -35,8 +35,11 @@ static int rzn1_dwmac_pcs_init(struct stmmac_priv *priv) =20 static void rzn1_dwmac_pcs_exit(struct stmmac_priv *priv) { - if (priv->hw->phylink_pcs) - miic_destroy(priv->hw->phylink_pcs); + if (!priv->hw->phylink_pcs) + return; + + miic_destroy(priv->hw->phylink_pcs); + priv->hw->phylink_pcs =3D NULL; } =20 static struct phylink_pcs *rzn1_dwmac_select_pcs(struct stmmac_priv *priv, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 1d7f0a57d2889..6d4bc1fe8f751 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -539,8 +539,11 @@ static int socfpga_dwmac_pcs_init(struct stmmac_priv *= priv) =20 static void socfpga_dwmac_pcs_exit(struct stmmac_priv *priv) { - if (priv->hw->phylink_pcs) - lynx_pcs_destroy(priv->hw->phylink_pcs); + if (!priv->hw->phylink_pcs) + return; + + lynx_pcs_destroy(priv->hw->phylink_pcs); + priv->hw->phylink_pcs =3D NULL; } =20 static struct phylink_pcs *socfpga_dwmac_select_pcs(struct stmmac_priv *pr= iv, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_mdio.c index afe98ff5bdcb0..7396b68899c66 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -426,35 +426,14 @@ int stmmac_mdio_reset(struct mii_bus *bus) int stmmac_pcs_setup(struct net_device *ndev) { struct stmmac_priv *priv =3D netdev_priv(ndev); - struct fwnode_handle *devnode, *pcsnode; - struct dw_xpcs *xpcs =3D NULL; - int addr, ret; - - devnode =3D dev_fwnode(priv->device); - - if (priv->plat->pcs_init) { - ret =3D priv->plat->pcs_init(priv); - } else if (fwnode_property_present(devnode, "pcs-handle")) { - pcsnode =3D fwnode_find_reference(devnode, "pcs-handle", 0); - xpcs =3D xpcs_create_fwnode(pcsnode); - fwnode_handle_put(pcsnode); - ret =3D PTR_ERR_OR_ZERO(xpcs); - } else if (priv->plat->mdio_bus_data && - priv->plat->mdio_bus_data->pcs_mask) { - addr =3D ffs(priv->plat->mdio_bus_data->pcs_mask) - 1; - xpcs =3D xpcs_create_mdiodev(priv->mii, addr); - ret =3D PTR_ERR_OR_ZERO(xpcs); - } else { + int ret; + + if (!priv->plat->pcs_init) return 0; - } =20 + ret =3D priv->plat->pcs_init(priv); if (ret) - return dev_err_probe(priv->device, ret, "No xPCS found\n"); - - if (xpcs) - xpcs_config_eee_mult_fact(xpcs, priv->plat->mult_fact_100ns); - - priv->hw->xpcs =3D xpcs; + return dev_err_probe(priv->device, ret, "Failed to initialize PCS\n"); =20 return 0; } @@ -463,14 +442,10 @@ void stmmac_pcs_clean(struct net_device *ndev) { struct stmmac_priv *priv =3D netdev_priv(ndev); =20 - if (priv->plat->pcs_exit) - priv->plat->pcs_exit(priv); - - if (!priv->hw->xpcs) + if (!priv->plat->pcs_exit) return; =20 - xpcs_destroy(priv->hw->xpcs); - priv->hw->xpcs =3D NULL; + priv->plat->pcs_exit(priv); } =20 struct stmmac_clk_rate { --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f11.google.com (mail-pj2-f11.google.com [74.125.227.139]) (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 6095A4A5EA6 for ; Tue, 15 Sep 2026 12:38:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475924; cv=none; b=j8OZdTN/SqnocW1p83Y7rD7OxAWX/6Bmusml6LeqVDeFbnOxZZTPtq8evpIf9QsxPKQ63l9EOa54O56/EwAHf84kzsOEHVLNxnw5vHxSFHDu0EMMh2YPzfNPGZs9mk15aqsBlWvbMsMPIMF8jTE+wGpuLx9Pt0nImTTbHPKUvWs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475924; c=relaxed/simple; bh=RQ8/bIf5S9U/FiX3uQoU1u6/FV6K7LLD2uqZys3J7EY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=moERxPLrZ8E7p3SUnLDHYWzhRmFav+TqHdmbOiXR7IvBsKjjIBW84WDcGQRLurNiukj1u0f/a5aPKdR4CcTzJMUF6SKuEDOGAxLp+3yGqEZW9UcVRZ7+uTSJjbtDVg28aW+AJYdslGf2Nr9vNI2wv+Toet/jiQaXyGTYvCAmlds= 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=i4ePi6Ei; arc=none smtp.client-ip=74.125.227.139 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="i4ePi6Ei" Received: by mail-pj2-f11.google.com with SMTP id 98e67ed59e1d1-398a384b5f7so2726482a91.0 for ; Tue, 15 Sep 2026 05:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475922; x=1790080722; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=v2tJApUzC1LEzp8M/eTL2SHChylQhCDDbwAQQxkGsv0=; b=i4ePi6EiZuKQIKno6E8Jy0usm57JUwIpAqrAkdK5SWf6wvvcvtAeusOc0VU93rpfmW jHgyG5bgqlgYPfjLDrzpODNzPorX/r4A+RiBNaMR+JprP+ortEEhCnrnkvtt0Lbf5FcR pbKGpX7XeGiiPwGsuu+3+vLhNaYy/pKzgF0JG79FSKuKwRRGZixtJ4A3x/8kZiXbKLCf GADU5b9YOdKhQC9xpahqDjIrTdRQNBsGYedp1r4w9I0gcjaje1Nywu03mYJLEOGAjqHy WGoLBwy6O3nn8/7gHPDwnW9i1VnUERfQkao7FZEDlvY4jN1Le2HNwmcMUGfXorMmSxf/ hZYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475922; x=1790080722; h=content-transfer-encoding:mime-version:references:in-reply-to :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=v2tJApUzC1LEzp8M/eTL2SHChylQhCDDbwAQQxkGsv0=; b=tURgSMuS6m4zyMLeeAcNzt6PCDP1G5jn6NmXas7ObB38RprHtrsAU/3g1KAhW+WBVg FSie4bguPnQVZ1z9dtER08i/eyEH5df56bgZ4A5WxR7dJrHXezOO2Qlj8MExTYlUAosG rtex38LNk5QSQX++OyhMWuWYEWRUq+rxAKoNcclcvqZng+JOz4gW46B4YRPK8xd/R5ss 77CUBPSEVIfhP0miSlcHYbOr6XFXKeq/Dx4EMb75b01gXXGDNdd47QZetyyj2wlugICZ nMwx1HSG6Mf7Toeq5v0gnqzY3w/QFYPF8fpQLabazzGmmU0Sb4q6u5VSVKKNLtEE/AL8 OWgQ== X-Forwarded-Encrypted: i=1; AKwUvByHVaJI5MZ0Czq1CpG+I+0hJ94ScAha0IDj3Yp0+BOvse7f8WzPhp6kuTQB3Uv5FV1XBjBJovBJwxcyfbc=@vger.kernel.org X-Gm-Message-State: AFuF++ncqRWlJ7I6ZJEnvmqEbaLeQdMn/HDSzByKAEN7ZI6E9HanxfOp +eLm8B1KHYif9aSOiJunf+Cvnpm9YCTvq7K5mfKlNOBxQ6UvvM6ESTkd X-Gm-Gg: AYBFou0/NqmF0KM4sRAq99dJC4EuLc6b33GuVeHOTaxAM+FyeR5bTqJmuHrD0rLA6VK 5FY0dK7pLWocZ4byla4vrybSE8KaDJj4N+OuqhpwVSfOMHW29Nq/ubLH0tB0SNMOkWMteBjzitU 6ex0k6Bb5lp/gcZZaPuSIgHNa2xaSvTmCJra+xAbMNuiowc/DJRa6UcjjMjhoc7e4rEp9+vNQnJ 0PuRGq31eWGFuVzJpzIuYFp7M/hwm4QijISow6k7GWOOVCsL8I+hVkUyCt7cH3AuAsXW4VJS9SI u9yoeTijo5yX3E3+9LcdJtmPmdPnbnyBlhis4LbFZYMMMwqgxd3sRdzAc3mojQ3cdTixpCL7Gqx c1uYRQQfRRBQ6sreTdupG2dkiCg2+NjpXKyavwdHBVXcNyOW0WkRiSl0aKFIB2SSXRoFhMaUpj/ 1EfKDrWwE8HNl4HR9L0a54WQaEQbAOerF5Zj3mVuIUN/RsPMaCP/pWwiG6ivretZw1JDGPRt9pB nOOtR1H X-Received: by 2002:a17:90b:39cc:b0:39d:e54c:8658 with SMTP id 98e67ed59e1d1-39debf547abmr16493286a91.5.1789475921598; Tue, 15 Sep 2026 05:38:41 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:38:40 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 02/11] dt-bindings: phy: rockchip: naneng-combphy: add rockchip,sgmii-mac-sel property Date: Tue, 15 Sep 2026 20:37:51 +0800 Message-ID: <20260915123802.1561724-3-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On RK3568, the SGMII interface can be routed to either GMAC0 or GMAC1 via the pipe_sgmii_mac_sel bit in the pipe GRF registers. Add the optional "rockchip,sgmii-mac-sel" property to allow the device tree to select which GMAC controller is used for SGMII. The property takes a value of 0 (GMAC0) or 1 (GMAC1). The hardware reset value is 1 (GMAC1), but this can be overridden by setting the property to 0 for boards where SGMII is connected to GMAC0. This is necessary for boards such as the Ariaboard Photonicat, where the SGMII interface is connected to GMAC0 and needs to be explicitly configured. Signed-off-by: Coia Prant --- .../bindings/phy/phy-rockchip-naneng-combphy.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-comb= phy.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combph= y.yaml index 379b08bd9e97a..8e898bce9af73 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combphy.yaml +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combphy.yaml @@ -80,6 +80,15 @@ properties: description: Some additional pipe settings are accessed through GRF regs. =20 + rockchip,sgmii-mac-sel: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + default: 1 + description: + Select gmac0 or gmac1 to be used as SGMII controller. + The hardware reset value is GMAC1 (1). Set this to 0 to route + SGMII to GMAC0. + "#phy-cells": const: 1 =20 @@ -105,6 +114,10 @@ allOf: maxItems: 1 reset-names: maxItems: 1 + rockchip,sgmii-mac-sel: true + else: + properties: + rockchip,sgmii-mac-sel: false - if: properties: compatible: --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f11.google.com (mail-pj2-f11.google.com [74.125.227.139]) (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 38080498927 for ; Tue, 15 Sep 2026 12:38:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475933; cv=none; b=QoilHQ9rACLbBYEMNntzAlFI9fewfW1jjJcKp8iOGIbYd0FAXM0yXjxAkDNJ+c0l7ga28R8gccZtw2oBP1W0nQgLoV/T05zcrVcTMzElen0Xd6/BuJverHxRNeRrSM6HBnXiVnrR0gUsYOne4D3teMLuVjmH/qejlbQHHUoZJq4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475933; c=relaxed/simple; bh=DhaNtgMivv6Vp1qmM9I8vpAHsOLNcVSH8e/G7pgxaGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HqsizN1/wXp8yUW/8pfzC/GYF/61oQ//vjCx4KPOa1YRIdyS0RRV3nHKWO7u2bj1aEq6JDzbzlwSRgUrJwfjEG1ot568QH2s61FuouRT5pxECRcKWfoCmw60+AT6TE7DNJxkxbPT07Li8TJuAjOAZAI+MdkZghJNPAkZdv/2NWE= 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=LE6sCeMy; arc=none smtp.client-ip=74.125.227.139 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="LE6sCeMy" Received: by mail-pj2-f11.google.com with SMTP id 98e67ed59e1d1-398a0a87595so4265858a91.1 for ; Tue, 15 Sep 2026 05:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475930; x=1790080730; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=NfuBhi93xftDhshvbIutU6M31n4jH/ZjDQQ4jx2k6og=; b=LE6sCeMyQvGH+EVad5pAIbbQBN9iWiQZSnR+EaFg5cToaVGy0AvDre8LkzcbPyjlKc 3TuTu5Wa7wsKi363ZSBbu55psj1IaP9S5IqSGt82XrphHKfYpLYcVGk8xSF/s9+Mpxg0 vv5xG8Y0RnIAtSYEj6LYirCHShk0BXiEBmoeq8f9LB9MlZQoz0YdOI1lzxwOJkMfCO9h O6lzgEVTPS+o1eLxG/WrSqwxFgou8mXLAlPRshzFsheKz0tIJM8wvllkwsylJKdut+j2 EGBtfmY6BGfVLs/YT28YELJftANg5oVlDDgpuaCD/AYz3nyQ7MToUR9ILdpWR0ho20n9 iKPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475930; x=1790080730; h=content-transfer-encoding:mime-version:references:in-reply-to :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=NfuBhi93xftDhshvbIutU6M31n4jH/ZjDQQ4jx2k6og=; b=NS8PSXRWnOyfPSvbCewjNv8HL9q5lEVJCM8uxE7ny+Wq72zogeqNr2kEL6ThBcwz3x LdrUZ8JeLIpyxu2uHOx9wzDJCRav/wGbPYLg7J52Jziz1Wci+QAcnKkRRkQWpHtzUryx zcaiZoyFu2uqS7qGayYM34gW0OE4lS3fcRsCbXJDiJGQGW9PqHIJdfXt5f+PZEAL0gtV 7/27DvsABqS/O1hg0LdW3R4PbzCz84MMnEzBgrQCviPkEJR7p2x/goWEPOsxz+KWwIiR QWkyCCNZ7/QWz+4LhV2qzeFjcBx/Q3SGbJ9Fv8tjh5WLox79moEM9toHfM4bf0VO321Z 3MAw== X-Forwarded-Encrypted: i=1; AKwUvBwuIfqV+TGZ4qEw8t9tQnUYX6yChgooyO4IyTg2NCrH5DKiOXE9CFMyQNKYRGnkXxRJnD4rGdMQrzQvwmo=@vger.kernel.org X-Gm-Message-State: AFuF++nQVsa5zV+8Ac9CCNEMePJL/n0Bn8poogdEbDnomXwmZdYYBTCw GgSVcZNfF2WckkgTkgMBRUcdlHKypR9kzfIDVOZZGFICmAU5OkNpOYfc X-Gm-Gg: AYBFou108chSRRtfed1dV2BFzANGUXdthAGz9tCUr5T/60kQTBcA2eRLAwPaRrLs2Pt JMTE6vj6zvhv3cMxR72NPQNew2gV1e91GQXk3gr4AurBokjdePPQTcq2HQVjmsN06ft10b1jVur Q5ngRfjsMwSsiq22Vi9xvZXlnMtibn7vXEcwiEFIR2ACdKVe3gSKWuu3TPXRUaeAT8bGTFXmpoJ 8sM5WLAxQ2QkKNUCV0a8k4Fy0ynQB1BzzogGKJvzgvl2A/VA6XZVVIdK4sgAnkUhgzuY8wwK72f C7X3sbABDs2uupvLLpzNjPNLDJqJXHkqHVQBePnNVT7ZXloHxhX8R2l9ttyRzgUpYAAtl9VMzue wSDf5Wv01isYnCDG/hOLcuJ/ycUL5bZdu2QMovqNr+ILND5/AXHSdl/uVxxeexI5lGsqxcnCcx/ 0oqh0ge0tR+n/2OwNUttxGTwlRlemmEplA7Xra2ZJh+nvoVYpNrzGRQ6Vg1XRHCddK2YKoHA== X-Received: by 2002:a17:90b:4990:b0:39e:ad:d31b with SMTP id 98e67ed59e1d1-39e10e2d518mr1347485a91.6.1789475930366; Tue, 15 Sep 2026 05:38:50 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:38:49 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 03/11] phy: rockchip: naneng-combphy: add SGMII MAC selection for RK3568 Date: Tue, 15 Sep 2026 20:37:52 +0800 Message-ID: <20260915123802.1561724-4-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On RK3568, the SGMII interface can be routed to either GMAC0 or GMAC1 via the GRF register pipe_sgmii_mac_sel. Add support for this selection by introducing the "rockchip,sgmii-mac-sel" DT property. From the RK3568 TRM (Part1, Page 229), the PIPE_GRF_XPCS_CON0 bit 1 (pipe_sgmii_mac_sel) is defined as: 0: SGMII routed to GMAC0 1: SGMII routed to GMAC1 The hardware reset value is 1 (GMAC1). If the property is set to 0, the driver routes SGMII to GMAC0; if set to 1 (or omitted), it remains at GMAC1. This is necessary for boards such as the Ariaboard Photonicat, which uses the SGMII interface connected to GMAC0. Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%= 20Part1%20V1.1-20210301.pdf (Page 229) Signed-off-by: Coia Prant --- drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c b/drivers/p= hy/rockchip/phy-rockchip-naneng-combphy.c index 7843356a4dd47..7b867e7520064 100644 --- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c @@ -186,6 +186,7 @@ struct rockchip_combphy_grfcfg { struct combphy_reg pipe_xpcs_phy_ready; struct combphy_reg pipe_pcie1l0_sel; struct combphy_reg pipe_pcie1l1_sel; + struct combphy_reg pipe_sgmii_mac_sel; struct combphy_reg u3otg0_port_en; struct combphy_reg u3otg1_port_en; }; @@ -212,6 +213,7 @@ struct rockchip_combphy_priv { bool enable_ssc; bool ext_refclk; struct clk *refclk; + u32 sgmii_mac_sel; }; =20 static void rockchip_combphy_updatel(struct rockchip_combphy_priv *priv, @@ -375,6 +377,9 @@ static int rockchip_combphy_parse_dt(struct device *dev= , struct rockchip_combphy =20 priv->ext_refclk =3D device_property_present(dev, "rockchip,ext-refclk"); =20 + priv->sgmii_mac_sel =3D 1; + device_property_read_u32(dev, "rockchip,sgmii-mac-sel", &priv->sgmii_mac_= sel); + priv->phy_rst =3D devm_reset_control_get_exclusive(dev, "phy"); /* fallback to old behaviour */ if (PTR_ERR(priv->phy_rst) =3D=3D -ENOENT) @@ -873,6 +878,8 @@ static int rk3568_combphy_cfg(struct rockchip_combphy_p= riv *priv) break; =20 case PHY_TYPE_SGMII: + rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_sgmii_mac_sel, + priv->sgmii_mac_sel > 0); rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_xpcs_phy_ready, = true); rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_phymode_sel, true= ); rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_sel_qsgmii, true); @@ -984,6 +991,7 @@ static const struct rockchip_combphy_grfcfg rk3568_comb= phy_grfcfgs =3D { .con3_for_sata =3D { 0x000c, 15, 0, 0x00, 0x4407 }, /* pipe-grf */ .pipe_con0_for_sata =3D { 0x0000, 15, 0, 0x00, 0x2220 }, + .pipe_sgmii_mac_sel =3D { 0x0040, 1, 1, 0x00, 0x01 }, .pipe_xpcs_phy_ready =3D { 0x0040, 2, 2, 0x00, 0x01 }, .u3otg0_port_en =3D { 0x0104, 15, 0, 0x0181, 0x1100 }, .u3otg1_port_en =3D { 0x0144, 15, 0, 0x0181, 0x1100 }, --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f10.google.com (mail-pj2-f10.google.com [74.125.227.138]) (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 BD37E4AD7DC for ; Tue, 15 Sep 2026 12:38:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475942; cv=none; b=mfOgHLAsZ6CSGaLU25yNLACamHkRT3Pd3m169d5QJj8k4QpQ6rtlqlmUqe0UXrwpiDbk6stsMymxF6mwHIyR0BwY95hJpkJ311BD7sp2lptW66oMLxU2co8yaADyd/oVCNEpiWPEzaGdXubaBYp4t547iPh2xZApeTZL0EuVIvs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475942; c=relaxed/simple; bh=IdZSPXcFF+gTdOktfdGsPEKUw6gn4MOIdk0sQuimzBk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JWWdE3p2hhY1+qydQcXXB3lLOSoFMIVfBjnoFRmu2BAvX3eukhwJ6hutCDB+AZ7EP8ONMjP6zaU0JybjZzTBnVYm2MRS5ObiY9tyUiqMsIN1itMICxts29qnW1mB2bjduqHYowbQi0Z4JGD7tqXadtjk+wGYCVbqNPhblnrj5CY= 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=OA7OjDcO; arc=none smtp.client-ip=74.125.227.138 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="OA7OjDcO" Received: by mail-pj2-f10.google.com with SMTP id 98e67ed59e1d1-39dba377357so1909841a91.1 for ; Tue, 15 Sep 2026 05:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475939; x=1790080739; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gaQPgN9xwJzuM0GPM5hNVMgAOEuPdKVKWJmnNDeBdbE=; b=OA7OjDcOXs2I37ayw1AYhNnGpp/ar7IYcoNfKjtiQiMy6F7mz6GJYfaQGFjrpmJZXv gabjZ8wSCDQQJzoik4XimD+8luoDYsyPO71v9hbbQGFUqnPX9A9joyES4vahBmNZeb4J R2DmNFigiHfBtsbJn/Rxj8fFXYBS25fvbOWMfb/ebMZjNxt8F8vMX31m/Dy/+2I+X5Zd Wwb4idB+eRMmFPgsz58NnAuj+0MEap55Cw9MpY1w4P/g1iGoJwhw8RJkozAenG3MbTli WpJei/jb4DL+77vNwkzvSq9mB/jJCAbExFVqvOpAWoaSdYSifKo8RY+Ou4ZUCmLuPwwn +ZnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475939; x=1790080739; h=content-transfer-encoding:mime-version:references:in-reply-to :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=gaQPgN9xwJzuM0GPM5hNVMgAOEuPdKVKWJmnNDeBdbE=; b=gM6IRNIMhl7YkGsdlQFxa5haeAlXR6IR0KxnOPNgzkmlmwjouw9jQximJ7EDNI23G4 ujV6Yk7gOeicd9Vd0WwXPD45fVueYYkqXJLDQk7dKGPoFQgApNsxW5UMG/LV7PqeS3vH Ef8t0JRrkCWI3rh4Zxbcl6lroNzmBWaJAKK1DR9uvuTRAi+dOiaK+Pjekbq+soKTMvFb G4YcfPvqf2ngxq4A5oGlWAsyOCUYbS7g+yiAWXw+TPe7SzOVpQWCPNzwUL9WTKmMWA8q Exi9Mhl01cxlA0vCVtZ2LJT2msEvg58L68Ju/UvacmS90hAQz47DREDTygs9m+CzPZzk uo7w== X-Forwarded-Encrypted: i=1; AKwUvByutnaVk9p2lWngkkO45RIxRznShuTWSQe2psNCPXVQhJoaPxuZ9dC31wGZB/Q18xT+hqAiunTp+PqF5wA=@vger.kernel.org X-Gm-Message-State: AFuF++mcaJnCFs3WY1Nuxq+NjSoclrex2+d66D0p/FwVwXzom5M+x06h bfql/oBkRhD2aHhmeF+UHOGDW0udAQ5iD6Ko7QNUnMvqIG1N7OXIIAyn X-Gm-Gg: AYBFou36yUKI0XP+wecB8typ3TQJhp5Z6phEOyX1EkeqWj3J6ibvWPXcokgBhV5ckCL B+JMUcGt7m+YEr5LrDTvUDwiq5Q22gVpVFAQo9Tit77FmW5REKkSGXqEzdgLNOgCz2N1vNajmKP +9rlz9NkIp4cabGVolf3s2ccX2uSQNOJRBK28KO9E77RJ3Mz1nBTUqhqffA33rGIOaY29z/+mKT SORKST3uBFu0ZXwJH9Rxi/93L0kTB0ISs+PtBk//0JWax5QsziHFmhv07EoGkNN4H+tJvlHUM+p skYvV+McQaRGdVZArJzzim3OUWWVOp2v2v8hnMY2kc8qjfAf2HMmgoaknlHkvHLqzaB2QqZXCJB fPkuvMsmP6dBdwzAa6rUxz3UoKO+H6E6lSIeZglNshFI3e2zlL8LqmI+PWftdzHQs120qBRiuUO jCLW5Cy9RTDdE5Oyt3lNpC5Ei1Zua87uU2Sdd4fuR0HTdd9cA9yqGDwQJC3Vg+1G3BAILaqQ== X-Received: by 2002:a17:90b:50c8:b0:39d:f773:37b5 with SMTP id 98e67ed59e1d1-39df7733906mr12070641a91.0.1789475938897; Tue, 15 Sep 2026 05:38:58 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:38:57 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 04/11] dt-bindings: net: pcs: add rockchip,rk3568-xpcs support Date: Tue, 15 Sep 2026 20:37:53 +0800 Message-ID: <20260915123802.1561724-5-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add device tree binding documentation for the Synopsys DesignWare XPCS integrated on the Rockchip RK3568 SoC. The XPCS is accessed over the APB3 bus and internally connected to a Naneng Combo SerDes PHY. It supports 1000BASE-X, SGMII, and QSGMII modes, with four MII ports. Signed-off-by: Coia Prant --- .../net/pcs/rockchip,rk3568-xpcs.yaml | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/pcs/rockchip,rk35= 68-xpcs.yaml diff --git a/Documentation/devicetree/bindings/net/pcs/rockchip,rk3568-xpcs= .yaml b/Documentation/devicetree/bindings/net/pcs/rockchip,rk3568-xpcs.yaml new file mode 100644 index 0000000000000..703fcff0e3f70 --- /dev/null +++ b/Documentation/devicetree/bindings/net/pcs/rockchip,rk3568-xpcs.yaml @@ -0,0 +1,110 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/pcs/rockchip,rk3568-xpcs.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip RK3568 Synopsys DesignWare Ethernet PCS + +maintainers: + - Coia Prant + +description: | + Rockchip RK3568 SoC integrates a Synopsys DesignWare Ethernet Physical + Coding Sublayer (XPCS). + The PCS provides an interface between the Media Access Control (MAC) + and the Physical Medium Attachment (PMA) sublayer through a Media + Independent Interface (GMII). + + The XPCS is accessed over the APB3 bus and internally connected to a + Naneng Combo SerDes PHY. + It supports 1000BASE-X, SGMII and QSGMII modes. + + The block contains four MII ports that can be individually enabled and + routed to one of the Ethernet GMAC controllers via the pcs-handle + property in the MAC device tree node. + +properties: + compatible: + const: rockchip,rk3568-xpcs + + reg: + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + clocks: + items: + - description: APB3 bus interface clock (clk_csr_i), required for re= gister access + - description: EEE clock (clk_eee_i), required for Energy Efficient = Ethernet operation + + clock-names: + items: + - const: csr + - const: eee + + phys: + maxItems: 1 + + phy-names: + const: serdes + + power-domains: + maxItems: 1 + +patternProperties: + "^ethernet-pcs-mii@[0-3]$": + type: object + description: + One of the four MII ports of the XPCS. The port is linked to an + Ethernet MAC controller via the pcs-handle property in the MAC's + device tree node. + + properties: + reg: + description: MII port number. + enum: [0, 1, 2, 3] + + required: + - reg + + additionalProperties: false + +required: + - compatible + - reg + - "#address-cells" + - "#size-cells" + - clocks + - clock-names + - phys + - phy-names + - power-domains + +additionalProperties: false + +examples: + - | + #include + #include + #include + + ethernet-pcs@fda00000 { + compatible =3D "rockchip,rk3568-xpcs"; + reg =3D <0xfda00000 0x200000>; + #address-cells =3D <1>; + #size-cells =3D <0>; + clocks =3D <&cru PCLK_XPCS>, <&cru CLK_XPCS_EEE>; + clock-names =3D "csr", "eee"; + phys =3D <&combphy2 PHY_TYPE_SGMII>; + phy-names =3D "serdes"; + power-domains =3D <&power RK3568_PD_PIPE>; + + ethernet-pcs-mii@0 { + reg =3D <0>; + }; + }; --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f5.google.com (mail-pj2-f5.google.com [74.125.227.133]) (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 6F1E44AF14D for ; Tue, 15 Sep 2026 12:39:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475950; cv=none; b=leGLV07Q/OHJUFyF9/S1WXgv7KO6X9/mQB5op7asItXclj9bXAnnM/DenSqANb+KDzKMYmEQE+6isnBLWKN1ijksx7ntTy2HpAKT4efZhF0PnaCurjC4fXqcRpmQd3IcZqUKFcd4vujlTm8ca0/flDQfHlF0yCP69phaoPjGUOA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475950; c=relaxed/simple; bh=q7Sl/MMSPIpc6WmMgm64X4BAPmv2q5e4+Iz3zCyG3IY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QAdkaE9cHoaXEJkJVCig26ver2um0tBtFvgXnx7oBwt/CP77I1uoO4AH8dl8EfTsiqYQnJftuz0N4dT3OG2zaWbbZFYqXmemibnhQWAj/tUoXlTGaVPshP7eIMPzt6hHBJ6eEQLMIqwhuMJH/DvAIwI7uqmIQd0M6QuKDwOkZkk= 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=Ti19+xmK; arc=none smtp.client-ip=74.125.227.133 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="Ti19+xmK" Received: by mail-pj2-f5.google.com with SMTP id d9443c01a7336-2d942de6574so28155655ad.0 for ; Tue, 15 Sep 2026 05:39:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475948; x=1790080748; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=af5XJnE7hcWtAkVsrU4T0JVcIxPb3Aa/NhPJOVNgxm8=; b=Ti19+xmKTWbiouhKIc0a0XYTn0AgjcrsQuXqcVw015vcOUDDXOnaKaQJLJHv8N2h5X E+aLNjjgXBSPem9PuR3nD/TI1WeCwPGX0h5PzqfZsauK+0+Kb84DlKHzATkknDF+4uGX A7HWUaaXSyK9Lgz4qN6ey/TmFncedpbAzTaiOoALFcngcesCGwxL+W9/TZ+okxeFWEBQ 7ON48rZgjXnw74H/4BfZJQ6vcmAHNJHVv0/d4Z9PkzdKGDBhDv0RVRyRhtIvoYxtXqpV iOZcvgOKLHsFSGVwcEkRXde6JsZZU8QixaOY6xEW1Tj6nQmwRfnE0Ed32vusq77vcMq8 3Dmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475948; x=1790080748; h=content-transfer-encoding:mime-version:references:in-reply-to :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=af5XJnE7hcWtAkVsrU4T0JVcIxPb3Aa/NhPJOVNgxm8=; b=roCnSQfIIowwqjhBq3Uc0Qmp7Lbh7npE+MrV4hzv1wKNQL5z7l9kOfdEew4Wkpdj2X CHVGHhDgpqU23gGBbSozkMc5OjfahXONfFmMAnxaTkt6z3G+stuMl4IFrXo64fEdsnNt YoA9in87akK8wTKWglsSRgVla1ODZVyO0Bc21CvPNedHD/wCbCQoq2mA3IFYBgzsv7u7 CryZbYBRcyZv6QgMjxYHS0Vw2JeuYg8VFcTrK0GZPKDzQQiHQsZe9qV4w6t/fVehsoDq lxpXmJEnyuz0DadfM/arOsbq0JzCifowMlTLUr35A+qDfyD6o6H3MAlJpDASxOBKRiM9 x6vQ== X-Forwarded-Encrypted: i=1; AKwUvBylJRV8EI5zBn1qvNSmI5PQLMGqOH280BUi7a5EovvYD1YJDkWsa437NvVZRU5O21PDT9XNtXNVMSA0224=@vger.kernel.org X-Gm-Message-State: AFuF++nbiInY4ctJp1+v1oPHskcW8HouRTorLntrNL2tKzxFxkvBUIp6 rWi9FI2fDTqBj0iKa+E8cz5oWRAAXotxLuwqqyvD94v/WOXvgwv/M0Ga X-Gm-Gg: AYBFou0deReoUAHTRhCzbGBcT+woj5KyCh+BY4VRdDdbC0qnYQ9rW1iqhCD/xBmn0YZ +Q9+4dbGMxd8voiKzSpiE7zbUN9UaOf9qGSkDcBW/ZDYFBzc/Rag+XO+3ToPNdOoW22k0oIUwhr V9tEp+BkFHu/ftcvjW7ScQXG+skMDwELXj481THCeg+ZaGw8Q9aCwE4ESVjLc5zOPPlRcpiWqoy ARQu/pHMzf4AvwEJHmDHgRo4oiIEXk6xyVWuZ7tPY8Ru53WKlEcNeqmcKB3+GGKSLKhQylCjGnl 8Ivl5XTcrnKCGcCt5LFv7m1SuC5WT6hWvDBkdvf6ly15efpZvBXCYbDB7cgPF5fESRZV6o1lsvP uGIfXkaOdgyopw/ug4JaNlGJXkMoztvjLjwDTh4kp0AqY4GdZuQtfFToOgoK4chyzGUU5Ab5Mlz 0I5qu0lfHV+6BC8gd/VRHu9sq0ZxgKwu1RmHtuxdrzwE5NNix95DywKqOwhCfnLW97j9BGuA== X-Received: by 2002:a17:90b:440b:b0:39d:e784:3e1c with SMTP id 98e67ed59e1d1-39dec0f7193mr14930029a91.19.1789475947417; Tue, 15 Sep 2026 05:39:07 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.38.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:39:06 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 05/11] arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes Date: Tue, 15 Sep 2026 20:37:54 +0800 Message-ID: <20260915123802.1561724-6-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RK3568 SoC integrates a Synopsys DesignWare XPCS that provides the Physical Coding Sublayer for 1000BASE-X, SGMII, and QSGMII interfaces via its four MII ports. Add the XPCS device node and its pcs-mii sub-nodes to the SoC device tree. The XPCS device is accessed via the APB3 bus at 0xfda00000 and requires the CSR clock (PCLK_XPCS) for register access and the EEE clock (CLK_XPCS_EEE) for Energy Efficient Ethernet operation. The PD_PIPE power domain must be enabled before any register access. Also add two fixed-clock nodes (xpcs_gmac0_clk and xpcs_gmac1_clk) providing the 125 MHz reference clock for the GMACs when operating with XPCS. These clocks are used as the assigned-clock-parents for the respective GMAC nodes in board-level device trees. The XPCS node and its pcs-mii sub-nodes are disabled by default and must be enabled at the board level when 1000BASE-X/SGMII/QSGMII is in use. The fixed-clock nodes are always present and do not have a status property, as they are static clock sources. The XPCS node also requires a reference to the appropriate Naneng Combo PHY via the phys property at the board level. Signed-off-by: Coia Prant --- arch/arm64/boot/dts/rockchip/rk3568.dtsi | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3568.dtsi b/arch/arm64/boot/dts= /rockchip/rk3568.dtsi index 3bc653f027f1f..227d03e336043 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi @@ -110,6 +110,51 @@ sata0: sata@fc000000 { status =3D "disabled"; }; =20 + xpcs: ethernet-pcs@fda00000 { + compatible =3D "rockchip,rk3568-xpcs"; + #address-cells =3D <1>; + #size-cells =3D <0>; + reg =3D <0x0 0xfda00000 0x0 0x200000>; + clocks =3D <&cru PCLK_XPCS>, <&cru CLK_XPCS_EEE>; + clock-names =3D "csr", "eee"; + power-domains =3D <&power RK3568_PD_PIPE>; + status =3D "disabled"; + + xpcs_mii0: ethernet-pcs-mii@0 { + reg =3D <0>; + status =3D "disabled"; + }; + + xpcs_mii1: ethernet-pcs-mii@1 { + reg =3D <1>; + status =3D "disabled"; + }; + + xpcs_mii2: ethernet-pcs-mii@2 { + reg =3D <2>; + status =3D "disabled"; + }; + + xpcs_mii3: ethernet-pcs-mii@3 { + reg =3D <3>; + status =3D "disabled"; + }; + }; + + clk_gmac0_xpcs_mii: clock-xpcs-gmac0 { + compatible =3D "fixed-clock"; + clock-frequency =3D <125000000>; + clock-output-names =3D "clk_gmac0_xpcs_mii"; + #clock-cells =3D <0>; + }; + + clk_gmac1_xpcs_mii: clock-xpcs-gmac1 { + compatible =3D "fixed-clock"; + clock-frequency =3D <125000000>; + clock-output-names =3D "clk_gmac1_xpcs_mii"; + #clock-cells =3D <0>; + }; + pipe_phy_grf0: syscon@fdc70000 { compatible =3D "rockchip,rk3568-pipe-phy-grf", "syscon"; reg =3D <0x0 0xfdc70000 0x0 0x1000>; --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 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 95C5F4756D5 for ; Tue, 15 Sep 2026 12:39:17 +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=1789475959; cv=none; b=iUXjAd1RU5kHVxMbXshHIAZiJ5fn7XviBa6aWyBrY2rVEIyKavTXf5ttHUaK717uovQwGHOBCylUgAP07l7OtCfy5y28f+xhHDpvegAkTlV2bQPIKSm6qHLeTt8XDFjGaIzbUSfWr+Z6kkX/UgZjEszafVFGNJjqRlg01qJMx18= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475959; c=relaxed/simple; bh=rn553Ps3qysqjj0bF2NRCTgDBT8uYIS5tlYEIlbEX3o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cL4nr2+rEsTGb7YTIY/flpGV4CBwEKOmscp5aAmu2pGClSXv/21cVa/axruqyUAaMskvD3kN4Woj8M2ujSdoXbTlAY7kBWxNOhJSmQ4wmN/o84mCj5x98ghFpUR1UryJSD6sCkotzMVha/O2E96JOQonzOuQD5K48qsSyxCOlHM= 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=VV3tWDT/; 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="VV3tWDT/" Received: by mail-pj2-f3.google.com with SMTP id 98e67ed59e1d1-3859292bb51so247640a91.1 for ; Tue, 15 Sep 2026 05:39:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475956; x=1790080756; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Yjmztt9FS1A5qxNaZfWYg6PvzN0Znz9LRYwH9/qf2Qg=; b=VV3tWDT/Be8zKTKBBtaT6I6Lri4lQUDNveGX7SkKh8BQKvDjVqPLHrnTJUeXax/RIw kfhyYEgVV9BGpBURUTH2ixxuEoPQTMQacKt6p9oaBFdnc9zkA4hGZ9CggqOCV9gl1b8v ESU1+AhLPb49f/l1w2hA+4Yfj9veS2kSmatsw5mn79gZMBgJSLWq9hdCkW7Mb2/r1mzG euXxotylDqlZXH9XkJrpSjMpm/oH2WVA9TWt81FcCtZeIp3pqSCFu6NNs8syJQ9WNpLm qTanwrzwZqvMu7H0FT5eAsfc6S1zBoHicRNExSbB4km6ntLl/D3NSpjwfDQCBDcjMJRR R4nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475956; x=1790080756; h=content-transfer-encoding:mime-version:references:in-reply-to :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=Yjmztt9FS1A5qxNaZfWYg6PvzN0Znz9LRYwH9/qf2Qg=; b=faP+CQc3kOQN6/3TYl0G+h1yOLOn55dJ9jDpDJ4mVylbY10G0PfxmqP0AcX8rwwvng cwrFrf1CGl4SbqksSSsHRIoFsMhDKgY9V27Qrs8cd7lgIYl4WLnJ6eKkOKzc9Q5514UV z2XzblEfjACVFF66dOvxAnpvvRZ3nfETZM3d0adtzBkKosARBVobM4Lezsm3hASYgabP rX2vt4MkDrVc6cL0pv5D3rDpjywLGx48kEj3Nw88FaqZDFed1X9ps/7fZxerOCHfjhZz Go24Ft0J01lOn9Us4zmEsGrNpQ97OEtH8KA2MgoxtwZjHz2H+CvXFqXfGM8teWPjauWX mCPA== X-Forwarded-Encrypted: i=1; AKwUvByNK+DCyrVyQO2LkKV4Bv9kJ5l0u7dmnmKkOgPA+IoPI1tH/de5fkjmOnp2glp1Y5ElbsyhFXhczkm1WAc=@vger.kernel.org X-Gm-Message-State: AFuF++m1yLNqnOmzW8d8Kx78vYz5sdUMAuj+xjIqAQRiG22wol9w/PPh dbnXPbg6r1NbxkhQZgfTj1lu4AYp4cXXl//rkNOC5xFbSCHIgRKuzCV6 X-Gm-Gg: AYBFou0u9UEMjqGglbHUO6iHvsJwRJLvB8pPquUvQ6qGkggEjh1eNVMqtQLiQuNnhMH 0SH2Pdnj8NU7f0FbpXA0vYsL1HoR/LuCiOXD1Xuxn+GgIhHGsU7sb1WKPdotpqNRMEdAetsXuPd rpM/F/43ShwutiNHd1wYo+Wda+UEfcWmb7iRoKZTOogdss1mLc6bDfCnQBtXLp7LV6qMeSawQBu QnnyHsbAh8wSi8RnqnYG4IrZIkjVQ181gmHNzwRYJu0VuhrRhjHRhIKpw0V7tDlLlbd8NfqvFVJ WcoCcgngyKUpBaha+rxPUr/9GRrLh7z46TluqOWbSD3uqrGC3CeEOdk13HiUectoJAO2cZ4CfoD tMa0Jcwj5yw60rHgtHEXjiuDLD8OU+ixT08hscLR7S19Hr/a/FgjrIVO2knC+bGar7oKMkai5Lg HihgukpsaGsBCOaRgRhDHG0YPbu1pOmI6Hhr3cZNKp4ROtUiROfkB3dpH4c/L22AL8co7MAw== X-Received: by 2002:a17:90b:498e:b0:39d:feca:f48d with SMTP id 98e67ed59e1d1-39dfecaf6bfmr3959422a91.3.1789475956259; Tue, 15 Sep 2026 05:39:16 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:39:15 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org, Jiawen Wu Subject: [PATCH net-next v6 06/11] net: pcs: xpcs: add ANRESTART support for SGMII link recovery Date: Tue, 15 Sep 2026 20:37:55 +0800 Message-ID: <20260915123802.1561724-7-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On some hardware using the DesignWare XPCS IP (e.g., RK3568 MAC side SGMII), the PCS does not automatically restart auto-negotiation when the link goes down and comes back up. Without an explicit ANRESTART, the link stays down forever. Add BMCR_ANRESTART in two places: 1. In xpcs_config_aneg_c37_sgmii(), when starting AN, set ANRESTART alongside ANENABLE to initiate a fresh negotiation. 2. In xpcs_get_state_c37_sgmii(), when link is down and AN completion is detected, clear the interrupt and trigger ANRESTART to restart the negotiation process. Propagate the return value of the restart so errors are not silently ignored. Also clear DW_VR_MII_AN_INTR_STS in xpcs_config_aneg_c37_sgmii() before starting AN, matching what xpcs_config_aneg_c37_1000basex() already does. On the non-inband path the function now returns the result of that write instead of the DIG_CTRL1 modify. Update the comment in xpcs_config_aneg_c37_sgmii() to note that although the DesignWare databook says AN restart is not needed for MAC side SGMII, some implementations (e.g. Rockchip RK3568) require it to recover the link after a disconnect. This is not a fix for an existing mainline platform: the affected platform (RK3568 XPCS) is introduced later in the same series. Tested-by: Jiawen Wu Tested-by: Maxime Chevallier Signed-off-by: Coia Prant --- drivers/net/pcs/pcs-xpcs.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 0337e2bcc0125..8c3875b6985b9 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -761,7 +761,9 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *x= pcs, * DW xPCS used with DW EQoS MAC is always MAC side SGMII. * 4) VR_MII_DIG_CTRL1 Bit(9) [MAC_AUTO_SW] =3D 1b (Automatic * speed/duplex mode change by HW after SGMII AN complete) - * 5) VR_MII_MMD_CTRL Bit(12) [AN_ENABLE] =3D 1b (Enable SGMII AN) + * 5) VR_MII_AN_INTR_STS =3D 0x0 (Clear CL37 AN complete status) + * 6) VR_MII_MMD_CTRL Bit(12) [AN_ENABLE] =3D 1b (Enable SGMII AN) + * VR_MII_MMD_CTRL Bit(9) [AN_RESTART] =3D 1b (Restart SGMII AN) * * Note that VR_MII_MMD_CTRL is MII_BMCR. * @@ -769,7 +771,14 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *= xpcs, * SR_MII_AN_ADV. MAC side SGMII receives AN Tx Config from * PHY about the link state change after C28 AN is completed * between PHY and Link Partner. There is also no need to - * trigger AN restart for MAC-side SGMII. + * trigger AN restart for MAC-side SGMII on most devices. + * + * Note: While the DesignWare databook states that AN restart is + * not needed for MAC side SGMII, some implementations (e.g. + * Rockchip RK3568) exhibit a timing quirk when integrated with + * phylink and do not restart AN automatically when the link + * comes back up. An explicit AN restart is required on those + * parts to recover the link after a disconnect. */ mdio_ctrl =3D xpcs_read(xpcs, MDIO_MMD_VEND2, MII_BMCR); if (mdio_ctrl < 0) @@ -816,9 +825,14 @@ static int xpcs_config_aneg_c37_sgmii(struct dw_xpcs *= xpcs, if (ret < 0) return ret; =20 + /* Clear CL37 AN complete status */ + ret =3D xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS, 0); + if (ret < 0) + return ret; + if (neg_mode =3D=3D PHYLINK_PCS_NEG_INBAND_ENABLED) ret =3D xpcs_write(xpcs, MDIO_MMD_VEND2, MII_BMCR, - mdio_ctrl | BMCR_ANENABLE); + mdio_ctrl | BMCR_ANENABLE | BMCR_ANRESTART); =20 return ret; } @@ -1093,9 +1107,18 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs *= xpcs, return 0; } =20 - /* Clear AN complete status or interrupt */ - if (state->an_complete) - xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS, 0); + if (state->an_complete) { + /* Clear AN complete status or interrupt */ + ret =3D xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS, 0); + if (ret < 0) + return ret; + + /* Initiate the next round of AN */ + ret =3D xpcs_modify(xpcs, MDIO_MMD_VEND2, MII_BMCR, BMCR_ANRESTART, + BMCR_ANRESTART); + if (ret < 0) + return ret; + } =20 return 0; } --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f1.google.com (mail-pj2-f1.google.com [74.125.227.129]) (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 D519E4A8FE3 for ; Tue, 15 Sep 2026 12:39:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.129 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475968; cv=none; b=diUD89V9rglp8xEEa9QvHZoITgOKfmPDIdK+6LVR8mH1rZu2UGdIyAtwxLK3XUJWfH2i2HGds2GGq/uE6nIfcLrz4+6CMZtGoPZXzL/y2zBR37ulHiAZg46TehN77QP2p02OnAtIQCqFsP8U0T0GCj7M9PIjJ/z9fyt0JK32hY8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475968; c=relaxed/simple; bh=B6PEk7DnOOXHh0hzWl0+TtNzwV+5PfBzFQmmZ870LuI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VH392oBU5chfPhEsBnCh20wR64piMtPaIPellxQ7OdHIjZAGkbIkatWX08zHTMXkTn8vzgZ9vPKNDBPG3yrVYGYrD40YKLlKkSYKN6q6Ug4S7w6/YO720BrfBl6XM2pKYOmj4/IN4VWp3wBHoJWHziXfVT/PWngyLcF1ms3n/Xo= 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=aKeRNNDn; arc=none smtp.client-ip=74.125.227.129 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="aKeRNNDn" Received: by mail-pj2-f1.google.com with SMTP id 98e67ed59e1d1-383390e7584so185506a91.0 for ; Tue, 15 Sep 2026 05:39:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475965; x=1790080765; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3v/cbY5V2kM2Lzkdh3bccEp63koHm/ZU+mjUmSl+SXA=; b=aKeRNNDnmIrfmbRSskgF/tzT/Ez0ynV6E1RItjO8CzKPVPkRAN773T28EYHgkb2bEY t68gp0bphIUpMnbwEeS+FC+kp7k+PyrU4mjISurUPU4+scRPQD8kcCoKpEBfG5CLNDH4 tw/z3Mx/VltEHQMfv+8Ge7YPHr1B4Hi9YCiP29y8Uv/5fdaXHZflZI7TRqZ3wl+DQLiG BtsY17rYTi6eqetaJMl60IROSb+oytmPopy2Ly7DoMrraRUcCkolyUEzdAhsuUsM7Cxq gCuikutpBrjNtZdTMtrBTO3fJLXYqHw3CfxTnt2PzcNs8O5Ju8G+DADGLI0cqX2OT7U0 l/gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475965; x=1790080765; h=content-transfer-encoding:mime-version:references:in-reply-to :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=3v/cbY5V2kM2Lzkdh3bccEp63koHm/ZU+mjUmSl+SXA=; b=MFicdLmZtYRQWwe14JD7eNzStMuxfVgAtVmebXY1fsEvSERPjuLewMYNU07EqhKWUc vAMj7BxrE6tgeath9NpHoDKaAPsKgIJ6bCnrgfEs84kH0mhjNm6zlKvd4+H5R0rFvsVv kXWNSIVy9Try5kw/VXPRoQcCNDWeenCa4bs68SzQWYJysUJOoyky9ABO6PPzUAPEmj+p ROVTPPq2BbTsZ/DDLfxhw1loe4SIuWJfIOGQmVFbsj+o7Z/HkYiKxI4nQVHBDpxZ8gkX JhEM1toZyiOrfsPp/dMRXPwiZrrCrolKlPvyR52pNWHE88U3s/DdF343rQZ/pPDnzGX6 I8Dg== X-Forwarded-Encrypted: i=1; AKwUvBxLdWXfYIkBrleui/q0OHilyXpiCUGv3onYShkLZx0ENTBozwOjHhM/yrsk5IJ5BJwfippmNpw3BYQXVCw=@vger.kernel.org X-Gm-Message-State: AFuF++n3gtQDAt4s4hFUi8iDOTydi0VQOx4AkeSCxsYThOaGx0x9F92e tw/F7reyNvZ41ESznEo8anZ4YBSiv9doQ5EXujOI3ItqjGnubCGEXGqo X-Gm-Gg: AYBFou1GmqyhWJFWhij7p3ejU2YKv+8bxghELq8e/1aabgpIue5Db7mULmsk5MM7+kg /fkPAJXocjeWNqhDoilGb+5o6Tax53waY4HOjVLRaZhNcKM/Tk7UV2HGOYJ2X465i9vspUCFJK+ 19rBNmu9Sp5V3a1drUSQGq/Eix4buDsTdJwgGQ95B0BE5XtShnTxr8fSQmjMuDt4qEb2Yd3oj1h 5L25T77ySAp+L5n27IASwalEasp4d5iODhzSIplyNXTF2uTcTgZaijKbok0OV3keby/OCr2dyzK pnajuSDsxLdr2fFY55xSlrMcNkVcL1aDR6Lc2fYJ9a/jNFXx0bQQZJQ1UJ3vZoRRKiM4CIgVKp+ uMDcW9+lP3ABnerAvWzN/iZNuulm/JLa267MmTKgD4MlewFzzuq5o2YbqgawQGauCrT+TNwDkAb BYdN9PIcmd1Ij30cQjNZhZnAQSIucIH+17t6JJT9Z+u9FuCkU/Rg4sCl67oAzEXPV8AMWuIw== X-Received: by 2002:a17:90b:4d84:b0:39e:b2e:a6f4 with SMTP id 98e67ed59e1d1-39e0b2ea756mr1391825a91.4.1789475965067; Tue, 15 Sep 2026 05:39:25 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.39.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:39:23 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 07/11] net: pcs: xpcs: add Rockchip RK3568 platform glue driver Date: Tue, 15 Sep 2026 20:37:56 +0800 Message-ID: <20260915123802.1561724-8-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RK3568 SoC integrates a Synopsys DesignWare XPCS that is accessed via APB3 memory-mapped registers. This driver provides the glue logic to make the XPCS accessible to the generic pcs-xpcs core. The XPCS block contains four MII ports (0..3), each of which can be routed to GMAC0 or GMAC1 via the pcs-handle property in the MAC node. The hardware maps these ports to different MMDs: - port 0: MMD 7 (ROCKCHIP_MMD_MII) - port 1: MMD 2 (ROCKCHIP_MMD_MII1) - port 2: MMD 3 (ROCKCHIP_MMD_MII2) - port 3: MMD 4 (ROCKCHIP_MMD_MII3) This driver creates a virtual MDIO bus that translates MDIO operations to APB3 register accesses, with proper address remapping for each port. The generic xpcs driver then creates a phylink_pcs instance on top of this bus, allowing the MAC to use the PCS via the standard phylink API. The generic XPCS platform glue (pcs-xpcs-plat.o) is split out of the pcs_xpcs composite object into its own module, gated behind the new PCS_XPCS_PLATFORM symbol. The symbol defaults to PCS_XPCS, so existing configurations keep the snps,dw-xpcs platform glue enabled without any change. The EEE multiplier is derived at runtime from the EEE clock rate instead of being hardcoded, because the clock is muxed between gpll200 (200 MHz) and cpll125 (125 MHz) and can be changed by the board or firmware. A 64-bit intermediate avoids overflow on 32-bit builds, and the result is clamped to the 4-bit DW_VR_MII_EEE_MULT_FACT_100NS field. Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%= 20Part1%20V1.1-20210301.pdf (Page 59, CRU_CLKSEL_CON29) Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%= 20Part2%20V1.1-20210301.pdf (Page 2078) Signed-off-by: Coia Prant --- drivers/net/pcs/Kconfig | 25 ++ drivers/net/pcs/Makefile | 5 +- drivers/net/pcs/pcs-xpcs-rk.c | 573 ++++++++++++++++++++++++++++++++ include/linux/pcs/pcs-xpcs-rk.h | 11 + 4 files changed, 612 insertions(+), 2 deletions(-) create mode 100644 drivers/net/pcs/pcs-xpcs-rk.c create mode 100644 include/linux/pcs/pcs-xpcs-rk.h diff --git a/drivers/net/pcs/Kconfig b/drivers/net/pcs/Kconfig index e417fd66f660a..3db9b343ac0c7 100644 --- a/drivers/net/pcs/Kconfig +++ b/drivers/net/pcs/Kconfig @@ -12,6 +12,31 @@ config PCS_XPCS This module provides a driver and helper functions for Synopsys DesignWare XPCS controllers. =20 +if PCS_XPCS + +config PCS_XPCS_PLATFORM + tristate "Generic XPCS controller support" + default PCS_XPCS + help + Generic DWXPCS driver for platforms that don't require any + platform specific code to function or is using platform + data for setup. + + If you have a controller with this interface, say Y or M here. + +config PCS_XPCS_ROCKCHIP + tristate "Rockchip XPCS controller support" + default ARCH_ROCKCHIP + depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST) + select GENERIC_PHY + select PM_GENERIC_DOMAINS + help + Support for XPCS controller on Rockchip RK356x SoC. + + If you have a Rockchip SoC with this interface, say Y or M here. + +endif # PCS_XPCS + config PCS_LYNX tristate help diff --git a/drivers/net/pcs/Makefile b/drivers/net/pcs/Makefile index 4f7920618b900..f9f6cf2578d72 100644 --- a/drivers/net/pcs/Makefile +++ b/drivers/net/pcs/Makefile @@ -1,10 +1,11 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for Linux PCS drivers =20 -pcs_xpcs-$(CONFIG_PCS_XPCS) :=3D pcs-xpcs.o pcs-xpcs-plat.o \ - pcs-xpcs-nxp.o pcs-xpcs-wx.o +pcs_xpcs-$(CONFIG_PCS_XPCS) :=3D pcs-xpcs.o pcs-xpcs-nxp.o pcs-xpcs-wx.o =20 obj-$(CONFIG_PCS_XPCS) +=3D pcs_xpcs.o +obj-$(CONFIG_PCS_XPCS_PLATFORM) +=3D pcs-xpcs-plat.o +obj-$(CONFIG_PCS_XPCS_ROCKCHIP) +=3D pcs-xpcs-rk.o obj-$(CONFIG_PCS_LYNX) +=3D pcs-lynx.o obj-$(CONFIG_PCS_MTK_LYNXI) +=3D pcs-mtk-lynxi.o obj-$(CONFIG_PCS_RZN1_MIIC) +=3D pcs-rzn1-miic.o diff --git a/drivers/net/pcs/pcs-xpcs-rk.c b/drivers/net/pcs/pcs-xpcs-rk.c new file mode 100644 index 0000000000000..d5e0f22c973c2 --- /dev/null +++ b/drivers/net/pcs/pcs-xpcs-rk.c @@ -0,0 +1,573 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Rockchip XPCS platform device driver + * + * Based on the Synopsys DesignWare XPCS platform driver. + * Copyright (C) 2024 Serge Semin + * + * Adapted for Rockchip SoCs, with reference to the Rockchip OEM driver. + * Copyright (C) 2026 Coia Prant + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pcs-xpcs.h" + +struct dw_xpcs_rk { + struct platform_device *pdev; + struct mii_bus *bus; + void __iomem *reg_base; + struct phy *serdes_phy; + struct clk *csr_clk; + struct clk *eee_clk; + u8 eee_mult_fact; +}; + +static ptrdiff_t xpcs_rk_addr_format(int dev, int reg) +{ + return FIELD_PREP(0x70000, dev) | FIELD_PREP(0xffff, reg); +} + +static int xpcs_rk_read_reg(struct dw_xpcs_rk *pxpcs, int dev, int reg) +{ + ptrdiff_t csr; + int ret; + + csr =3D xpcs_rk_addr_format(dev, reg); + + ret =3D pm_runtime_resume_and_get(&pxpcs->pdev->dev); + if (ret) + return ret; + + ret =3D readl(pxpcs->reg_base + (csr << 2)) & 0xffff; + + pm_runtime_put(&pxpcs->pdev->dev); + return ret; +} + +static int xpcs_rk_write_reg(struct dw_xpcs_rk *pxpcs, int dev, int reg, u= 16 val) +{ + ptrdiff_t csr; + int ret; + + csr =3D xpcs_rk_addr_format(dev, reg); + + ret =3D pm_runtime_resume_and_get(&pxpcs->pdev->dev); + if (ret) + return ret; + + writel(val, pxpcs->reg_base + (csr << 2)); + + pm_runtime_put(&pxpcs->pdev->dev); + return 0; +} + +#define ROCKCHIP_MMD_MII1 2 +#define ROCKCHIP_MMD_MII2 3 +#define ROCKCHIP_MMD_MII3 4 +#define ROCKCHIP_MMD_PMAPMD 6 +#define ROCKCHIP_MMD_MII 7 + +static bool xpcs_rk_mdio_addr_validate(int addr) +{ + return !(addr < 0 || addr > 3); +} + +static int xpcs_rk_mdio_read_remapping(int addr, int dev, int reg) +{ + switch (dev) { + case MDIO_MMD_PMAPMD: + return ROCKCHIP_MMD_PMAPMD; + case MDIO_MMD_VEND2: + break; + default: + return -ENXIO; + } + + /* + * Reads are redirected by hardware to the port's read-only mirror; + * only writes have to be targeted at MII (see the write path). + */ + switch (addr) { + case 0: + return ROCKCHIP_MMD_MII; + case 1: + return ROCKCHIP_MMD_MII1; + case 2: + return ROCKCHIP_MMD_MII2; + case 3: + return ROCKCHIP_MMD_MII3; + default: + return -ENODEV; + } +} + +static int xpcs_rk_mdio_write_remapping(int addr, int dev, int reg) +{ + switch (dev) { + case MDIO_MMD_PMAPMD: + return ROCKCHIP_MMD_PMAPMD; + case MDIO_MMD_VEND2: + break; + default: + return -ENXIO; + } + + /* + * These registers physically live only in MII (the management port). + * Ports 1-3 expose read-only mirrors of these bits, so writes must + * always target MII; the read path remaps per address and the + * hardware redirects to the port's mirror. + */ + switch (reg) { + case DW_VR_MII_AN_CTRL: + case DW_VR_MII_AN_INTR_STS: + case DW_VR_MII_EEE_MCTRL0: + case DW_VR_MII_EEE_MCTRL1: + case DW_VR_MII_DIG_CTRL2: + return ROCKCHIP_MMD_MII; + default: + break; + } + + switch (addr) { + case 0: + return ROCKCHIP_MMD_MII; + case 1: + return ROCKCHIP_MMD_MII1; + case 2: + return ROCKCHIP_MMD_MII2; + case 3: + return ROCKCHIP_MMD_MII3; + default: + return -ENODEV; + } +} + +static int xpcs_rk_read_c22(struct mii_bus *bus, int addr, int reg) +{ + struct dw_xpcs_rk *pxpcs =3D bus->priv; + int dev; + + if (!xpcs_rk_mdio_addr_validate(addr)) + return -ENODEV; + + dev =3D xpcs_rk_mdio_read_remapping(addr, MDIO_MMD_VEND2, reg); + if (dev < 0) + return 0xffff; + + return xpcs_rk_read_reg(pxpcs, dev, reg); +} + +static int xpcs_rk_write_c22(struct mii_bus *bus, int addr, int reg, u16 v= al) +{ + struct dw_xpcs_rk *pxpcs =3D bus->priv; + int dev; + + if (!xpcs_rk_mdio_addr_validate(addr)) + return -ENODEV; + + dev =3D xpcs_rk_mdio_write_remapping(addr, MDIO_MMD_VEND2, reg); + if (dev < 0) + return 0; + + return xpcs_rk_write_reg(pxpcs, dev, reg, val); +} + +static int xpcs_rk_read_c45(struct mii_bus *bus, int addr, int dev, int re= g) +{ + struct dw_xpcs_rk *pxpcs =3D bus->priv; + + if (!xpcs_rk_mdio_addr_validate(addr)) + return -ENODEV; + + dev =3D xpcs_rk_mdio_read_remapping(addr, dev, reg); + if (dev < 0) + return 0xffff; + + return xpcs_rk_read_reg(pxpcs, dev, reg); +} + +static int xpcs_rk_write_c45(struct mii_bus *bus, int addr, int dev, int r= eg, u16 val) +{ + struct dw_xpcs_rk *pxpcs =3D bus->priv; + + if (!xpcs_rk_mdio_addr_validate(addr)) + return -ENODEV; + + dev =3D xpcs_rk_mdio_write_remapping(addr, dev, reg); + if (dev < 0) + return 0; + + return xpcs_rk_write_reg(pxpcs, dev, reg, val); +} + +static struct dw_xpcs_rk *xpcs_rk_create_data(struct platform_device *pdev) +{ + struct dw_xpcs_rk *pxpcs; + + pxpcs =3D devm_kzalloc(&pdev->dev, sizeof(*pxpcs), GFP_KERNEL); + if (!pxpcs) + return ERR_PTR(-ENOMEM); + + pxpcs->pdev =3D pdev; + + dev_set_drvdata(&pdev->dev, pxpcs); + + return pxpcs; +} + +static int xpcs_rk_serdes_phy_init(struct dw_xpcs_rk *pxpcs) +{ + struct device *dev =3D &pxpcs->pdev->dev; + + pxpcs->serdes_phy =3D devm_phy_get(dev, "serdes"); + if (IS_ERR(pxpcs->serdes_phy)) + return dev_err_probe(dev, PTR_ERR(pxpcs->serdes_phy), + "Failed to get SerDes PHY\n"); + + return 0; +} + +static void xpcs_rk_serdes_phy_poweroff(void *data) +{ + struct dw_xpcs_rk *pxpcs =3D data; + struct device *dev =3D &pxpcs->pdev->dev; + + phy_power_off(pxpcs->serdes_phy); + phy_exit(pxpcs->serdes_phy); + + dev_pm_genpd_rpm_always_on(dev, false); +} + +static int xpcs_rk_serdes_phy_poweron(struct dw_xpcs_rk *pxpcs) +{ + struct device *dev =3D &pxpcs->pdev->dev; + int ret; + + /* + * The power domain is required and must be enabled, which allows us to + * dynamically turn the CSR clock on/off using PM while keeping the PCS + * powered on. + */ + ret =3D dev_pm_genpd_rpm_always_on(dev, true); + if (ret) { + dev_err(dev, "Failed to power on power-domains\n"); + return ret; + } + + ret =3D phy_init(pxpcs->serdes_phy); + if (ret) { + dev_err(dev, "Failed to init SerDes PHY\n"); + goto pm_domain; + } + + ret =3D phy_power_on(pxpcs->serdes_phy); + if (ret) { + dev_err(dev, "Failed to power on SerDes PHY\n"); + goto serdes_phy; + } + + ret =3D devm_add_action_or_reset(dev, xpcs_rk_serdes_phy_poweroff, pxpcs); + if (ret) { + dev_err(dev, "Failed to register devm for SerDes PHY: %d\n", ret); + return ret; + } + + return 0; + +serdes_phy: + phy_exit(pxpcs->serdes_phy); +pm_domain: + dev_pm_genpd_rpm_always_on(dev, false); + return ret; +} + +static int xpcs_rk_init_res(struct dw_xpcs_rk *pxpcs) +{ + struct platform_device *pdev =3D pxpcs->pdev; + struct device *dev =3D &pdev->dev; + struct resource *res; + + res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) { + dev_err(dev, "No reg-space found\n"); + return -EINVAL; + } + + if (resource_size(res) < SZ_2M) { + dev_err(dev, "Invalid reg-space size\n"); + return -EINVAL; + } + + pxpcs->reg_base =3D devm_ioremap_resource(dev, res); + if (IS_ERR(pxpcs->reg_base)) { + dev_err(dev, "Failed to map reg-space\n"); + return PTR_ERR(pxpcs->reg_base); + } + + return 0; +} + +static void xpcs_rk_exit_clk(void *data) +{ + struct dw_xpcs_rk *pxpcs =3D data; + struct device *dev =3D &pxpcs->pdev->dev; + + pm_runtime_force_suspend(dev); + clk_disable_unprepare(pxpcs->eee_clk); +} + +static int xpcs_rk_init_clk(struct dw_xpcs_rk *pxpcs) +{ + struct device *dev =3D &pxpcs->pdev->dev; + unsigned long rate; + u64 mult; + int ret; + + pxpcs->csr_clk =3D devm_clk_get(dev, "csr"); + if (IS_ERR(pxpcs->csr_clk)) + return dev_err_probe(dev, PTR_ERR(pxpcs->csr_clk), + "Failed to get CSR clock\n"); + + pxpcs->eee_clk =3D devm_clk_get(dev, "eee"); + if (IS_ERR(pxpcs->eee_clk)) + return dev_err_probe(dev, PTR_ERR(pxpcs->eee_clk), + "Failed to get EEE clock\n"); + + ret =3D clk_prepare_enable(pxpcs->eee_clk); + if (ret) { + dev_err(dev, "Failed to enable EEE clock\n"); + return ret; + } + + pm_runtime_set_suspended(dev); + pm_runtime_enable(dev); + + ret =3D devm_add_action_or_reset(dev, xpcs_rk_exit_clk, pxpcs); + if (ret) { + dev_err(dev, "Failed to register devm for EEE clock: %d\n", ret); + return ret; + } + + /* + * Compute the multiplier for the EEE clock so that + * clk_eee_period * (mult_fact + 1) falls within 80..120 ns. + * + * On RK3568, clk_xpcs_eee is muxed between gpll200 (200 MHz, 5 ns) + * and cpll125 (125 MHz, 8 ns), selected by CRU_CLKSEL_CON29 bit 13. + * The reset value is 0 (200 MHz), but derive the value at runtime to + * stay correct if the mux is changed by a board. + * + * Use a 64-bit intermediate: on 32-bit builds, 100 * 200000000 + * does not fit in unsigned long. Clamp to the 4-bit + * DW_VR_MII_EEE_MULT_FACT_100NS field. + */ + rate =3D clk_get_rate(pxpcs->eee_clk); + if (!rate) + return dev_err_probe(dev, -EINVAL, "Invalid EEE clock rate\n"); + + mult =3D DIV_ROUND_CLOSEST_ULL(100ULL * rate, NSEC_PER_SEC) - 1; + pxpcs->eee_mult_fact =3D min_t(u64, mult, 15); + return 0; +} + +static int xpcs_rk_init_bus(struct dw_xpcs_rk *pxpcs) +{ + struct device *dev =3D &pxpcs->pdev->dev; + static atomic_t id =3D ATOMIC_INIT(-1); + struct mii_bus *bus; + int ret; + + bus =3D devm_mdiobus_alloc_size(dev, 0); + if (!bus) + return -ENOMEM; + + bus->name =3D "Rockchip DW XPCS MCI/APB3"; + bus->read =3D xpcs_rk_read_c22; + bus->write =3D xpcs_rk_write_c22; + bus->read_c45 =3D xpcs_rk_read_c45; + bus->write_c45 =3D xpcs_rk_write_c45; + bus->phy_mask =3D ~0; + bus->parent =3D dev; + bus->priv =3D pxpcs; + + snprintf(bus->id, MII_BUS_ID_SIZE, + "rockchip_dwxpcs-%x", atomic_inc_return(&id)); + + /* + * MDIO-bus here serves as just a back-end engine abstracting out + * the MDIO and MCI/APB3 IO interfaces utilized for the Rockchip DWXPCS C= SRs + * access. + */ + ret =3D devm_mdiobus_register(dev, bus); + if (ret) { + dev_err(dev, "Failed to create MDIO bus\n"); + return ret; + } + + pxpcs->bus =3D bus; + return 0; +} + +static int xpcs_rk_probe(struct platform_device *pdev) +{ + struct dw_xpcs_rk *pxpcs; + int ret; + + pxpcs =3D xpcs_rk_create_data(pdev); + if (IS_ERR(pxpcs)) + return PTR_ERR(pxpcs); + + /* + * The XPCS may be attached to a power domain (e.g. PD_PIPE). The domain + * must be powered on before any register access, otherwise the SoC will + * trigger a synchronous external abort (SError). + * + * Accessing the XPCS registers also requires a TX clock from the SerDes, + * which is needed for the soft reset. + */ + ret =3D xpcs_rk_serdes_phy_init(pxpcs); + if (ret) + return ret; + + ret =3D xpcs_rk_serdes_phy_poweron(pxpcs); + if (ret) + return ret; + + ret =3D xpcs_rk_init_res(pxpcs); + if (ret) + return ret; + + ret =3D xpcs_rk_init_clk(pxpcs); + if (ret) + return ret; + + ret =3D xpcs_rk_init_bus(pxpcs); + if (ret) + return ret; + + return 0; +} + +static const struct of_device_id xpcs_rk_of_ids[] =3D { + { .compatible =3D "rockchip,rk3568-xpcs" }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, xpcs_rk_of_ids); + +struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *np) +{ + struct platform_device *pdev; + struct device_node *pcs_np; + struct dw_xpcs_rk *pxpcs; + struct dw_xpcs *xpcs; + u32 port; + + if (!of_device_is_available(np)) + return ERR_PTR(-ENODEV); + + if (of_property_read_u32(np, "reg", &port)) + return ERR_PTR(-EINVAL); + + if (!xpcs_rk_mdio_addr_validate((int)port)) + return ERR_PTR(-EINVAL); + + /* The XPCS pdev is attached to the parent node */ + pcs_np =3D of_get_parent(np); + if (!pcs_np) + return ERR_PTR(-ENODEV); + + if (!of_device_is_available(pcs_np)) { + of_node_put(pcs_np); + return ERR_PTR(-ENODEV); + } + + if (!of_match_node(xpcs_rk_of_ids, pcs_np)) { + of_node_put(pcs_np); + return ERR_PTR(-EINVAL); + } + + pdev =3D of_find_device_by_node(pcs_np); + of_node_put(pcs_np); + if (!pdev) + return ERR_PTR(-EPROBE_DEFER); + + if (!device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_CONSUMER)) { + put_device(&pdev->dev); + return ERR_PTR(-ENOMEM); + } + + pxpcs =3D platform_get_drvdata(pdev); + if (!pxpcs || !pxpcs->bus) { + device_link_remove(dev, &pdev->dev); + put_device(&pdev->dev); + return ERR_PTR(-EPROBE_DEFER); + } + + xpcs =3D xpcs_create_mdiodev(pxpcs->bus, (int)port); + if (IS_ERR(xpcs)) { + device_link_remove(dev, &pdev->dev); + put_device(&pdev->dev); + return xpcs; + } + + xpcs_config_eee_mult_fact(xpcs, pxpcs->eee_mult_fact); + put_device(&pdev->dev); + return xpcs; +} +EXPORT_SYMBOL_GPL(xpcs_rk_create); + +static int xpcs_rk_pm_runtime_suspend(struct device *dev) +{ + struct dw_xpcs_rk *pxpcs =3D dev_get_drvdata(dev); + + clk_disable_unprepare(pxpcs->csr_clk); + + return 0; +} + +static int xpcs_rk_pm_runtime_resume(struct device *dev) +{ + struct dw_xpcs_rk *pxpcs =3D dev_get_drvdata(dev); + + return clk_prepare_enable(pxpcs->csr_clk); +} + +static DEFINE_RUNTIME_DEV_PM_OPS(xpcs_rk_pm_ops, + xpcs_rk_pm_runtime_suspend, + xpcs_rk_pm_runtime_resume, + NULL); + +static struct platform_driver xpcs_rk_driver =3D { + .probe =3D xpcs_rk_probe, + .driver =3D { + .name =3D "rk_xpcs-dwxpcs", + .pm =3D pm_ptr(&xpcs_rk_pm_ops), + .of_match_table =3D xpcs_rk_of_ids, + }, +}; +module_platform_driver(xpcs_rk_driver); + +MODULE_DESCRIPTION("Rockchip XPCS platform device driver"); +MODULE_AUTHOR("Coia Prant "); +MODULE_LICENSE("GPL"); diff --git a/include/linux/pcs/pcs-xpcs-rk.h b/include/linux/pcs/pcs-xpcs-r= k.h new file mode 100644 index 0000000000000..28723d5bd75cc --- /dev/null +++ b/include/linux/pcs/pcs-xpcs-rk.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_PCS_XPCS_ROCKCHIP_H +#define __LINUX_PCS_XPCS_ROCKCHIP_H + +#include +#include +#include + +struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *np); + +#endif /* __LINUX_PCS_XPCS_ROCKCHIP_H */ --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f11.google.com (mail-pj2-f11.google.com [74.125.227.139]) (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 387BF4B126F for ; Tue, 15 Sep 2026 12:39:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475976; cv=none; b=YGY+lG/AZuv5kH7V2vRitwxBzvtjohAEIMkKmyiLlZmhSSzg95ej6fRLE5Yf+EArvswkntQ67V6AojOsebgMgis/T/+tfrxuZBrYgL46VcSPxCvRDbbpxjBaArpaapPFvXa9S8zeM40dvtxbk9PgWwDWQ/IxUNN4doYCVnN8+Qw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475976; c=relaxed/simple; bh=/XopV8KTgRYgJTjrUXTlaOTR0QRZ8vtOfg0QiwkYOPs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Kg5JwPpCYLmhLbP9fdVGDFFWV+E8fiuEu/+djM4BvsZW+yOfc64qAzKoWIiAb+m/KaZhowvTLaayZgJm6K/SjCLVyBri6jvBV8mSsxStnZtyc/wSsZNq03sLiPGhP591VVNPpXVw7LQHDLAloCyaTDExl58GhJWkX75exCwAB90= 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=rOgkKz3L; arc=none smtp.client-ip=74.125.227.139 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="rOgkKz3L" Received: by mail-pj2-f11.google.com with SMTP id 98e67ed59e1d1-398a0a87595so4266193a91.1 for ; Tue, 15 Sep 2026 05:39:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475973; x=1790080773; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=TJZ0PecvDJzl0BEu7eLa+JMyHq2Op9t0/swrRCuqxn8=; b=rOgkKz3LtvesydlkjTKzxKgitfcHUvPmves4RRJDkLF5WgLl9MjjyMTav5Vmr2nieU hGhh4v7tyNgjalbnQZ6UfKV4SMSeJmxTgLStWWNsWocUFyjisyLO/E0mfIZvOCBFMtYt F//22igbXL4jG6z6/lOOUzQBIwG4exCCqqS4bkFI3OqayveEbdypppCbH+FOakTmXKCE 9ogLiTFeN3nvRZ24AWBv9XeVkHvqiKBx494T//QWrU51frd/oFgD239q+jc/iSjzJQc6 RzLql/AP2xA4hjwasFOfcIpjkOV+bsE6sSk2fte9zfLourL2EfuGj9M3kgZYd3Q37Ek+ kHKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475973; x=1790080773; h=content-transfer-encoding:mime-version:references:in-reply-to :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=TJZ0PecvDJzl0BEu7eLa+JMyHq2Op9t0/swrRCuqxn8=; b=08EcPFhv4/1Fa5TR14S20k60scxu0BhJ7vywI24hNB4w2N3s+/OSkytHMuHpMBadjD 4QoDbI/uJHsT7PjZkYLiqGxC8B6kl8sb0z+Gmj1Cxwx6ynX6XFs/YUWod7KMZM/zzvuV FBDpo5ChleAJQ+mw2eOC1InwPK9myZ+K6OW0F7rqa0M6YtmjQz8svEw3z6BWOAp4LB8z hBcRB+1ZCbrAZFNvfXpFd3DAweLu0A/cLwT1BevW5iXxCzXazGw6ZLT0eHGZuZfhZ3Vp boUA1ZJ5RTlJ9VX8lXolCKNcC7eUjAB2our0JjDzMGcDVQ4ZJYdAZX3x/7+ePqErExNP 2KJA== X-Forwarded-Encrypted: i=1; AKwUvBzpd9+iT46m0joo7OfvGn2RBd8CEWONUaZhWFzXfWCRpuSvSPd1NE1e8lVBXkJPT+nXAvATc+ohIbvLYYU=@vger.kernel.org X-Gm-Message-State: AFuF++nxjmaiZyMW1N44dRHpFGcjXT//6zh4kVn/3RO6VDYmm+uMx8wn oMncI1wO32/ZxrTklCBBdpNC6rCFut4eHbeGwYpyx+B/MMMaMXlKJ64D X-Gm-Gg: AYBFou2O0+psJUjbfgvRyhRlB3GBohbRmlNaJdLVBvALQ36LgQnoIA/5s8RpqGOvMya 96GaMeOleHYqOFFJ0RzktDk5At2n12dDHmf5r9USZJxb3r0K0rUWRC5CvB1KT2mNJn6eYMNKZJn f37nmp+Iq+ZBllkf8pHOiVcq5M8igMHyPdcwzOohiVcxnZgUcyXFFOKYw2P5Xk6RiSq9Q9e6SJG OMT+WCLij/s/fJgPCAA5csSndn5oUVRg+FJ6veppAQRKjoivR3Hl+udu8TkVe3CwPacIVpCqYpc jeixyEuHlD1E9/WWC+A+6YBGp09dBf5R11I4i7gTRRLaPpGBvACdbfR6ulV4xVTy3FfL8wobx41 2xSXuzBoFuAap18qw4jiPaepSe24mcQEaM1HU3jQfSMrqsQF9c2IUnwpj3hM1GGN+W+WcDdIbkY ZLR618P+5z6GPz3Jz50nSMiFob0AzG3in+PZxfKgoBt1K7hv1gHzlv4XsfEX5oKv3q6rTUrf4= X-Received: by 2002:a17:90b:1e41:b0:398:b1eb:136c with SMTP id 98e67ed59e1d1-39e10e2e451mr1383583a91.9.1789475973476; Tue, 15 Sep 2026 05:39:33 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:39:32 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 08/11] dt-bindings: net: rockchip-dwmac: document pcs-handle Date: Tue, 15 Sep 2026 20:37:57 +0800 Message-ID: <20260915123802.1561724-9-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The Rockchip dwmac glue driver now supports SGMII on RK3568 and requires a PCS, referenced through the "pcs-handle" property. The property is parsed by rk_pcs_init() and a missing phandle fails the probe, so describe it in the binding and require it when phy-mode is "sgmii". Signed-off-by: Coia Prant --- .../devicetree/bindings/net/rockchip-dwmac.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml b/Do= cumentation/devicetree/bindings/net/rockchip-dwmac.yaml index 80c252845349c..67b21ea77ec96 100644 --- a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml +++ b/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml @@ -120,6 +120,12 @@ properties: maximum: 0x7F default: 0x10 =20 + pcs-handle: + description: + Specifies a reference to a node representing the PCS device + connected to this GMAC. Required when phy-mode is "sgmii". + maxItems: 1 + phy-supply: description: PHY regulator =20 @@ -159,6 +165,15 @@ allOf: clocks: minItems: 5 =20 + - if: + properties: + phy-mode: + contains: + const: sgmii + then: + required: + - pcs-handle + unevaluatedProperties: false =20 examples: --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f7.google.com (mail-pj2-f7.google.com [74.125.227.135]) (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 41A8E4A204F for ; Tue, 15 Sep 2026 12:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475986; cv=none; b=vEhTwzXnlbty3C3mYLROgSkVqXKuI+XDDNeFTSNPNbOu7hwAzk4A4JCYYe0jOIIjSL4KHMssuZzarI9db6B1bVRWGq+TASOGKcB6XLtS4BDApYmnhe7BT6ekPLrH85wPvFmNwqYKN+yU2e9K4j2SsIogePN5Wh2fs9mzkbQNZ3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475986; c=relaxed/simple; bh=SN0jaXp0c6SD9w+L/ByqJUDlx7fO2IprhyNSvK2sFfk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tZSHEjVSFylmMKKRdscEnkWjcwRlIIAzZWUtriKAQSFo1vwmr0WKjNtGdXjYTWJpMfT4zUMuRg5FlyQyFSutOVfp1Of3OPl3PSDMrh4K0DnEW7ZM+o+BWQWNDiXE/QDjEztIF2A16y7t/syiBdqPb4oVUOFFWwyjBtZigPNQ6mc= 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=Dw91M5vc; arc=none smtp.client-ip=74.125.227.135 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="Dw91M5vc" Received: by mail-pj2-f7.google.com with SMTP id 98e67ed59e1d1-398da2bdcb9so2065848a91.0 for ; Tue, 15 Sep 2026 05:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475982; x=1790080782; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=ubo9VbgqedgVzI40sXkXBvC7QCfHEN/2mwH5780v1as=; b=Dw91M5vcozV1k1T0l0M5MQmJj4koHIj3g0/gYOkk4jECSOzLW8CL8kjePUNH1IipL0 vOUPDN+y7RR90IQG4QoH/3mc7KHjX5A3lKgk496G1oFq2i7RO0qqV/jn/dvw2mm73/LT 1W9m8sE+J6FGx84cnc12aorf1PY1ByLTSAf4FEsV7NLyQzKBmIAsBG/nqKaa0Jo9w9EQ GoNTdqZa9Ygd2q2UXT9vW6d07gU5H/dmXHedka/xSxhRuS1wGDbPwYpEK0O31Ya25dvs 7ywtdCMVdZuP8xn7DcD/dDobtgouqTDJMtZmcIiZY195c/cmGDg6PuJHX4kCpPCX93nZ zZlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475982; x=1790080782; h=content-transfer-encoding:mime-version:references:in-reply-to :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=ubo9VbgqedgVzI40sXkXBvC7QCfHEN/2mwH5780v1as=; b=aPdME9WGiPXT/DW+ItQwJLg5cP20g1zEuqqO8q5jfQUHfCtIMaT8Y8pdBNuN6isg2X ulzJNkl28L3tqGOxdZTF7qbHdCvrlnatgqBcEjb1zQmN0RTe/ZAyi/zx0Ji2FFZjiKbj lAC2XbOimDictWY6SFZB2Q6WGKYXXW8+kScZ9sWoCwcHTtXOEnO0oS9Ktq74oA/hZU6x Q9dtQOu242oY/8yPJ850q4qguWAU3HLXblZZ2JDoYIhlLDNPcjW58ZmRJ8cTTffMcaDS 3RJlOA40Q30jQ7aXY74g9u9kY3N0s+LEIILyFY/IynBJQ4vHlJOBBacKBwNmy7zgCCu/ MfrA== X-Forwarded-Encrypted: i=1; AKwUvBzQ4iH39k//JCiLBT3VH0/x50I5W156w3A+EKPiQQ+GPQUZ+0P0W4EZFFm1ZcjpFjJkuOoGcyOLZ/DgonY=@vger.kernel.org X-Gm-Message-State: AFuF++k7OjDi+y02uYgZaZ0xQmbzJY3aYJLOxDwNidnHvjCcEOR3A/t/ LY+S45OFhl7w6Uq5F4oAE2mFRxE7NVuPIuvbkhvqMzhSt7d/omas1YhJ X-Gm-Gg: AYBFou111H8bbNVZfs4jTG1USffjd7laafmPtpPPyLCfBHhcUVSeuHerbZLlD2YwfM5 aZcp+Qb9/0nAY6es0X6A1l6ZH3utncfoXr0kmd9ytUPDrxFNK1ZamtJZlwhZ+jjE1cz7TxkHmRb nyMyGSH5pxbDvyli50g9iqpqskWX4TeOO5DAh+nKMtfgWBIRtcebQPYBZcqTB1O50BNbV1x58PI OxuYQpNXI8qZ4MeheLIDGChuHz83WHDG2gKs2d2KBhdK6sO+NHQoXixShJIQskqkQiRj0SwOmdw UW6KoJETA7XaT4MlTrdFSGzyjnYcU/KLbe4x47RlE8IQhywWcm8yjzWGhN8VAExfjCIG+hZSodU NYE86eOXQejnTLJAg5RZa3e63D/8a6rx/gXG59TDpYkQg5VBscBqL1jguJppb+qODsQ1+k3vH6U 4VBflrmz5N7IWL3fukbJoNtlWKrCE0Guar2T2oo+KMeVsLBBxh+ooFPX/ulPXW7W0Ha2ju24W/z T7mhxaF X-Received: by 2002:a17:90b:590b:b0:39d:f720:c5a5 with SMTP id 98e67ed59e1d1-39df720d07bmr12167003a91.15.1789475982466; Tue, 15 Sep 2026 05:39:42 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.39.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:39:41 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 09/11] net: stmmac: dwmac-rk: add SGMII support for RK3568 Date: Tue, 15 Sep 2026 20:37:58 +0800 Message-ID: <20260915123802.1561724-10-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RK3568 SoC integrates a Synopsys DesignWare XPCS that can be connected to GMAC0 or GMAC1 in SGMII mode. Add the necessary glue logic to support this configuration. The current dwmac-rk driver does not support SGMII mode. SGMII requires a PCS to handle auto-negotiation and link state reporting, but the existing driver only supports RGMII and RMII. Add a set_to_sgmii() callback to configure the GMAC GRF register for SGMII mode (bit 7 set, interface selection bits 4:6 ignored when set). Also add a set_to_rmii() callback for rk3568 to explicitly clear bit 7, since the new SGMII path leaves it set and the RMII branch previously relied on the SoC reset value. Provide pcs_init/pcs_exit callbacks to create/destroy the XPCS via xpcs_rk_create() from the Rockchip XPCS platform driver, and a select_pcs callback to return the XPCS to phylink. Reorder rk_gmac_powerup() so that gmac_clk_enable() is called before the SGMII check. The SGMII path skips rk_get_phy_intf_sel(), so the clock must be enabled earlier to cover all register accesses in that path. While at it, unify the error unwinding into a single clk_disable label and add error handling for the default (unhandled interface) case. SGMII In-band vs Out-of-band =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D On RK3568, the MAC clock is fixed at 125 MHz and cannot be dynamically changed by the stmmac core's set_clk_tx_rate callback. In-band mode works because the PCS handles rate adaptation internally. Out-of-band mode does not work because the MAC would need to change the clock rate to 125/12.5/1.25 MHz for 1000/100/10 Mbps respectively, and the clock is fixed. Enable default_an_inband for SGMII and disable the generic stmmac set_clk_tx_rate callback. This forces phylink to use in-band mode, where the PCS is responsible for speed/duplex negotiation. Note that default_an_inband can be overridden by a fixed-link node, and phylink may also fall back to out-of-band if the PHY does not support in-band signalling. Out-of-band SGMII is not supported by this driver: the MAC clock would stay at 125 MHz for 10/100 Mbps, giving working TX but failing RX. Boards must use in-band mode (managed =3D "in-band-status" or an in-band capable PHY). Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%= 20Part1%20V1.1-20210301.pdf (Page 386) Reviewed-by: Maxime Chevallier Signed-off-by: Coia Prant --- drivers/net/ethernet/stmicro/stmmac/Kconfig | 1 + .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 133 +++++++++++++++--- 2 files changed, 114 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethe= rnet/stmicro/stmmac/Kconfig index e3dd5adda5aca..5088acc06982e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig @@ -170,6 +170,7 @@ config DWMAC_ROCKCHIP default ARCH_ROCKCHIP depends on OF && (ARCH_ROCKCHIP || COMPILE_TEST) select MFD_SYSCON + select PCS_XPCS_ROCKCHIP help Support for Ethernet controller on Rockchip RK3288 SoC. =20 diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/e= thernet/stmicro/stmmac/dwmac-rk.c index 8d7042e689261..b3d746dd966ff 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -20,6 +20,7 @@ #include #include #include +#include #include =20 #include "stmmac_platform.h" @@ -47,6 +48,7 @@ struct rk_gmac_ops { void (*set_to_rgmii)(struct rk_priv_data *bsp_priv, int tx_delay, int rx_delay); void (*set_to_rmii)(struct rk_priv_data *bsp_priv); + void (*set_to_sgmii)(struct rk_priv_data *bsp_priv); int (*set_speed)(struct rk_priv_data *bsp_priv, phy_interface_t interface, int speed); void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv); @@ -63,6 +65,7 @@ struct rk_gmac_ops { bool clock_grf_reg_in_php; bool supports_rgmii; bool supports_rmii; + bool supports_sgmii; bool php_grf_required; bool regs_valid; u32 regs[]; @@ -98,6 +101,7 @@ struct rk_priv_data { bool integrated_phy; bool supports_rgmii; bool supports_rmii; + bool supports_sgmii; =20 struct clk_bulk_data *clks; int num_clks; @@ -809,6 +813,8 @@ static const struct rk_gmac_ops rk3528_ops =3D { #define RK3568_GRF_GMAC1_CON1 0x038c =20 /* RK3568_GRF_GMAC0_CON1 && RK3568_GRF_GMAC1_CON1 */ +#define RK3568_GMAC_MODE_RMII_RGMII GRF_CLR_BIT(7) +#define RK3568_GMAC_MODE_SGMII_QSGMII GRF_BIT(7) #define RK3568_GMAC_FLOW_CTRL GRF_BIT(3) #define RK3568_GMAC_FLOW_CTRL_CLR GRF_CLR_BIT(3) #define RK3568_GMAC_RXCLK_DLY_ENABLE GRF_BIT(1) @@ -836,6 +842,16 @@ static int rk3568_init(struct rk_priv_data *bsp_priv) } } =20 +static void rk3568_set_to_rmii(struct rk_priv_data *bsp_priv) +{ + u32 con1; + + con1 =3D (bsp_priv->id =3D=3D 1) ? RK3568_GRF_GMAC1_CON1 : + RK3568_GRF_GMAC0_CON1; + + regmap_write(bsp_priv->grf, con1, RK3568_GMAC_MODE_RMII_RGMII); +} + static void rk3568_set_to_rgmii(struct rk_priv_data *bsp_priv, int tx_delay, int rx_delay) { @@ -851,19 +867,31 @@ static void rk3568_set_to_rgmii(struct rk_priv_data *= bsp_priv, RK3568_GMAC_CLK_TX_DL_CFG(tx_delay)); =20 regmap_write(bsp_priv->grf, con1, + RK3568_GMAC_MODE_RMII_RGMII | RK3568_GMAC_RXCLK_DLY_ENABLE | RK3568_GMAC_TXCLK_DLY_ENABLE); } =20 +static void rk3568_set_to_sgmii(struct rk_priv_data *bsp_priv) +{ + u32 con1; + + con1 =3D (bsp_priv->id =3D=3D 1) ? RK3568_GRF_GMAC1_CON1 : + RK3568_GRF_GMAC0_CON1; + + regmap_write(bsp_priv->grf, con1, RK3568_GMAC_MODE_SGMII_QSGMII); +} + static const struct rk_gmac_ops rk3568_ops =3D { .init =3D rk3568_init, + .set_to_rmii =3D rk3568_set_to_rmii, .set_to_rgmii =3D rk3568_set_to_rgmii, + .set_to_sgmii =3D rk3568_set_to_sgmii, + .set_speed =3D rk_set_clk_mac_speed, =20 .gmac_phy_intf_sel_mask =3D GENMASK_U16(6, 4), =20 - .supports_rmii =3D true, - .regs_valid =3D true, .regs =3D { 0xfe2a0000, /* gmac0 */ @@ -1208,6 +1236,43 @@ static void rk_phy_powerdown(struct rk_priv_data *bs= p_priv) dev_err(bsp_priv->dev, "fail to disable phy-supply\n"); } =20 +static int rk_pcs_init(struct stmmac_priv *priv) +{ + struct device_node *np =3D priv->device->of_node; + struct device_node *pcs_node; + struct dw_xpcs *xpcs; + + pcs_node =3D of_parse_phandle(np, "pcs-handle", 0); + if (!pcs_node) + return -ENODEV; + + xpcs =3D xpcs_rk_create(priv->device, pcs_node); + of_node_put(pcs_node); + if (IS_ERR(xpcs)) + return PTR_ERR(xpcs); + + priv->hw->xpcs =3D xpcs; + return 0; +} + +static void rk_pcs_exit(struct stmmac_priv *priv) +{ + if (!priv->hw->xpcs) + return; + + xpcs_destroy(priv->hw->xpcs); + priv->hw->xpcs =3D NULL; +} + +static struct phylink_pcs *rk_select_pcs(struct stmmac_priv *priv, + phy_interface_t interface) +{ + if (!priv->hw->xpcs) + return NULL; + + return xpcs_to_phylink_pcs(priv->hw->xpcs); +} + static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, struct plat_stmmacenet_data *plat, const struct rk_gmac_ops *ops) @@ -1330,6 +1395,7 @@ static struct rk_priv_data *rk_gmac_setup(struct plat= form_device *pdev, =20 bsp_priv->supports_rgmii =3D ops->supports_rgmii || !!ops->set_to_rgmii; bsp_priv->supports_rmii =3D ops->supports_rmii || !!ops->set_to_rmii; + bsp_priv->supports_sgmii =3D ops->supports_sgmii || !!ops->set_to_sgmii; =20 if (ops->init) { ret =3D ops->init(bsp_priv); @@ -1361,6 +1427,10 @@ static int rk_gmac_check_ops(struct rk_priv_data *bs= p_priv) if (!bsp_priv->supports_rmii) return -EINVAL; break; + case PHY_INTERFACE_MODE_SGMII: + if (!bsp_priv->supports_sgmii) + return -EINVAL; + break; default: dev_err(bsp_priv->dev, "unsupported interface %d", bsp_priv->phy_iface); @@ -1379,16 +1449,19 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp= _priv) if (ret) return ret; =20 + ret =3D gmac_clk_enable(bsp_priv, true); + if (ret) + return ret; + + if (bsp_priv->phy_iface =3D=3D PHY_INTERFACE_MODE_SGMII) + goto set_mode; + ret =3D rk_get_phy_intf_sel(bsp_priv->phy_iface); if (ret < 0) - return ret; + goto clk_disable; =20 intf =3D ret; =20 - ret =3D gmac_clk_enable(bsp_priv, true); - if (ret) - return ret; - if (bsp_priv->gmac_phy_intf_sel_mask || bsp_priv->gmac_rmii_mode_mask) { /* If defined, encode the phy_intf_sel value */ @@ -1399,10 +1472,8 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_= priv) bsp_priv->gmac_rmii_mode_mask); =20 ret =3D rk_write_gmac_grf_reg(bsp_priv, val); - if (ret < 0) { - gmac_clk_enable(bsp_priv, false); - return ret; - } + if (ret < 0) + goto clk_disable; } =20 if (bsp_priv->clock.rmii_mode_mask) { @@ -1410,13 +1481,12 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp= _priv) bsp_priv->clock.rmii_mode_mask); =20 ret =3D rk_write_clock_grf_reg(bsp_priv, val); - if (ret < 0) { - gmac_clk_enable(bsp_priv, false); - return ret; - } + if (ret < 0) + goto clk_disable; } =20 - /*rmii or rgmii*/ +set_mode: + /* rmii, rgmii, sgmii */ switch (bsp_priv->phy_iface) { case PHY_INTERFACE_MODE_RGMII: dev_info(dev, "init for RGMII\n"); @@ -1447,15 +1517,20 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp= _priv) if (bsp_priv->ops->set_to_rmii) bsp_priv->ops->set_to_rmii(bsp_priv); break; + case PHY_INTERFACE_MODE_SGMII: + dev_info(dev, "init for SGMII\n"); + if (bsp_priv->ops->set_to_sgmii) + bsp_priv->ops->set_to_sgmii(bsp_priv); + break; default: dev_err(dev, "NO interface defined!\n"); + ret =3D -EINVAL; + goto clk_disable; } =20 ret =3D rk_phy_powerup(bsp_priv); - if (ret) { - gmac_clk_enable(bsp_priv, false); - return ret; - } + if (ret) + goto clk_disable; =20 pm_runtime_get_sync(dev); =20 @@ -1463,6 +1538,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_= priv) bsp_priv->ops->integrated_phy_powerup(bsp_priv); =20 return 0; + +clk_disable: + gmac_clk_enable(bsp_priv, false); + return ret; } =20 static void rk_gmac_powerdown(struct rk_priv_data *gmac) @@ -1486,6 +1565,9 @@ static void rk_get_interfaces(struct stmmac_priv *pri= v, void *bsp_priv, =20 if (rk->supports_rmii) __set_bit(PHY_INTERFACE_MODE_RMII, interfaces); + + if (rk->supports_sgmii) + __set_bit(PHY_INTERFACE_MODE_SGMII, interfaces); } =20 static int rk_set_clk_tx_rate(void *bsp_priv_, struct clk *clk_tx_i, @@ -1602,6 +1684,17 @@ static int rk_gmac_probe(struct platform_device *pde= v) plat_dat->suspend =3D rk_gmac_suspend; plat_dat->resume =3D rk_gmac_resume; =20 + if (plat_dat->phy_interface =3D=3D PHY_INTERFACE_MODE_SGMII) { + /* SGMII clock always runs at 125 MHz */ + plat_dat->set_clk_tx_rate =3D NULL; + + /* SGMII requires a PCS */ + plat_dat->default_an_inband =3D true; + plat_dat->pcs_init =3D rk_pcs_init; + plat_dat->pcs_exit =3D rk_pcs_exit; + plat_dat->select_pcs =3D rk_select_pcs; + } + plat_dat->bsp_priv =3D rk_gmac_setup(pdev, plat_dat, data); if (IS_ERR(plat_dat->bsp_priv)) return PTR_ERR(plat_dat->bsp_priv); --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 Received: from mail-pj2-f11.google.com (mail-pj2-f11.google.com [74.125.227.139]) (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 D3E754A204F for ; Tue, 15 Sep 2026 12:39:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475993; cv=none; b=GNYxXCVX5nUSGYEq7TrTp36K7msnskdJp3wEA51YbEExvOK5bdMibRpBs2uVZ0GEMaX6Dh2S31lSXGW2zAIKUVvvtRSMxG5hpl0OStf3pNIx2jRQ7hFNoJRmWOn1JLsfKG9A5whnOFDDH0BAfznj8pDn3OI5pSLDxJ4ixXhjLbA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789475993; c=relaxed/simple; bh=RGeiUbt1ILnRnxxwfPtaUyN72PdSbFuLoFXljuwFvyQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BRZkeYBK55+b8yaz8cWuAPQZzd6m2zAX/rF7dxR3/XTssE6QdEOaVcRTc6d+N2QNQFoxzP7JbEQi7OGnTyCT5n99I53kXsT0NZcDOAze/CufId6RWTONo/QbbGL/YkY3VVDOI8yS62tE1ENfKMxk8B8shyM607Cf/SlncmR1CSc= 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=E5QlstoG; arc=none smtp.client-ip=74.125.227.139 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="E5QlstoG" Received: by mail-pj2-f11.google.com with SMTP id 98e67ed59e1d1-398a384b5f7so2727213a91.0 for ; Tue, 15 Sep 2026 05:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789475991; x=1790080791; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IUBpSQaA91JU4u4hSD0CHnRFwoDOkNzew04B1AEq+dc=; b=E5QlstoGG8mVr347nR+abOpjGg3JzrCE9aFXhbqoAsuMK3E4sn2MhBV9VC13L3sET7 vvkqb+1ryKuI4dXfaXl1ejOnVT7TJ7DbwWW/HPkTSw4c5pLeRDoWIuBkr/6DnqsJYf3u pgfmjrG6bAl/5rg1xLNqBPqmumecV8yOAKNsCJm3vRINqTBQFFkotGKN1E4yu0fBEauS Um3V/vq2rrJ9U6DCHSYfWfoXHgl4GZkNr59VHAT2qJCyEQB2P3IYNCYm6dEF3YhQXmIB tmnOnN3fQ4J6oAQ78HdPetDN8EWwVwOtF911hRQIgKa7wFvBPftfN3TVn+Fh0xLLg16R 4zBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789475991; x=1790080791; h=content-transfer-encoding:mime-version:references:in-reply-to :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=IUBpSQaA91JU4u4hSD0CHnRFwoDOkNzew04B1AEq+dc=; b=pRWHqRFSKCgCvBOrwSo3uheoKqlTXbZIVe8Bw+QA6Al/puLq8tWOWNApNuAEVGYoTg yvOWRcJMR4cK0bnv4t0F+cNNd8AwSJT6T2i2Qu3oTsOjmmg3Wt4z2JAKZMDR2+xQvgF5 XpO0GQSM5jHCx6i1/OfYj1fv3+8Timv7yAXkBCnVKDfruNgUU2mkjen4IMcoa6Ja9vLx 7yNpIjRj6lHdZcKvjcEQtSiKnkjazCYQ2+YUDFIVwcjaRwf/DCkErg8FbNN3Xtt1ZY+9 XAx9uddUq+yKHNACnWv14X+blxIKKKbpokrPEw65JwoVtoSdggE3zssLO5ZMA0ScFEaQ uUgw== X-Forwarded-Encrypted: i=1; AKwUvBz1KfNflRe7Ecqgj8/CU4Vv1yEDFR4p6SquIqSCWrBh4o3FQAFVJRYmHkU7jaUyfbLdmEiXZjmPAMWWbGs=@vger.kernel.org X-Gm-Message-State: AFuF++njLtE5viWmEYUGVq4t/L6weY1Pe44xKbKRjMkCj6oIebTApVT6 pgrDHdNusOsLPdeDwMPTbOeMIkIyt60J7aA/1GJC5db5tpDcQznoH0n1 X-Gm-Gg: AYBFou1oT94UMY9Ye4wxtO3RAjpUehUp6uVTS2DsQvbZ3dHnIGgiZEpk1HSBQzFSOFD MP3UMLfG3MbTJI8e+656J4stuP3xYG/x0EbyUOfmpXVApcHETDqMPF9fmQepT8wL+UhzH6/uMAE Fp7Ds6Dg0IZCVkb/ZDmVzKobLizgyKpYgLSB5zTYAEDrv3vZkynMU+tVgitU8BlHUZdRLNwm3ok saJT1JWdq0BgtZH22U8cN6UeOwxgg9DRLdPQOBt+vJNDdiJhtd9UxOlZYaUjopU15GUAyzrbvQR of50adAetu6UFBsaDlZJ3FXaeqjT34y4R0BmKbfMsAfPkxXXRQnGPRMRtlp+UyuEBkIC2f56Vvb SM8LvH1RdX8rr3rv0YHSM/9JLnKVY1804/ipP5QLpAC6U2vFqYd3KmfP+ImtoQFfyiXY8bJleNH Zt9qm19GdM5GJY9gF26oWWlCCV9I0LQGGUBPo+ChDputKllaCRDbAEsrif+2PFGGmP22Y4LA== X-Received: by 2002:a17:90b:5887:b0:39e:8d5:fcee with SMTP id 98e67ed59e1d1-39e08d5fe14mr4270765a91.17.1789475991205; Tue, 15 Sep 2026 05:39:51 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.39.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:39:50 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 10/11] arm64: dts: rockchip: rk3568-photonicat: enable SGMII LAN port Date: Tue, 15 Sep 2026 20:37:59 +0800 Message-ID: <20260915123802.1561724-11-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The Ariaboard Photonicat has a Motorcomm YT8521SC Gigabit Ethernet PHY connected to GMAC0 via XPCS SGMII. Enable the necessary nodes to make this port functional. Add rockchip,sgmii-mac-sel =3D <0> to the already enabled combphy2, to route the SGMII interface to GMAC0. Enable the xpcs node and its port 0 sub-node, referencing combphy2 as the SerDes PHY. Add the mdio0 node with the YT8521SC PHY at address 3, including its reset GPIO and LED configuration. Also add LED configuration for the existing RGMII PHY on mdio1 for consistency. Signed-off-by: Coia Prant --- .../boot/dts/rockchip/rk3568-photonicat.dts | 74 ++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts b/arch/arm6= 4/boot/dts/rockchip/rk3568-photonicat.dts index 58c1052ba8ef3..fdaa4a2a4328b 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts +++ b/arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts @@ -3,6 +3,7 @@ /dts-v1/; =20 #include +#include #include #include #include "rk3568.dtsi" @@ -241,6 +242,7 @@ &combphy1 { }; =20 &combphy2 { + rockchip,sgmii-mac-sel =3D <0>; status =3D "okay"; }; =20 @@ -260,9 +262,18 @@ &cpu3 { cpu-supply =3D <&vdd_cpu>; }; =20 -/* Motorcomm YT8521SC LAN port (require SGMII) */ +/* Motorcomm YT8521SC LAN port */ &gmac0 { - status =3D "disabled"; + assigned-clocks =3D <&cru SCLK_GMAC0_RX_TX>; + assigned-clock-parents =3D <&clk_gmac0_xpcs_mii>; + managed =3D "in-band-status"; + pcs-handle =3D <&xpcs_mii0>; + phy-handle =3D <&sgmii_phy>; + phy-mode =3D "sgmii"; + phy-supply =3D <&vcc_3v3>; + pinctrl-names =3D "default"; + pinctrl-0 =3D <&gmac0_miim>; + status =3D "okay"; }; =20 /* Motorcomm YT8521SC WAN port */ @@ -341,6 +352,36 @@ &i2s0_8ch { status =3D "okay"; }; =20 +&mdio0 { + sgmii_phy: ethernet-phy@3 { + compatible =3D "ethernet-phy-ieee802.3-c22"; + reg =3D <0x3>; + max-speed =3D <1000>; + reset-assert-us =3D <20000>; + reset-deassert-us =3D <100000>; + reset-gpios =3D <&gpio3 RK_PC6 GPIO_ACTIVE_LOW>; + + leds { + #address-cells =3D <1>; + #size-cells =3D <0>; + + led@1 { + reg =3D <1>; + color =3D ; + function =3D LED_FUNCTION_LAN; + default-state =3D "keep"; + }; + + led@2 { + reg =3D <2>; + color =3D ; + function =3D LED_FUNCTION_LAN; + default-state =3D "keep"; + }; + }; + }; +}; + &mdio1 { rgmii_phy: ethernet-phy@3 { compatible =3D "ethernet-phy-ieee802.3-c22"; @@ -350,6 +391,25 @@ rgmii_phy: ethernet-phy@3 { reset-gpios =3D <&gpio4 RK_PC0 GPIO_ACTIVE_LOW>; rx-internal-delay-ps =3D <1500>; tx-internal-delay-ps =3D <1500>; + + leds { + #address-cells =3D <1>; + #size-cells =3D <0>; + + led@1 { + reg =3D <1>; + color =3D ; + function =3D LED_FUNCTION_WAN; + default-state =3D "keep"; + }; + + led@2 { + reg =3D <2>; + color =3D ; + function =3D LED_FUNCTION_WAN; + default-state =3D "keep"; + }; + }; }; }; =20 @@ -586,3 +646,13 @@ &xin32k { pinctrl-names =3D "default"; pinctrl-0 =3D <&clk32k_out1>; }; + +&xpcs { + phys =3D <&combphy2 PHY_TYPE_SGMII>; + phy-names =3D "serdes"; + status =3D "okay"; +}; + +&xpcs_mii0 { + status =3D "okay"; +}; --=20 2.47.3 From nobody Fri Sep 25 07:21:25 2026 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 E87D1476CD2 for ; Tue, 15 Sep 2026 12:40:00 +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=1789476002; cv=none; b=erHCVlGdn+ruNeJQz1GQvI3U9ZHVc+qwyG3nzBRVR0fY7+mBXoGQN2IgrsWNW71GrUxwW+FnOG6+RRmQj5LgEziu+wVux2Il7hCVFE3EV7fJHIfGhiUPsBfWnEE4QVAVpmUY4CxAUv4zNHISYle2OBI8pgQ3/7EECrzKYP3+toI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789476002; c=relaxed/simple; bh=tCrgHNTqayWFj1XRarWJorXnl2XIBvQrDCQv89fV94M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=i1CKH+sC64PeCEDSEDS28xNj/j9oL8N6/XgwlFk0O8NAtVM7xBf4hEY6k5dgke3sGRSK6LMr8Ctnw/uVy9uiUB+kBM10CpLkB/z9C1XnffrA5uVQwyXTc7056Zp6ZziIRA4QxmtzxMq/SpWXSeobKn8iiAvsfBYMNERBvBnvgQM= 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=AtCYZ6Kb; 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="AtCYZ6Kb" Received: by mail-pj2-f3.google.com with SMTP id 98e67ed59e1d1-3859292bb51so247737a91.1 for ; Tue, 15 Sep 2026 05:40:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789476000; x=1790080800; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=rQei+xFrWR/8tHZU0Qo/Qb7KMibEAMjL/DUhroeeXK4=; b=AtCYZ6KbYOaS9auUBsv8QrA525jxfl7noKBHqjywxD6PrRM3L3BZVbABKVBYp5ysZB hcINfyL3TmcfDgLgSxDUYaDGiUNVappIAvlUN5UovcLxMpLJMcnWJ91XM1yQlXwsI6L6 BMe7Ju+StEikNSmPbDQTpnSsr+xfHv56oday/jdbZ4n3zW3Uv1QcBtnncaMmoIC3Z+VY Be90ZFC3QgypwSxgwYbHWhUN8ocO7OjvZ2eW5Pa6AI2Vf6EpT4tHfpx97/rSJrew1tEG d6pzWISrtHgb4/MQEv/QqQs2fczOCabJgX8KusZ7rDM6RtgjIPl4Ecuvnt8BwplWsQPT iMpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789476000; x=1790080800; h=content-transfer-encoding:mime-version:references:in-reply-to :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=rQei+xFrWR/8tHZU0Qo/Qb7KMibEAMjL/DUhroeeXK4=; b=GPe4W277KvspH9Tfi2lJGRC3b9KzURXFGvhefxfqm/eyUBBlOmi05cGZIRFDdYLeIx YIGsT7TN1PkpgIYfmVpnkk7bLiRnskJ4aFq+KynaJIl1X2fqKDJYbo1NUIWX72tQxVsj R82YlDHhzqrWLwJ9rPp74ynP6Qy7WOmdo4QA9RLr76e5u4UN2fMOlJ7mO/VmXyFr3uTG F9hDfWvSkLiGHmG3TdQSr0y4dUQ3pCbBy0v4j11c0LuzDlrYZ/lKHrHnzcYareRHX8aV pTwAljWeFuomnKYenO39TS0iUyueNoH9UEN01G19zjLyXFaMdOhcP7BQUtn/SnG6pKyh uqFA== X-Forwarded-Encrypted: i=1; AKwUvBx8+oF9H7y16zSltXbcG/KJ5bt0urmDNeIuHlUjuy57V5IvYDw1bFcrwfi+MDdaE2TSUZw9MxgojUfqkkk=@vger.kernel.org X-Gm-Message-State: AFuF++lfO9sPoWFSrDkKDBPqeikOKI1SredfmYW3qPYX4iA9DFO0Avgr dvHa9gKi0BHMXFsGznRoqo3dxoHL4/cZkkx/dRN1jfcu2CE+t97C64bO X-Gm-Gg: AYBFou0H2R79Il26nkAN5OLvbEgtV6zORHPw8oETddPOFf8NMGvT5ww7GrD9aBJdzxa ekeuKut7hcWsSdvWIyflrRd8EUM1hWLSGDkl/Su39lId+Tu67AFuDTkUS0iuaYby+bzDZnTws6F wSE6DIIJa+niAjDhq/4heVUwCZPcU7Y7/e36vbKuwzTwpP9Eq5ao7Jn2dWNl2I1wo/63JG1JfAM pCe6lzCeivLeWKMFUKYJh7UI7ZC+fpGES6rPq2SApeJ7oC8MhGkqNH4177LbdrFQkQUvppkxfjb vvD2NGFGnncdXtxpP1Iyn+gnWR96fd9EQqirXXOksb4og0oQA006vhCg5fjdZgSrmj3Q06c70UD tF3/5ppl92nmmSKbdGpxbqxmcQzfJddRZu4Wv7pGN/9+8ymvb6r76J1V1gIWsWZcr6CrmLl7GFl iRg4We6C3WAPrYMQgMf9C/iNQWeG9xBOx4NWQIJQYLNxNY8YuO5LfN6GTKlkpDyR8bxMTPIJU= X-Received: by 2002:a17:90b:314c:b0:398:9bd3:d6d6 with SMTP id 98e67ed59e1d1-39dfe1901e4mr3823167a91.16.1789476000343; Tue, 15 Sep 2026 05:40:00 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39dfdd28acbsm5307259a91.10.2026.09.15.05.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Sep 2026 05:39:58 -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-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v6 11/11] MAINTAINERS: add entry for Rockchip XPCS driver Date: Tue, 15 Sep 2026 20:38:00 +0800 Message-ID: <20260915123802.1561724-12-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260915123802.1561724-1-coiaprant@gmail.com> References: <20260915123802.1561724-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a MAINTAINERS entry for the Rockchip RK3568 XPCS platform driver and its device tree binding. Include the relevant mailing lists (netdev and linux-rockchip) so that future patches are properly distributed. Signed-off-by: Coia Prant --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3b2eb2a7a89a8..f53a519da6298 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23739,6 +23739,15 @@ S: Maintained F: Documentation/devicetree/bindings/sound/rockchip,rk3576-sai.yaml F: sound/soc/rockchip/rockchip_sai.* =20 +ROCKCHIP XPCS DRIVER +M: Coia Prant +L: netdev@vger.kernel.org +L: linux-rockchip@lists.infradead.org +S: Maintained +F: Documentation/devicetree/bindings/net/pcs/rockchip,rk3568-xpcs.yaml +F: drivers/net/pcs/pcs-xpcs-rk.c +F: include/linux/pcs/pcs-xpcs-rk.h + ROCKER DRIVER M: Jiri Pirko L: netdev@vger.kernel.org --=20 2.47.3