From nobody Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f6.google.com (mail-pz2-f6.google.com [74.125.228.6]) (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 048DC439F91 for ; Sun, 20 Sep 2026 17:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.6 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923738; cv=none; b=iyoeF97u/vFSSqmrcx1Qi8WfgkaUtUv5f11QXabVEpuSS7gdUPh0+AiW1Cw+V+pm8+rhiLWB4zcBIrL2FOV1agd/p17HQijNyAuxqWuWBCuHD1Pjx0jkDhgBMoECFLQxGKCPqVtwP/4uMDX6vCtl8I8lRfsps9HmZOp4Xk1CN7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923738; c=relaxed/simple; bh=nfHCywuouAotZEtfin/UT97xewpGFIHFD6nChmuOl+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r/n7uDaLg/IhB8zqdXZyLojLiqANPXe1A3YpcLR1TqhhtK8DfbX1sSlMRvcTb9N+KEi8ef9bL9q2Gs3Sjk52m4c+0HckXLHAZ8Y5eZR3ajsMhmywXphJqyY281YzOlBUXki5j408udoi90ul0Y3mg0ZBLu9pGbCV+krbpz+yEO0= 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=UtHYVrT6; arc=none smtp.client-ip=74.125.228.6 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="UtHYVrT6" Received: by mail-pz2-f6.google.com with SMTP id 41be03b00d2f7-cc73514ac7dso495661a12.0 for ; Sun, 20 Sep 2026 10:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923735; x=1790528535; 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=zEUQeU6k8z4p+pYvxi9WzB22HwI4F5YGnZw/HBsPBRQ=; b=UtHYVrT61ESOI0OhM00LGmtAx+mC/gVMXS6Z5ns7++uoP87cS1zHVQnh1u4/Psl8XZ hPoQbiorZ330tEc4SO9QdRq9u57D0M0fO2n1BEwqD3a8ee7n4EhngGvZc5vV1kre434h 48bRzYl5gG+xw/rYMdE9voZlwYaPulEQ2xe/rS8+sAfMGStUVohqsspZo3IjmuKL+Qsd /T9K+pg0zLDTdmytAN+qSvPEvCKwXsnqdfyiSDqQGjFwchC0l9wSqnjgZLrDbqJ2Qxi8 eTJdtgJdTPF1lMxHkHRq1q8M4GDQg799/eYKDMKgJJKyrAvkw22q9uqviVhm8yVKLc3H IU2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923735; x=1790528535; 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=zEUQeU6k8z4p+pYvxi9WzB22HwI4F5YGnZw/HBsPBRQ=; b=WLYHQnwHwxgaoLBUj8BaeMa/mV/kbeT1nqmtx0oHYnaZ3UeK4Lzhv5MxxKtIBJzpoM ubqBmaoB6j2ewGltWMvYFQyrM6VXqB3CzY0DTRd6LMEkyY+9eMY3+gk3yhBT+Z6VgDe5 DIN+MX7K5CxsPNVebc3sqWS9I4VD/VHSr5seLJX5x/5rf1B2B/M7HjujM6Rj18iRopzn QXuucC7iy6ikirAXvKVVHuDhDiWWxulDhr/gG4RhbHkOqiiG2a16KzEqoO03XpICDP+l A1fCL4YQE1JNAXc/Y7R6HbKIDlI8Lam7tzKGbsMn3SnXE9KANRrngJfryFCuuPsSuy9x sCWg== X-Forwarded-Encrypted: i=1; AKwUvBzHnCSEhQ8X80T/ZdTNVe7pzEtXTi1UBzlURl4zWCCBPRSaE2zXLL7LoohUrMxmg+bxRB1eGzEUWkciVwE=@vger.kernel.org X-Gm-Message-State: AFuF++lu2FMATjTglah0n8n33siMWiKjeQY3xXA4MGJaKMrChEwQ5qkb eg+SzRO6F5jOHZXw8vwHpj4OQ5T+FRuo0ZSU/jr1IPPYzDPVwNz7nfUy X-Gm-Gg: AYBFou12qmdD6SbJojJGjF+ld0ysGuF22hrZmtTMQWEJlP747DOtdoSMLwinNnX2XrW 7Gz95oaGle9d9xzfE7ip50VwHh8nKjkuxl+03Zmsi9cj8irISDCExZawKmA8wFXHDpBregxRMDc Lf0bNJf0yrvw9IlJncYCxJED566lL8btqDYc2IBeDUUo+c4TmWcZyRlSdFUbLCIJ59isYWP6mip rQGtoAb6iIZ2qplPIRRKmYhTGMJFgtxp5kKG1ELRODzyzyLav5tIoqkyBVS77v28ScnHG8mPHiA HsGhlWKlaWjRqUjz1I/fOxvcL5wKj8WZSpjgC4Li/ubpkWamwbJjZTME5jEusl3cvcpDO41Dbrb +O7Qj22Nvdci9ahXqoGvcPd2ZMyussQj5ls1Cs0gPhY1pr3GntJw3Rhnrm8wcgYfYpmwuSjhJO/ WO8e3VAarVUkwNsbotvEqzWB3PvhCnsd2O7Vx7WybRfqhCA4SR9uanzOYFgvaCBRgO/657HQ== X-Received: by 2002:a05:6a00:2ea4:b0:878:3519:aff8 with SMTP id d2e1a72fcca58-8783528fd86mr4832913b3a.55.1789923735267; Sun, 20 Sep 2026 10:02:15 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:02:13 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 01/11] net: stmmac: move XPCS lifetime management to platform drivers Date: Mon, 21 Sep 2026 01:01:05 +0800 Message-ID: <20260920170116.3624104-2-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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 cannot be used by phylink for PCS operations. The framework requires select_pcs() to return the PCS to the core, so the pcs-handle property becomes effectively useless for link management without the matching callback. The XPCS is still consulted by stmmac_phylink_setup() and stmmac_init_phy(), which makes the configuration silently half-working rather than clearly broken. 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. Note that this also removes the generic "pcs-handle" parsing from the common code. A glue that does not set pcs_init() now leaves priv->hw->xpcs as NULL, and "pcs-handle" becomes a no-op for it. No in-tree platform relies on this path: every DTS that pairs a dwmac node with a PCS goes through a glue that sets pcs_init() (Intel, Renesas, RZ/N1, SoCFPGA, Rockchip). 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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f7.google.com (mail-pz2-f7.google.com [74.125.228.7]) (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 8815C3515D4 for ; Sun, 20 Sep 2026 17:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923746; cv=none; b=PvE9b/jFa9gq8pnoMITM+0ttRi38pgSKmUU95p8TEWIshD7Utx9OmB6HYPcJEBU8YNARm/nYI8nwu4galPYxjBFAOCO2rX1TEriYi/3gaiqXaemYsRE8uXWpcVfSUaaWVPGEn39zhOwdI50dPpiKD3wc8UDSMXZY8vWpwGSnW1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923746; c=relaxed/simple; bh=RQ8/bIf5S9U/FiX3uQoU1u6/FV6K7LLD2uqZys3J7EY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ANLnfiIGafWSJGr5abUbi5HJgU5nxQVrt3ZUNo9Uk5IMOkZXTVpUoEXi5y7Etyc6fH6wQqWed9SdS+Zafg94TFODPhrxQ48NmtSxUSC+oWxWL/3uVe/R45AoB4OVZattqY/5vkYK5nmTK3tmrkEmWkeFSCuobaWi4yIHDD3p2k8= 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=GSrVPADM; arc=none smtp.client-ip=74.125.228.7 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="GSrVPADM" Received: by mail-pz2-f7.google.com with SMTP id 41be03b00d2f7-cc4b166d0dbso781530a12.1 for ; Sun, 20 Sep 2026 10:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923745; x=1790528545; 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=GSrVPADMJ7gNakzuAequcbGwu71JjXBCM6cSVsLQtuFeLPiLB+ZdFwvOUpLvND2oRX kD3fFLPE5sk1qxYiRvDFZrH1Da+Mg5WK848/pwAXmLU2sGnLc0BwPhJUuumtZ9NSWgrt e2+KzHVqz6lEdOCudgAU9b/WWHoCVhepMQ0/fQQtug2UZA/c3U7zR+ia4fcgqSnV++al /XTl7DCaKw2VKlBBr46Qn6dI3hCftWPG2LQo+oG3DtrtSZybIRNEZ/IziJMcA0a5W33v q35yrj/SAfC7E7a48SEJban9cW1v4VtQl4T1/UWbsH6woO1Ov+SFjJ8QpSn2ZW7igvWs wxgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923745; x=1790528545; 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=HzOxaCReWa2yAaGhx2CBnW3eySPZWTx4MLrZylYntJT9U4DjaDl2QT4bD+emkpcjSx qwkw3kLcN0cF4YdCiX6rtH4EkmFeR9DDY01lDxE2TVu3mnyrzU6lOe4r1ZkCypmQgAu+ om+NGJS9FK4fs7leapWW3v+Fo0zajQCyn+xKq6ndabTLllhCjUlDyaZEfjukFQ6s9UYf hImiQuydW0ajTlQV9Isntzk0wVRHaxiSMzB9g2DGR1ZT74Hi3VFEWsdsic/V9M5pgbpv MyZdIRCQBMfBK134bJcL82eWGp4wqcWbqo7QFaQvcIDJjivJsSLxj+gi1TF+q6xEY7KP FANQ== X-Forwarded-Encrypted: i=1; AKwUvBxcF5qsIg8L0DwZ94JrwZUj43DE9Rcphf5m5rg3YGZ3s2pBQ6z3VPxBHflYGmnxaO7zWjyjEhfgSynEG2E=@vger.kernel.org X-Gm-Message-State: AFuF++lEoVqhoIvQ4yMQhz/CE6hCeq623koTppahat0F70wFlOSznVPh rOsD8ufaxZgSuVCfNSiIji2HDm7l/qP4O6qVB20X5f3fk/+2tthBrYhQ X-Gm-Gg: AYBFou2/EHSldTZT2YyPPw3KYmSzGvYjoAHhjFmDnaGDve8sL64qlrjl8PAmHDjlpxy 951XqB9DfBPhXeE1Jdp0EoKWV9E9M0ZZcsL27In3d1GCtBjTBEEXxK1zAnyqEeysr8Pgg9w0wNg IOtcGDihf0igD3XKKry0nNd/s7hjY0C3RgyqoAPHXJVkwiUWXRruJKzoQ9YkcpU/DwzxEcsyYqV xKPd83y+JX17h3t8z2OxriPCaINmVcHemF1ChQXuu4wLzqD9kJyYQFwmLi9H2S5EXtINHekgMjC 9P2KGdHaO6wWxrh8dEN+8pUtYlVuoFH5ZRz1gtlvi/nv/w+OuvfOphldWnykCapyazVoIYQ9PjN O9tg+ulrmktunQ6fe/yiAj7Lmv0/IgDPcTncPT3Cv5/xbsybnFNaY78G6Vp4biYsvXX4q1uKEjY Gy6R8JIQVQVuvmZ/ZLiONxNxqUX3/6ok1WujQPU3Znj8noY+I5bxySsSJBkCm1EYNWOjKcIlufD LIVur8F X-Received: by 2002:a05:6a00:298e:b0:874:708d:b621 with SMTP id d2e1a72fcca58-874e02e5f4dmr13003999b3a.31.1789923744661; Sun, 20 Sep 2026 10:02:24 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:02: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-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 02/11] dt-bindings: phy: rockchip: naneng-combphy: add rockchip,sgmii-mac-sel property Date: Mon, 21 Sep 2026 01:01:06 +0800 Message-ID: <20260920170116.3624104-3-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f3.google.com (mail-pz2-f3.google.com [74.125.228.3]) (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 F323C3C584F for ; Sun, 20 Sep 2026 17:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923756; cv=none; b=thHj+C5/34qRCd2uEQgOCsgWTiWVlok9ogxNv2cK6Jimj03J1PRa4G6Hd+EXC6DEYkIUnYKxpG2LWesbZ0d8a2f/OE9B4uLYl10eqMGVJWS/oASoZcPsu1ymIo/4mEDkvDH/DSrSWle15HbY9IiZ+jfkwATDuXfB87YPingdQSU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923756; c=relaxed/simple; bh=kq0vt9SckJqy94uGlHWiGVuBk0MckU/fwsg6pcjJXHQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ipr/Rf6bU5XcXxKS/XmvVmzCCL2NkG4ZPHBOlFC169/eIZvR8KZksIg6OysWhImLLH6cnEfSxRMQnxAhq4ibstktTt+HxlqJWC7INizR+5B9OVqvTkSTTY8QmovBqXuB1EDxn8zNers98sUu+TUZa4pMo6oM7KvQA+5UKOUXYro= 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=g2Kj9Ksc; arc=none smtp.client-ip=74.125.228.3 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="g2Kj9Ksc" Received: by mail-pz2-f3.google.com with SMTP id 41be03b00d2f7-cc1beca96deso1321839a12.0 for ; Sun, 20 Sep 2026 10:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923754; x=1790528554; 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=8Rz7MTGiT2Oa/TzTvQEqnIct/KOrKk64RBkMgo9sxQM=; b=g2Kj9KscFoyJYRzVRZmyzi0QT6d6oeV4BLGr13GOm+HyQf2pW94rnXndqfB4MUCtwT sHS1sNybLZW6eCT1+HiUwMBdVVaC2Es3MGRk3TJ+c77PuDN1KBWNSz7j9wMMQTHuzpOd Xd1sTShyadbCVcLQU3IQhOhJRUFWJML2M6iR3nSuixyOFmXmc1IswZBVdr2KqchNXTI3 L74Bu6FSsIJWcdf5Bffs4nblExl0zSG7cC3A3ThfiDmzJ1F8DpV+Asw3IdO1BhzrvpAV iQhHAFw3sdGGf8RQ+bko7ChPD9JOPpWFZC5HOMnQq66wiR2MAwIlvI7E/d/I4T7Yz9Xx 84+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923754; x=1790528554; 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=8Rz7MTGiT2Oa/TzTvQEqnIct/KOrKk64RBkMgo9sxQM=; b=Ej4ZnWXmN9aYxK6dQ40rjTBT5B8x0WQc11S65wbiGvRKRE8wkdjB1iLA/u7cdO4Gdk DPQV0O0khrufSrBaku6pi8sv9xiWnPIXfJp/8WLmrKAEClw9QpoZC6j1cBWuOtPYiB3O 8YFmMMU7I8EtSHOIYMrGI6suy59nzLeUmO7JCxw7NUJd67lAuLDgOTYoygM9fr6YAlFW vu/bbKkSgTqLt20Go8cKsCdvokB0aGYe7wFF7nGHwtmJmANokRS35Z21lkGZP+DWCHPS iXij6S8/nTSVJY6VVw2Eyvt8vnnOiCmyIJ/MxDKxzO+KPX9QM3jjvQTjXH+fgrLG+diL qGSQ== X-Forwarded-Encrypted: i=1; AKwUvBxHyGMoLAMAB5NtGvfIUiuXos3A6THpdmH5dp7/l78wrweCjEcA8TVW5TpOM+jdXrlsfSW+oZ4sfD9mz1Q=@vger.kernel.org X-Gm-Message-State: AFuF++mUMUKTubhDMYhnX50eTEzI1DqcTDKM1cWtVQ7P291A0R2har0m XD6HMTSfu8AI/Ad4Rtf889/cKPiYQiaV/52IpuZprWwa2yzwKlOqRfoa X-Gm-Gg: AYBFou1cs15OloRWRZJIETSTYx6r7+gD9TzW3lrI3FAlkV6HrKXvkPsIrhYJYh1vdAz PbV8y0Wup3+UEs8RNY1pEGX1x0Pk8JyAl8XK7ocZ96AngmF9Aq9rnNQaWn7eEAJU72dp9EC/UzI BPDd3adShp6WPbSosCfWg+9WuCg94oLC8Z6+4L5iDb1AuyDpLOWybIiiQxRkzVeKnCTlofueRJ8 L4Lon7+mwMhMnnXAVog3Vi75i984KMFYOjHE5lIfKDNaXaxC350PgXfcRV4IY/hFbR59abXMWZB ahhJgdsCZHWFEWJP6AfIRnniRTUkxs5tmQ9aZmaLAtPahc6atzIZa1wsJTqBc31tBrj/I74mTkR Nx3sC9687dUc1pXBUUxrh8TWXO1PbH8smZxGYCqrEDWUdPJmJca8J7Wp3bP8UAmKLJNcGw+JUTz /dwrrGgrzVaeqQDoxYuQ8OxCGCxTYw3WMBFbNyhHCiSje+hlplVIkCzNDyCtI38SGOoBYKZQwHu sH3idQP X-Received: by 2002:a05:6a00:bd88:b0:870:8e80:3ac0 with SMTP id d2e1a72fcca58-874dc7ee0b6mr12066553b3a.11.1789923754245; Sun, 20 Sep 2026 10:02:34 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:02: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-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 03/11] phy: rockchip: naneng-combphy: add SGMII MAC selection for RK3568 Date: Mon, 21 Sep 2026 01:01:07 +0800 Message-ID: <20260920170116.3624104-4-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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. Out-of-range values are rejected by dtschema, so the driver does not duplicate the range check. 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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f7.google.com (mail-pz2-f7.google.com [74.125.228.7]) (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 08F80470425 for ; Sun, 20 Sep 2026 17:02:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923767; cv=none; b=AQ7xn7l3UmMuP3wKrNw3OYpC5f/jwtC6E5xWmNIBBZ9ZIMsXlNLU25vYxj4vDe1/Symek+loPqNieYb3GB3IwB8hZyxNTL8GFH6YxwxZCjKEpP69nNrBSWIibiLaeGplLSh5EZoMOjhxBPHlja8QyK+XRT1JdDRZut+3pbT30oM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923767; c=relaxed/simple; bh=uIxFaIx1maUJPzb10cLtB0jKa27JO2f3e4ujLzs23xQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UzkkRcJpbAd0k+i3h+NkV04Wy9uu8n/7GrnJ150EovM6UghKeafV1pBEhaJKN4YmH6HvuYO2XqZZdqYFgdlc0FdkCH1+xTkj9CxLDpWlAuxMnTt+sy8r7wBMb68Ma8R30sZYabkk2tGlZmhXj56rWRxoZ3iCuPLLvy+OQ3FDH2A= 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=V5BKoo55; arc=none smtp.client-ip=74.125.228.7 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="V5BKoo55" Received: by mail-pz2-f7.google.com with SMTP id 41be03b00d2f7-cc53988d9f3so1289028a12.0 for ; Sun, 20 Sep 2026 10:02:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923763; x=1790528563; 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=WzUxf96lJcOF3iW8gS5QIxqqy13/2PJtTrFNEXc29ug=; b=V5BKoo55auUmmC59BNtyVmayoz8K+TqTox3t9JKiwQXo0mVQf0geLw+rquAmvfbgu8 rvHtDJnifcEfNdHDy+fyfDg3Qomh19Rv54aOLMTCle8l/O2zmxWr/sc+gd1/n2ZS5+8S w+y0dq3ATk4TOTIwHbkCxeU+xiPDxC8e/DKgUWgG929oRvGe/iROD3I0Fv66Ogqq9IUM TjuamVkbxpH+R6nP1qMFR1iVhD3v81Y/Wfyh4YjpuHYLDcnObO2odqwdXTd18wIzh5mG VhzDbGlrceC8wONv3MKV7okal/+pH/kUK59vac7mCMSdBV7TYg0hjnEtTDdDAu7rLRda RiAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923763; x=1790528563; 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=WzUxf96lJcOF3iW8gS5QIxqqy13/2PJtTrFNEXc29ug=; b=Lqp4cRm3K6+uHKrCselsUeGAWMo9aMm6nQ3rfcWVlzn5wMcRUyKkdTgKOGVIOM6Kj0 7e5q54pEB7yTqBWmA6WSuzfVzGwK9LYXwcAPyTtjD8ebZ7vU7QFUvAjiWkK0loQwcK2W FVNWpqoKqR7WCw52r1dKtpXkf04/CH+aia2VXs9Dh09Ur6MdpvZOwF3B6tU7UawxwkuW UY4X5VWnbsM/yMnxEcoFOBkxslyWusIyUM/dLP9cQTB7Z4jhGUXyOyHnkLJOuFlt695O qR1e1LevjqFKnCMIj3vg8/ARCBa3dIouzI1zbbf5E2rG1UmIMld5mkV+v+JbLgWRWYLr TnjA== X-Forwarded-Encrypted: i=1; AKwUvBxT6DJR0gDaW+ngye8zy+++5tUCTSkGaW4PJ/KRGnZpBLsLKO9HKUEOb0zbbDeBZqVpvM1630MaWmm7XQs=@vger.kernel.org X-Gm-Message-State: AFuF++k7ZH1CGfojLchdDHSEudA585xkIHml9Ea2PEmaU35wc2/IZkB5 XuICZdQIa5qVRq4yBvp2RclkCJtTLP//Dnvc5bffnWLckj4LG9GY33G1 X-Gm-Gg: AYBFou3I6YFCiVsnwT8233RnTFcssIyX4Ay3gOghDmBabFjvURgR211T2j0H1XvlVE9 pa3WuKIQP2qtUA8AKDuGUB1hlLDiKUV9DgyXLqjVbLu/2J9+q7Kjft3/ZTSb90FQxcShVK/K7Zv 6XLbXRhzw/A+K/kDZqN7ZJ8ukhgS7VIYwKjA0uzChXWmMBgC8LXJKcZ9XvvOPLjq7wPebtG8Efi uso9EEwOCYVR2w0GQZzhOnX1JIjhjbpGpwxuyEhXKccc48ae6Iwb7S6I5AKTjbvBhj/qy8ueHNq Xn8jUUbSSPwHhZ/GlZf/DjeT8OL+LndGqYc/U95w9//sXPM1F5KEZIyVYdSbToz1CNmgNcx3ch8 EHMWhKCXCLBuhRG885TYXi+xuhOjVHSNCPk6rrfewGsSs7CLBBmUXNZopJt/VgYmVfUSQ76eldU eTfBRMbwjb/ReFDUqEmUq1dwUi0DHa6SyCq5pT3cwCo/yPYUFeOBo2APROzdDJs7y7suPPOA== X-Received: by 2002:a05:6a00:8010:b0:874:706d:856a with SMTP id d2e1a72fcca58-874de307e79mr11865330b3a.27.1789923762894; Sun, 20 Sep 2026 10:02:42 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.02.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:02: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-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 04/11] dt-bindings: net: pcs: add rockchip,rk3568-xpcs support Date: Mon, 21 Sep 2026 01:01:08 +0800 Message-ID: <20260920170116.3624104-5-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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. The four MII ports are described as ethernet-pcs-mii@N child nodes, consumed by the Rockchip XPCS glue driver later in this series. phys and phy-names are required because dtbs_check only validates required properties for enabled nodes. The SerDes link is a board-level design choice (combphy1 on some boards, combphy2 on others), so these properties must be provided by the board device tree, not the SoC dtsi. The CRU reset lines (SRST_XPCS*) are intentionally not described: no in-tree user requests them, and bring-up relies on the PD_PIPE power domain, the SerDes PHY and the in-IP soft reset. They can be added later as optional without breaking ABI. 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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f4.google.com (mail-pz2-f4.google.com [74.125.228.4]) (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 52A373C584F for ; Sun, 20 Sep 2026 17:02:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923775; cv=none; b=VS6S9jUNtvoRCBt/uvftdetbwOnZTRV4igIc+A9NN2lQPVkom5xBBCXG9tvGgM4tTLxkIG4lv4GCSb/gKwAfbKfTjMnHt7dSWrxNtjYa3PLcAtJuqKQ7BoOk5Ux+/MFT5AiAGlw4VW6YCibu95az4vsoiK6zjOl7WwdzvJf+PRA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923775; c=relaxed/simple; bh=eV/MZpigoY7eQVTxB//FZOps8t3Fw+uKiqpIed3H7yU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ICJsx3JCzhf8KJoBDjeqPV2NBReNxZBSNyR7tEiN7e2iNOd0FAOoQRAjabI7in0VgCHr64uuRJ68bJ0YEZU1/aqbsX+ijpFmyYxq4zQs9xl0oE3VC/K3ku+pVRP8/bC9TBbzA8rs+/d1M9NL9zMpzgbWMSFtutVl8umVHZGJ/Ks= 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=CYM0e5TZ; arc=none smtp.client-ip=74.125.228.4 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="CYM0e5TZ" Received: by mail-pz2-f4.google.com with SMTP id 41be03b00d2f7-cc4b14f0364so950351a12.1 for ; Sun, 20 Sep 2026 10:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923771; x=1790528571; 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=Mg8/YZyIZ3CihMksQCv23yBYBJSGhmM45ppIsWYSP5M=; b=CYM0e5TZCVwoa98/M0TqxxKHtvDo8BA7FhxiJHWSXK66zGBba08pLcOtGzeLuelziS s3TUYmlAuM37Lr823h/A3VzOWlN7/QgDjvg2Hdn8MIrWuPzd1lWqLxfTBvsmhXNWG5at s1Jz09oRT7TvWHy1UPaCNvH6/BvRMs4dcuqO1DraEiB4PQBAqiFpm6g5YhfV8h8TNNXI 3vm7dlFlWtDiKuuzwkJEBbuXQURjYQEkvm7qkBtburV5QewwV2JgjEwgiV5UhCse4Qwt h5jPkB7fR9bsVo7IeZjqzqyTYBSoFLDzxBZb+uuCGchEWZyqrFS5+qvQCo+QhA+eCuXB wkoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923771; x=1790528571; 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=Mg8/YZyIZ3CihMksQCv23yBYBJSGhmM45ppIsWYSP5M=; b=jLtbnVMH65U1yzLzN9qYNrjHj2gj6JyYxrhJicNwhlVz5RpxRji/nMl5gVcvNHazGl 9Hb/C1XW7xgMlIoyqLDMbFzqDvOwSwURKmIgP2fTCrI+C7eonAbts+jQqzUvy4bCZQIR hlRP0UQvv9RioD35HnVG29yg2xT97axSY/5zLrDR3YrwA20TijydhTc5aSCduTCSTKeJ kQNkUqmUpSK7vLVDH7ER4rb9sBUQa8Ry8P0gHDB3jJ62UgFyPVjVm2KxRflq0q0IsGqz dL+uChsXBfW5TIg1SDx40o9QT+dUdwIljSGnGSxgb3tBni8883az7AT9MBmzzQnFkUBy lhFg== X-Forwarded-Encrypted: i=1; AKwUvBz1kgVW6V6kooShYEpkKRX+LpaMTUYGmlBPWBy/ZmNA2Q22/JIOJjJYKDVRgfIZ71uI4t6pXxVbMgCpfX8=@vger.kernel.org X-Gm-Message-State: AFuF++k/Td9vyl4BujUBF8nSZJgFmU9aK0A308zcXPufInINRj1+3TMy IxxU7VLFSMb28+iVgcmpluLCcw96OASBTmpL3iYIg0Nq4gBDbZ0Xq6Ri X-Gm-Gg: AYBFou0PGgWp66EJdwXPxrLVrtbkDN2cz5yLazYBcc81IDHsJGHIAkZuxUVX/UhNvqB HS2BG688WXMwwvwXhfi1PDK1zBs2eL3Gj6qgNfMW6CZKHGc99zht7xOlyqCLybWkljxxX5ZV9nQ VY6PjjjDBfcEz588FY6IYWBAk/6E5wCM0XNQRu84Ib3WE6PXCehl2lJTmvVYERDUAe9N0Al9m73 ocndWN2+6m9tOPQMhdrJdH86QZlqlwuU4UrGAre1FvGezYp+E62b4DzcJ1m/JEdKNVuTCUET0pQ lo1NSMwojXZtR5ZSdwC3nYVfwY7weuR8uBdtndUkA/FgI9ydH2PFSCKLcCsOJomU+nDxeDDvyFL bQdtnqpFIVHUob+3r3XuT8hebklgDNzneuVvRMnAB8QuKL++W3XMiBMI+IujD5TN4b1Hbv1J2Wf zSvDbHdxoVpT8TfjFRUuKLcTcADOxQuqNNntfeYbj2sVdKQqBfaJV1s5z/mfDYz6BgqfnkyGzlF otfcBKs X-Received: by 2002:a05:6a00:1ca2:b0:851:8baf:5b26 with SMTP id d2e1a72fcca58-874dc5eb6b5mr12081998b3a.14.1789923771468; Sun, 20 Sep 2026 10:02:51 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:02: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-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 05/11] arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes Date: Mon, 21 Sep 2026 01:01:09 +0800 Message-ID: <20260920170116.3624104-6-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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 (clock-xpcs-gmac0 and clock-xpcs-gmac1, labelled clk_gmac0_xpcs_mii and clk_gmac1_xpcs_mii) providing the 125 MHz reference clock for the GMACs when operating with XPCS. Their clock-output-names match the CRU mux parent names in clk-rk3568.c, so boards can reparent SCLK_GMAC0_RX_TX / SCLK_GMAC1_RX_TX through assigned-clock-parents. The XPCS node and its 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 requires a reference to the appropriate Naneng Combo PHY via the phys property. dtbs_check only validates required properties for enabled nodes, so the SoC dtsi does not provide phys/phy-names: boards that enable the XPCS must supply them, since the SerDes link is a board-level design choice (combphy1 on some boards, combphy2 on others). 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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f7.google.com (mail-pz2-f7.google.com [74.125.228.7]) (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 C9B2E470105 for ; Sun, 20 Sep 2026 17:03:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923784; cv=none; b=HlGSHf9tGdRHVphdk1QXCqqyS0fErYzRFv62HfBnYyav/j6KcW7E83Y+PAbUKLKwrr/tK9TTLAyyXY/kVbBlFarjKVwbO49Cwvl4IxcRrV5hI2nVmv9fXa/cvitL7MdwQ3ZEtOs0ysQoo3F/6KAOqNiMPMSRKB2FJUpLDynOAvQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923784; c=relaxed/simple; bh=k9eLD1ZrXZD1iMizDWP4jTUk+ML36ocfJ7jazjazAIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E85WrkHimXvYl5/OCSOeWIp36i93+HbtJO40FPthKh2b1Z8nfSatr3WNBXdBmnvlqhXXK5ZtHq5iMJHi8EuMuSGvM7cfe7t3IZ2sVTjXd+4v27WpNaGMOYP8HyCFeJPVBP44AFel3vyr+56OaNOqtsLhSAsXMcsf4Hn37F9PHNY= 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=SQuWtDcE; arc=none smtp.client-ip=74.125.228.7 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="SQuWtDcE" Received: by mail-pz2-f7.google.com with SMTP id 41be03b00d2f7-cc4b166d0dbso781649a12.1 for ; Sun, 20 Sep 2026 10:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923780; x=1790528580; 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=s/eBjsMbUu4KmQPd6dfybXXRKRWzlAuXWPZqO5pNdlA=; b=SQuWtDcEhZo0BLuuqbqYiePwXo9TrwmB71FZb/t8KQr+ftutAecETKXxmq3aCGnjQ+ IXYSK8NuVs9jFZroIK5+yL9slZo4hhsRDIEVeVVMQlSaZkMCbCfcxi4R+ws0HYyRl6C+ CbA784qWzNdSrJw8hzHN6vDE/Una2A7DpwDDMgEzSjStumIxnhse08vLRyxUhCwEVGu8 b8NTAn3HUS34IhTxz2MqcJRa/9RSLTpWGku57O2/LiKcDHvN5yRDw0mW5O4hNtOeonPH rrep0lwGm3XKACOU+fYG0ZI7SXdvI4+ZRPVXFld9G/Qp4VZtTefZplLSNpr+O00aD7nl 7g1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923780; x=1790528580; 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=s/eBjsMbUu4KmQPd6dfybXXRKRWzlAuXWPZqO5pNdlA=; b=kz5sW3o96m/MGCg4BOzgdPPF9AINlk/w8HChxJxrE+or26bPgzR8KSMDAGtHG5OcL2 SGhgrWzztfP//6eCJTMcIVFrYUK8hK2CTSs2afD3UXRaCfbcmhAPy0FNTIJt/or4Q3e9 1t9IOBCVtbDetII6fVX1pEdTFBrU2NqAdkdO2UlZWaI/cp3VGJ7gGcYchs8ZXbnIr+vo KhCEb7xZyETfaWtqgqqehVWIc0KtmvVi3CI8ILDOH2qI2JqnpvAn1TU1/m1cQWremiPy jSVSdiMkTSy+Eo9n7JirCnPq7qCuzK2UAshWBpzhCds9d1ZZCuKPE3cCX5jIHntIFrIl /Xww== X-Forwarded-Encrypted: i=1; AKwUvBysS2lt52xLfYaAD6xng48WxXnFlNEaT313jXUzdXn/UIkEsGQGh2QEi0fz4DPOsE13JEbJEkp5GKAc/E4=@vger.kernel.org X-Gm-Message-State: AFuF++nCj/XgUyKOyioCBL7PE0q8QiuwWskbag60xUMJKHBKOGbJp9+f 5BjjTMkfETxnAQmp6C8Q7Nyz4TtSxS70PK8X82WHn8WUJTFf+TXK/WdC X-Gm-Gg: AYBFou0QoRhegvXKfcsgvt6Xxqc4G/ivomIFAH2ZjGMlfsw14lICqp8l4oGFgDIXErJ zM7Kr5XeyhcUXJ/Sl0PbsSP+OeYiVXyz3a0ONXwKE4GaFiI+LtUzdcUIoiNXGL4z8skRmzFHJWk mAgrC1/B+e5N++t0yK7vjd89ic5Do0qcLbGQ8+16Vx9GEe/O9PFPNGPDyK0nXWT532sbu/M95mt NoX09MdZn3QOrtEofWrZkB0N9M2aUHAI5zuQhUkxg3f0uD76IOb8+3R2x4e+nex5G1ncOYkXLAJ 5yBD8wk1kr5g9oJIWhd9gNLrheB885lvQF0od2EvCVA1EAW/VRtK1SlUbTPZ/iiIExGOxogPdsO RzTPZfT/ORAy1QOOYb0Z4K0rjG+wwapuD6lRBfEnCEHIeFF+iYJ/SkxitOaA68v9UXx5Hkk0aFl qnp/wlAa+CfH9dIMH8q4gi/V+ZUEMf6UrbWF0G+5ZqDjIiYf2g3misoN74tVysJDwdK1dR7g== X-Received: by 2002:a05:6a00:ab89:b0:84a:29a7:f3b1 with SMTP id d2e1a72fcca58-874decf5c32mr11449622b3a.16.1789923780066; Sun, 20 Sep 2026 10:03:00 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:02:59 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Jiawen Wu Subject: [PATCH net-next v9 06/11] net: pcs: xpcs: add ANRESTART support for SGMII link recovery Date: Mon, 21 Sep 2026 01:01:10 +0800 Message-ID: <20260920170116.3624104-7-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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. The restart cannot go through the .pcs_an_restart op: phylink only calls it for 802.3z interfaces, and SGMII is not one. Changing hardware state from pcs_get_state() is already done elsewhere in this driver (xpcs_get_state_c73() calls xpcs_soft_reset() and xpcs_do_config()), so the same pattern is used here. The latch is cleared before issuing the restart, not after: clearing it afterwards would discard a freshly latched ANCMPLT from the new negotiation. If an MDIO access fails at this point, it indicates an unrecoverable hardware condition until reset. 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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f9.google.com (mail-pz2-f9.google.com [74.125.228.9]) (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 D4AC5470E91 for ; Sun, 20 Sep 2026 17:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923792; cv=none; b=e25ZV6ZSWRQhN9Lza+6os+X2E/GKo5XskHKL4i8LB+ArwmwssRSIbH2+/lyewq+63hqERw9VJLOq/T69DVAp4BKcuzZNL2Xu6SlS/1VcynyeIPsP9G/qj2sQAPedfP4ZfIdpahViDRPe9OXBS/sOL6auqUQqttmougNMMzps/Lg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923792; c=relaxed/simple; bh=e49br5rc4/YyJKcHZeqyOyMCEyNCuiXZmOF0IE9GSqo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JEeMhl1CNwcHtXm94RU286ABNj2rRSSw9S4CUTeQs3J8v3SZk/KIDhOml2UA06mab9/k4WROREvLUpT7lD0H9y91FvUNLJPnW2ySaADJVRjR53xzRhjp9mprpmijVq/Z/c2eA0WqfiBLBVYg60g1ChyP+k54tX2Bg4M24LIYSHE= 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=dbNy0Yd7; arc=none smtp.client-ip=74.125.228.9 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="dbNy0Yd7" Received: by mail-pz2-f9.google.com with SMTP id 41be03b00d2f7-cc1631a57d2so1684572a12.0 for ; Sun, 20 Sep 2026 10:03:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923789; x=1790528589; 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=nSBzu7oK5CAnRQzt1TN75wEtFKMU/iUXT7srnsHlswo=; b=dbNy0Yd7kFvqHTm3JFssYdaFIVsoqKIvznEXEVz3P5kdfJn3m1uAt+xJ/HTJ3NYks4 7uOrKBbGHZsv6P7lUUKehEwS4pb+MKA2Y5CmFnKy+LEyx3tq05As4lxFt1YjcOr6T6yb YbJGD/kBoN9laT4AV6ePjHMoI1Nr4hHlK08+Uk8PO9QaJ5xyq7DF/UtknoTsDIJ4MhrA eaVMlcYsoHY/R+QCRTfGyJJ6ydOtZL1myKhVZOonkLklw/0LTRC8g7GmfQOxCh8sdQda eOPOwgua+FOMY0dSg4hsZvb4U/GllhsNw9z8Qbh0XoLTgpZEPCTH1Mp5bqfStGZpM8kd BxYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923789; x=1790528589; 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=nSBzu7oK5CAnRQzt1TN75wEtFKMU/iUXT7srnsHlswo=; b=eVZc5ZyniijyAq0qvyzwnhFbJxAJ2EwldJ60mJX3/UWP6qTPC5YPhm5DkfvHAPb9X9 A5fXWYKenXgLiuk/M4ND8Ic5kDkyOGyCgtG2xNBK1UQHpkYz67UUcYKsFRgtsizWsnN2 zQhnaVVKA59oEKsLMHAIJ1ETII1RQg0SRMxIf2FFPAvMluxErB7/7z/ttqUe8LIbvgLk VW+V3LV6bqzIg6ZJlxnZfB+j6qj8I4SLmi9FWwMxUZ4S7fYYpn9O/mvklkQvwWQzAdKe 2sjl8dEiusZwsw62vpbG9oMuA0HWdX6NA+WtcaXpav6kUUKC17J4Z7vyb45GFOBU1ns5 cekQ== X-Forwarded-Encrypted: i=1; AKwUvBxCcx5sJXARG2C9OQWo3hEQRD8qePNWNNAg7MMWOC1az04IqsMe+2fxUzf+97g1Ns2sYGWWkNujBVhYaLg=@vger.kernel.org X-Gm-Message-State: AFuF++nrSk7n69Y0Mg3xrSDgpUbyfmOieiYQeMFq9ap5v1w7vlW3b4oD uZKdVsBwJM9gExuc280C2+ITtdkNK1dlnuDaamGL0OAsMnKfvomgUiSh X-Gm-Gg: AYBFou0LmMF6OOOkJEVboHpNfP4TEOHHGybwOpqDLAsVIBmQYiWD5Y8hBdreM1HK9rm XshAuZ/vgTZGIyoAeL/key2aKBpjKZ3aIi790Z9UjGqk2tvth1QiTdKT4H4DdqKvuKcTTsSs0Gj qP+qoESwk1VJPa0KZrJbVmG6X2PX+LONdbGiLLPt156ADaRNed+xwA1vpOsgBrerk/YAfo/sT/G 5DJTbb76d6C61YJRa+NBY6M/wjkiCv+fQLqRxBWG1kb4QZ80hvjNIauq1Y+SRs/sIXw2X0Z6YCz nu39IjZbCJUejBhjU/9AXSjnoN637Syc/KxH7OZlvT0Vrc9nfgpKv3XqgfR5jMLdfAv4YHDNdvn gaBtnT4ZVHV+rmcM52EbvCfCebu3h8/mwoEG4EdL8nsXyTDhpddF1nMW71XxSPhbOw2ShOUZWtI GcAqvkZPcQN7u/N5IKRQUN5D25rH4FosJEmqbRQgdxAHBVfQ53e2QAfq2UOXRWVnz/N2EHSmqSV ppqUVg3 X-Received: by 2002:a05:6a00:8089:b0:878:3830:a487 with SMTP id d2e1a72fcca58-8783830a797mr4796246b3a.55.1789923789149; Sun, 20 Sep 2026 10:03:09 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:03: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-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 07/11] net: pcs: xpcs: add Rockchip RK3568 platform glue driver Date: Mon, 21 Sep 2026 01:01:11 +0800 Message-ID: <20260920170116.3624104-8-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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. PCS_XPCS_ROCKCHIP selects GENERIC_PHY and PM_GENERIC_DOMAINS. ARCH_ROCKCHIP already selects PM, so the dependency of PM_GENERIC_DOMAINS on PM is satisfied on the target platform. 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 | 599 ++++++++++++++++++++++++++++++++ include/linux/pcs/pcs-xpcs-rk.h | 11 + 4 files changed, 638 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..5382afcf95748 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 if PM + 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..91e76733267e0 --- /dev/null +++ b/drivers/net/pcs/pcs-xpcs-rk.c @@ -0,0 +1,599 @@ +// 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. The mux only provides + * 125 MHz or 200 MHz, so the rate cannot drop below the 5 MHz + * threshold where DIV_ROUND_CLOSEST_ULL() would return 0 and the + * subtraction below would underflow. + */ + 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 device_link *link; + 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); + + /* + * Establish the device link before reading the supplier's drvdata. + * device_link_add() does not fail on a supplier that is unbinding: + * it creates the link in DL_STATE_SUPPLIER_UNBIND. Whether the link + * actually protects the drvdata depends on the supplier's state at + * creation time. + * + * Check link->supplier->links.status right after creation. If the + * supplier was DL_DEV_DRIVER_BOUND, the link is in + * DL_STATE_CONSUMER_PROBE and device_links_unbind_consumers() will + * wait for this probe to finish before unbinding the supplier, so + * the drvdata stays valid for the rest of the function. Any other + * state means the supplier is not usable yet; defer and retry. + * + * The link is released automatically when the consumer device is + * destroyed (DL_FLAG_AUTOREMOVE_CONSUMER), so no explicit + * device_link_remove() is needed on the failure paths. + */ + link =3D device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_CONSUMER); + if (!link) { + put_device(&pdev->dev); + return ERR_PTR(-EPROBE_DEFER); + } + + if (READ_ONCE(link->supplier->links.status) !=3D DL_DEV_DRIVER_BOUND) { + put_device(&pdev->dev); + return ERR_PTR(-EPROBE_DEFER); + } + + pxpcs =3D platform_get_drvdata(pdev); + if (!pxpcs || !pxpcs->bus) { + put_device(&pdev->dev); + return ERR_PTR(-EPROBE_DEFER); + } + + xpcs =3D xpcs_create_mdiodev(pxpcs->bus, (int)port); + if (IS_ERR(xpcs)) { + 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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f2.google.com (mail-pz2-f2.google.com [74.125.228.2]) (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 49542468C30 for ; Sun, 20 Sep 2026 17:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923800; cv=none; b=RCwP/iEtMLqzePN4SsVTVjr18HqP0Fg4p87b+8ie4NEUL3AyzeoJP3+LuyD0Tdp97cGjCVBMhfnFpBzjyDozXDyWFkvrkxyWrwgy5BzYnFz8FDAaEVczh1io0leRnRW2ar7XZnqzSirE+H/3z4YBm6bkDYdUEO23nfFT9++Ic+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923800; c=relaxed/simple; bh=Vpg12s5aCfYhqiZT0MliutjEHvX20bbyVe8NFEbpumw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CdIC2CRA0GzqThhFa+w6bCHuLrEPIAB526jqyIDlHTARBrOnVCGXaBl7eLpTsGHFlHaayJI4RBWM6Hjt4qPhV1hBXxootyV0jClfmWBrq4DDrOR3+UTcpfhBXxn9kK+X5j8DApwrsn7JYOm9u+2Gcd56D/9t+OZLOkS05ORySVA= 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=FwZTNyoe; arc=none smtp.client-ip=74.125.228.2 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="FwZTNyoe" Received: by mail-pz2-f2.google.com with SMTP id 41be03b00d2f7-cc4c181b42bso1622867a12.1 for ; Sun, 20 Sep 2026 10:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923799; x=1790528599; 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=HWO0yYxZDPAwCYSgicIL5MDEtp9MsL193ldKBirIieA=; b=FwZTNyoeDaJNgBcS74Wppi5RIdDcvODv6K0TcGuasPWodeMiTjsZKUHMp36N6p2mn4 eiUv7wtTLJYkoveeAr9FRfrcxvJ/jwEV3Wkl1dEWzRPkLZSrTYBm2+aLqEFlahQzlgok K1SmgOSBd6+4WF7xaFviAtEboUhMNhGzFl9OTZQB2EMefmhXICFFus6ETtWeWOrIq6D5 /CjZgqHBZGGdNserLQHrapM2gLElH1TQi/DMofl6SXz8gngTz/z+IrhOJmOv0zjc/LfA AQrOuGrs9JLjzWt3BDYhpHGLgi7GZ64RqVSAfkHmhJgUQUwDB39xwDrCm/ufTr74A6aK 9zKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923799; x=1790528599; 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=HWO0yYxZDPAwCYSgicIL5MDEtp9MsL193ldKBirIieA=; b=ABck/P2ndvWJ6H7IiFT2ypJY1hjZzg7rya5XwKLvMIDMoeLy7qsQUPYVumqYyncAeD gvfNOmWG9PPiGDDh4OzVdWt1pWGxXtydHTrTxoorKt0THN2bGTTNjEV7ezeCx3KuvDS1 ePMEq6E61oH477IyPo6CuAPuSyx8bi0U346Vd1svm9e3NVh1YIOnNf4iX+xwLCOcXzR4 OcNTdsbmufd6s7ogKFBabt3OmpdnJMPRue/8z1TeqArcxJjHkK4Xby/BSp8Wd9laRBjl NxN5gzZYd8j6rSttdE8aI56YiW75IzIC3h90kxmUne7HnXjoSpTt7iyW4til825YVMdJ XQaQ== X-Forwarded-Encrypted: i=1; AKwUvBwqNB+X0txs7rm8PHqBYWl+GUQJ0ecj8yUesTrwlNss1nNJNlH8rYAh/KBtIBN4e5C7YD5apz9568PcbV8=@vger.kernel.org X-Gm-Message-State: AFuF++k/5YsvDsI5gGvJ/WRIqRFPJnr/0yIByYaqQjfu4eEH7I9fE5uj 5E4qC9oCB71zmBxyT0lvr0X/OHE6bfb2HGZRojok1FT9W4AAG5z+YVi3 X-Gm-Gg: AYBFou29zWr1dWHAGup6HoGl9/GMCEEnmIF8/ccRNovRIXUNSybb3k91Z8qKMO2Rt/H Lh+VLwGO7yL5Wpr6JMxPTuLRGbTxZV/CifL+Rdlg7X8xpOAcmJfk8u0SaCL3GL9TtgOlsPmD3Gv D2XpIslLcaldfGUQLwUrLs3CESwl48XLb0jxZ5LfUEQTc6dlNqqhHHHpcfGretlRgHoWJnSnuVK +RI3r2Z4Favg7BmEZYN41fPcSjdApkhZwS7kTBLnQsiFao777eZ+0BkSATiGQxncZdLvTUC+YYz JfNKBqJP5cn6rWb/g+SWRo31ezUsl1Ncu0nDzfHm2SUP60XomkumcoRXFB3QMuZbqCQ7F1q4nGb FQuAhhJh4oKMWlnNoihJdc6OPG0DZOdeBLBXuU+R33oU/RD/UGd826026Wf+N7fc8A+kFehR9nV 4dy0DE3/liMMWYbo+wgDlDWqjmiC1HpLRxArFyRLNCz3F1K8yIu0VK/ExcrqGMsOw0ULDZIw== X-Received: by 2002:a05:6a00:4b05:b0:878:34d7:6a33 with SMTP id d2e1a72fcca58-87834d76e0emr5109717b3a.39.1789923798674; Sun, 20 Sep 2026 10:03:18 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.03.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:03:16 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 08/11] dt-bindings: net: rockchip-dwmac: document pcs-handle Date: Mon, 21 Sep 2026 01:01:12 +0800 Message-ID: <20260920170116.3624104-9-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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 GMAC binding needs to describe the PCS reference used by the SGMII support added later in this series. The property will be parsed by rk_pcs_init(), and a missing phandle fails the probe. Add it and require it when phy-mode is "sgmii" on rockchip,rk3568-gmac, the only SoC in this binding that has SGMII support. Signed-off-by: Coia Prant --- .../bindings/net/rockchip-dwmac.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Documentation/devicetree/bindings/net/rockchip-dwmac.yaml b/Do= cumentation/devicetree/bindings/net/rockchip-dwmac.yaml index 80c252845349c..bb7540e838033 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,18 @@ allOf: clocks: minItems: 5 =20 + - if: + properties: + compatible: + contains: + const: rockchip,rk3568-gmac + phy-mode: + contains: + const: sgmii + then: + required: + - pcs-handle + unevaluatedProperties: false =20 examples: --=20 2.47.3 From nobody Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f7.google.com (mail-pz2-f7.google.com [74.125.228.7]) (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 98F393290A6 for ; Sun, 20 Sep 2026 17:03:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923808; cv=none; b=XLcFvrS1f8pK6kfB9DQDHyqaeVlw4KwI4Nj+9GYC+wPkCV/5tcbQWzNjiW9lpRUaZu4U4Bst+qZxm7bHCMQnLCuQywqHApJJci2y4mdtUKBiiirOmsQxc6dLKaYTdezIfEkGRhviOTxqsdE+mULO+T13CCDFju7RUHn0cDScd8w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923808; c=relaxed/simple; bh=1pDHNl+G4CvtPBETGZyEKzroIwhv1rFF6EKCi1dNVNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gmh8DPm0LEntGk2/Wmm7Xs/K6a+9+gvUpqc+sdUVGRvpaGll0gbUu+YDVVhFPkMbeL8AQnx5/5WhYvwBYiVBvd8nqxeaTuFVs9KPe/a1o3XdsNl5/vAv9xW1kMxCDpcDyuOFBzl3+EtowYVx8s1Uacv2C2aC2iP+woi6goTmG6I= 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=OgUybq0e; arc=none smtp.client-ip=74.125.228.7 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="OgUybq0e" Received: by mail-pz2-f7.google.com with SMTP id 41be03b00d2f7-cc51509689fso720363a12.1 for ; Sun, 20 Sep 2026 10:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923806; x=1790528606; 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=izFMqcSQQB7Nvjj7S6m4+KFLcaM8m1Anfagj0q6eQdQ=; b=OgUybq0et8gVwMva90Wdkn6NPB3NAbywd7UWXW1VTdCrUXYbvIkPPLjiOc5/4BO3Nd 4IYpECKTLmdhUEIg/vpC7IZ1eHlD8FX3voE7Y0OvcwK9UsXPst/aE4XjWg297CRvktxI NOnaIZZJBAKs6kxR1YxB/qcwnme6f52zSSCXRUkVnPYrM5fHxUw6bNceJCZZ5iyaSTpU ERpoX+FhSWkShR+U1RCnikvNuRoMWev9tmyyBfjVBfq3wZc3RVFZc7J6Sh7l+zeXIEw6 zxTYyjpLZ3kNTmleypcAYJhaZ77cSykis18EZD9QMLedfHudsZo3pk205GO2yWnLdhnS Nz2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923806; x=1790528606; 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=izFMqcSQQB7Nvjj7S6m4+KFLcaM8m1Anfagj0q6eQdQ=; b=ymf1DMzkx5SvM26n8dTgYL3icnFBdOfC7TAAYkr9t3XW+4/CaAvIDhdUDWXcpxYy3h IpKyyByTU7Jfq0IakhIdgITWqU0DG7jQ7buYec1KEORNRd2zAYMNoRhRCdNQfGYPEhZ6 eaDjXcssYKkRwFX+9NAJN5mtorPATxYyToQ3s0yzn+ihd+PWKPTJLt0tAOjQNatqgKA4 k0v3lkQScp7FDo4GZMIXqC9NL4FoEDxFUFcEiQuOyTZtfZn4pLhG8yE0s6iLZsPtDOUf O1nl436rd7j0kjAwPHpAa16e8aRx+Suivl7/evzTjd4QADnAQecqFnqkrSZJ77nv75vA 2Vhg== X-Forwarded-Encrypted: i=1; AKwUvBwY5u2y+epS4wfaauxgb2g3GO+vKuwmObO1kfVRUqAu2uQZSJJdnixJ/yN8nVYFa1pYEqSyyrELm20uCq4=@vger.kernel.org X-Gm-Message-State: AFuF++mMuNonPFlcsp/TDsbP3z9+IDoQhS5W0l8GthMXDstUyAwOs+zE pGuXgAQP93u9afGz97vC0+KXEJLmeAb/gj5Yexn4Qfpwh6dKGW7bS1AB X-Gm-Gg: AYBFou24KGEYA+xm/FA9I8rS1rhKqN5v+s4ZyxLHokpFaUBUqKWDxQleJhqS/otyoCZ EpFIr+UyDLrPNTPtql4MuzP8i48RX8eAzyis1OMdilMw1fWU2HMb6ur0FpXv4PUwmKHyDinDr5d 7Iadw1wmsV2tSMRb5uSK2+QcNXCRJXtJJNmdL3mIwHn2fIxa39M4BbMCTpPh2j36eulWhGbRfKi EYOvFgpMcBFstMz0lNbtsK3n+116Z1ecFYsia+6dPns4uvpB5lhm0q7fodM49Y1GokRx2AKXONg K3w3NkeJ9EWLI92KmYnHPGNUsd8ykMdStFpzBoIQWvg0fopvvEE5qe4bmJToVIc08CC0eQMsnHv ql2rkk1TjBtNUFQpknuLMF03fkcJbgztSLP1N3Utqz/nwWr8aGjJXT8FdWAWyvImpqxBoR01LKk CNje8gxSE58kPZcWOn0FQjVwMK0/Chzl/ibducp475tE87+dqTH9azYDRhfRQnY+I4gd2rE1rKE iwRQ2Az2A== X-Received: by 2002:a05:6a00:1796:b0:871:85a7:7af6 with SMTP id d2e1a72fcca58-874ddbf8b7amr12300353b3a.23.1789923805805; Sun, 20 Sep 2026 10:03:25 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.03.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:03:25 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 09/11] net: stmmac: dwmac-rk: add SGMII support for RK3568 Date: Mon, 21 Sep 2026 01:01:13 +0800 Message-ID: <20260920170116.3624104-10-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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. SGMII is not added to rk_get_interfaces(): it comes from the XPCS's own supported_interfaces, merged by stmmac_phylink_setup(). The SerDes PHY and the PD_PIPE power domain are owned by the XPCS driver rather than managed through the stmmac serdes_poweron/serdes_poweroff callbacks, which are legacy and meant for single-MAC platforms. On RK3568 the XPCS is the natural owner of the shared SerDes. DWMAC_ROCKCHIP selects PCS_XPCS_ROCKCHIP. PCS_XPCS itself is already selected by STMMAC_ETH, and PM is selected by ARCH_ROCKCHIP, so no further selects are needed. 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 | 130 +++++++++++++++--- 2 files changed, 111 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..88f09014e3a69 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) @@ -1602,6 +1681,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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f7.google.com (mail-pz2-f7.google.com [74.125.228.7]) (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 790543290A6 for ; Sun, 20 Sep 2026 17:03:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923814; cv=none; b=VMpXtxFl1uT1IDJekYQ/4jf7OuvzDJs+KF+7XuHOlDUMBJYTM5C+FUVHXs9MramrmWk0umZrMOsVyah6wVvwN35MgGPoll4OLHSp0Dw4MoYHfO9v+UTmsK5zfOS9ojMbf+u9WCf927oyqn8jrIBTVOFXp4KxJJz15nfhNmOD6W4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923814; c=relaxed/simple; bh=EAepGZi5JJgVl5A2Zgbnsm82y7MavVep4jBcaMjh1U4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OpyMpqTQl/Kcvh7wuCVsJS8EKppGMNguCtif6q1gJkKJrd2bUcwMQZeQWnDjUrrXu235mltSX4mfEx0eLURbcMHQrquiVufsKyZ99WRKDZ+iPC6BrJIlAzbI8LcOeFv8sDw8qDc7cNpb5i8gR/P+H4bY7S15UHTCi411ITSaJro= 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=DEeHu+cp; arc=none smtp.client-ip=74.125.228.7 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="DEeHu+cp" Received: by mail-pz2-f7.google.com with SMTP id 41be03b00d2f7-cc53988d9f3so1289285a12.0 for ; Sun, 20 Sep 2026 10:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923813; x=1790528613; 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=IeBd/f+KYPaUD3mTxXbAK7RiokjVClr9ke91eN5DQPw=; b=DEeHu+cpy5beil1S+Ko63U916fwBjBrWM56/6cyAWi6weAsCQ4Iwq7U8rx/5GLOSWD TiYVu7/nCpVaoNdsgvg7f5GVImMw8yF1F+J3QkmALnz0tAeCsRCXUHVpr+S2fEnyn8/v m/1FzuBwMdT7kQdomeExCNaRZDnyi9Ub0tdZQgGS40/Wdmz8/TAo3lGVN0jNPXeetYqS FOx9ImNt1lhCj+1LBzmeOCZhaxyPR7EmcMAmFZkzPVNsBcjlBeeLn50T7r/moj2NqQbo 7cl0PgrkFhMDSguQPfH2+G0/zfNFRnrvUmDhROl+4km6InqRo+8rajg8JIoNHwC8y0qC 5zpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923813; x=1790528613; 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=IeBd/f+KYPaUD3mTxXbAK7RiokjVClr9ke91eN5DQPw=; b=oN/qb/XAtwj6FdvG4coA36fTVO6H6kSNsWmZJL2Hl52mAhxFMky8erxUph5bjBvOfh K6rhZ/Qqn6ZNm8ZKK8boaPPXw9SM+vlVePXPhoMFoZmb+Guy5PBFWW3yEkDLYYsSVGYH 7oR8ghkcYLazKbIwgIt8ZH+/01pRRgnmKsVSCKCNDGLW/ALiLDv4sASOmPIoVfNOUHi1 307rbddNFbsHe9QKuEaIYC2vJNS2l2ZfrvTU9A8ICufRM/EUp5rGmb10f8ZqEnpJW/28 tVFggfadBJjT85b9qgdZ8kmbHYa7kjLCnwTvmskvDtDGuSTfFVjcsggY+ArtDCNsGmhv +soA== X-Forwarded-Encrypted: i=1; AKwUvBxDug/q9XUhaNasQdr03c6UwmmrtPj8BnrIL8eNeDhem2WXWC714MRnFY2koR72tjX2QWq/SCA+QzwXOVY=@vger.kernel.org X-Gm-Message-State: AFuF++kXvxxQ03pX/cCAdJjil566Sx937KIxj0Yzlx4JbBiNHX2k4abQ 8tl0Q76RrANwUvD7IKdi/UWckGVKhOUi+ohwqUX6j2C/gj1u1x7sD6uf X-Gm-Gg: AYBFou2o+Gmk1u/eFtOWv5wfeJC9NH+bff24vamXR9h6jvAD5bm5eWWcmu5r/kIDAsb 2nqhOasYj6eLArODvf4h5tvkfEkRrPoRByG1nEsTBTbdqENSkybzGF+fc+REaQt/mLUYKwzdUYS Q+Xj2gQwLD4YNPWnFBY6bOCaE2X8J2d/VI6xZ9yNYZh2CznzByRvUl/5wyhavTmHou+ugBuUC3z D+3P+4+PtI/V54YQEjSEbwwZh6X0HEM/7uT6y3qzngcfJSzr4L7opnT5nP4PShbxhHHZdZSWtqX e/+g746pyPdQMS/Ln6y9DTmj6lRDwF40g6pCEuQOB9nTEHQlBLfnuCZpX8wqs893RaDaefhyz7e IOU23SHG8t+rskEt/TH22r8TOHo5R2CHjAifMksMb6FOxEsqmQlGVQxIory37yZUO/51fZ/ZlBS 4+g8op7XKI2lJeHEgBlSbL9IEpZ3fraRlJ6GUGMHWXZbxSJvhcTNhz7g84T1u3z3seNeFkDQ== X-Received: by 2002:a05:6a00:1249:b0:878:3783:8a83 with SMTP id d2e1a72fcca58-87837839389mr5176719b3a.53.1789923812897; Sun, 20 Sep 2026 10:03:32 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:03: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-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 10/11] arm64: dts: rockchip: rk3568-photonicat: enable SGMII LAN port Date: Mon, 21 Sep 2026 01:01:14 +0800 Message-ID: <20260920170116.3624104-11-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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. RK3568 has three Combo PHYs that can carry SGMII; which one is wired to the XPCS is a board-level choice, and Photonicat uses combphy2. 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 Thu Sep 24 21:17:39 2026 Received: from mail-pz2-f9.google.com (mail-pz2-f9.google.com [74.125.228.9]) (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 0457A46EC9B for ; Sun, 20 Sep 2026 17:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923822; cv=none; b=uSE/0kayxDiQgEjMj3gNlxJMFTHxtEJZzGmnqZt1fzpydrdo2+JnEcfXRx95agmwnycRu+1dhMMH6x4aJYJqPWO03T/WbXs5VZKtOK/DGH7Yv25+SF93zDLzFFPjOuJUJIOl1EzNWAa2zyUfnG98fyPCgiTkRFgvZwpUl92xbwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789923822; c=relaxed/simple; bh=fh2Uu82ejF0DtKt0brgXH//fEo0R202bASP2cymwUFU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H5Ns7pJWthYGC7CpBYENMcRNjyP7RPiYS5HM/VZKJTd+Id0SZIX13s9iOdtnB6nSXO7bMxloaOwQPF63CrK+6DwuDstoaoRNEdJTBEKNFsLoL3uZ/C/65kF11LbjaN4kRuxpEV81t7zy6yrhU1g8sL7l2zjctPH8cEKW3R/BkJU= 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=oc83AY8i; arc=none smtp.client-ip=74.125.228.9 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="oc83AY8i" Received: by mail-pz2-f9.google.com with SMTP id 41be03b00d2f7-cc1631a57d2so1684805a12.0 for ; Sun, 20 Sep 2026 10:03:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789923820; x=1790528620; 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=bdJAnLwrz+/OjIyJtnetxy2JKy8P0MsUYxFs2QuKaus=; b=oc83AY8i9T/s9qJHtWjS7WM5I+B091jAet7u0+bXr9FQqfwIodge9hUq9UiLscPAqk 5f+gKg4eDY6xTVI87ijf+GjtNtOwipxKUUKyjFx+aSpaTeNiHWbg2cwzNbhp7eBM/IgM kS2UKmP68ZLuhqZuRrIgnxZg/1B5Vg+hLXyBBuizT4dXwyp5gY6RPHROz3M1ezRzG+11 dUCRrllW2S06FDnmrrdLC1wdzCHubXyrYznDxlNFnNDa70NbvxTqRLVV+6FuJEEH+0Yf YSGQGO8kAiIQ69MC+VivyyokeeM+0ljcpGdA5eqGcDRNncpnh9vSE3BcMOL1IzJwe6HW 5xDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789923820; x=1790528620; 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=bdJAnLwrz+/OjIyJtnetxy2JKy8P0MsUYxFs2QuKaus=; b=eeaC8Zgu5H4qeyEP/j7BVDCHS7vf1rlFxL7xTgNWdWpuEr9LtCBNXjik9Zg48sjokk 0wtUi7ItqcU9QJAGy9Vp14PEK11uLBE7JldRBhw9WOuHp84LuSLGUYgpq5HmvOaz03ME lJOTbD75a2C1LJmlWTnkHN2AZGPD13Y/0glXzJkWyomvFg0X8nVa8M7t7q49vow2UVXd p8aJeB4yKoF+sS0LAQzEBoi9WJc+fegQ5KFL0dme6RUIDOUFmL71f+CucMj0Q3I3Tj/2 y2TM3dTew6yQkUc1C9UEiESzAlmsfnLLt6wnpap8uCtNX/7M8p4bcHLtvGPEavp39CJr Ta/Q== X-Forwarded-Encrypted: i=1; AKwUvByuej9S/cmqv+a/kYy26VQp10irLzADySQzBfH+PE0zCvsPOQ+JU0+7hCWnVemoTHMqee+QawZZ5nB4Q58=@vger.kernel.org X-Gm-Message-State: AFuF++mTLee1aOJOsOKiUGTqOKOQ8+R561mkdh06GW4f6bKoQrl20OBM bsrJu+e6PB8Rm1i+PsjVe/s9wvMAhtELvaz8Vg9dyPoDAMgChsdvydev X-Gm-Gg: AYBFou0M1fC2yXgEu3OXput8hvzwiCUYufJAucf9DfSI0g3PJPdm9nM/M9MZFckLT1u 35bDbl4sHurBfiKt/Fqmov6eygqTnoSA1cu3WSF/eVFPOZ15LdmbXU6qfJTxOFXhtMj3O828efN /Aq+Cw/DgO9j2YYzG8eKUpZANOQhKZ+pfppPZvSSDUyPAs4S5JYGzIru7c82da2TdRPt20Pr4l/ fH3TJ4sUOcxGqjjy5sz4rGQfjn9dii88O5lzm8HRx7bauy9RuNrSbeXsT8LmauwUz3WGlGcSjie HeMnUcupqPC1nko5sZ5c1Cf1DS7H+xhWCP5P9MdfC5imZ13M1CjscCb8gl+9iH59Px8IbClu8ov 1JNQmqqtNE9O9QvYarEtdSNjljbJNWZYxq88pxfzP+tUeHG8FDpZG/PxVBy4F5f1IAWFdCPepJ3 k44Rg9DeBp6BaWiWHcjPUOrYG7zqWC4ynxxBYNI0KqEVLXlK6L3+yg9uAuEZ8o1lloG3UBwg== X-Received: by 2002:aa7:88d0:0:b0:878:3538:8f80 with SMTP id d2e1a72fcca58-87835389b2bmr4633099b3a.46.1789923820049; Sun, 20 Sep 2026 10:03:40 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-877a9d07425sm2140646b3a.42.2026.09.20.10.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Sep 2026 10:03:39 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v9 11/11] MAINTAINERS: add entry for Rockchip XPCS driver Date: Mon, 21 Sep 2026 01:01:15 +0800 Message-ID: <20260920170116.3624104-12-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260920170116.3624104-1-coiaprant@gmail.com> References: <20260920170116.3624104-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 cc3cae2e378b3..085589b8ba65e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23740,6 +23740,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