From nobody Thu Sep 24 14:25:40 2026 Received: from mail-pj2-f10.google.com (mail-pj2-f10.google.com [74.125.227.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A4D693CB90A for ; Tue, 22 Sep 2026 20:03:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107447; cv=none; b=TF+g4Ydjgoa7QwnsB/D2Upq10w1PuyZXuOdZK4w3znwzuzspYvso/gQLNvwwc+EAzEe5qgus9xKROOuOroPZm1MvjSvIQLnZ/FSjNJW9++8KGEfWpfdq88/E8r/PBG0OWVNUAhAktBXT+NTnPyZU0iz/SKRcfvcKFraVR20KUr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107447; c=relaxed/simple; bh=nfHCywuouAotZEtfin/UT97xewpGFIHFD6nChmuOl+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L4wmRGUYyKJJTNzTjk6dWmlUIcTnUkPV0qJuHgtzQaLFLBNk7CBfobyV1L8b3dLpn76BZ7cJp3KNj9EESStY32kcKHRYqdw7kknDmKRALW0GNLtIDKBkgtYHKy0PcKnd+pxP0RY6xGGDosuR1Pw0bDJna0vkFwlrDglcCXVU/Vs= 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=NULVxL+E; arc=none smtp.client-ip=74.125.227.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="NULVxL+E" Received: by mail-pj2-f10.google.com with SMTP id d9443c01a7336-2dd9bce707bso816085ad.1 for ; Tue, 22 Sep 2026 13:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107436; x=1790712236; 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=NULVxL+El+R/4rqJrIROD2RGosW6dff4vRp3QXFXkJBdZFj02aGhMNqRr0mOYyUcAU +APfxv/8DaBzkCf6ftkq3k7HHFajOOSbtCXkopHk/CgqZcn1F72HC5P7wQ/Q8eJOcKQy KfmTvLf4ZOH63wd07u6nYsh2ouZxmBIgFmKi4TvjEQ4pWKsq3AZALP7RRg+69gQv+9A/ kw+T5VLQCj8omRm1gI8A6XRRS57N8xwxiXG0+E7U4PPeiGUK7QruHM1GQIy5aQK66XHa V7MlStCs1mx9IpTD0TAhbK02HtCHvSDe8eEFfiFOz0dfCCFdchQrMzdEuv/8GlXpv+KM X3XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107436; x=1790712236; 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=dLNc6+8izwE4pBthDforMsPP7g5RdLh7C2pF3V3Sa2DSN88kjo34sOx99SCBw9i+1R EtkWoCc0VuDqJqahUy5nhl76UD+jv4uiFpIt+j29IUJR04A7EgY+kfNcx7C9tGVzn4ge D1XRz2yeMjpW47J34AxlTzPV4JgDUorNjc1cwFy5aRh4fX2x227UmHQeibap34jjv0WZ VUQhxmNLyZObBg4BhD9zVvXuztuEIQ5bOBu50aoQELxmu+Ue+rg7amDTLDaB9N36QLYF pF1nKpDEVmJIE7DlSPxmge7DoJrlW7e8EmtZeZxrEU2uxbMgI0tzdYKGOD/zlUh7LQRx By6A== X-Forwarded-Encrypted: i=1; AKwUvBwvVYmA2buvDdTtococu8wUJMbV22Uu29dQtuVTcVD8Xr8zx4+MDf1G4iqBsd6uYzJW8rwEIjqYpTVe8+8=@vger.kernel.org X-Gm-Message-State: AFuF++n2UP1YlUazhhkChmkMuj2tHgmdgX8uiK6LVsWKsfvdq/dqk88S ed6hWmvSYcmHOGJHthvL0HV/P5q8hYuQmWENzIIE6pN8h5UUPfesFdG9 X-Gm-Gg: AYBFou39nza/JaR0uP+K9Vy/TpppQoCRAd3py82akQ2LCUteq1w69/KN9x03qEFYVyh jZn/l2/DyCwlfM3HqI8SIW6PqpG2mP62LCnKfrVbxhZP7TAG39P4wC6jkYpiiw3zaY93YvJtORh inKvzZivAO/K7aqb4kUhjJSlFgvLNyKRW1YFjd3+irSdyMHlXg+s/2eoAm2dkmqxOSKBQkU7lyB FAwXEet2SHKOfpU/9ZhZ9WFqlVXIv9j/n03/UXYgIvO4H6oCXehBQ01dVsPbFZ4mI1kw000wwmz qKSFftInksfhBTUAomWaGEgzi7NbbOZgwU2xZ0jtXQJ1sSFUE6pythQyLjnh7SLCmqUF+65ok/d FIArXAkhyxRlPlEJwOHFc1NUF2g1rpBixQ8VVAQsEOUzPBhy2dBssWCSS95c1lCvH05olxCLrrX h+BquAJ7h7zum43XwO5JSeK/FWtjFKbnvj08AAxSQsrHgah6zytH4tNGvgAaph+C3PTrui X-Received: by 2002:a17:902:d54f:b0:2de:c1f6:5b20 with SMTP id d9443c01a7336-2df69d3ecc0mr4318915ad.22.1790107435467; Tue, 22 Sep 2026 13:03:55 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:03:54 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 01/11] net: stmmac: move XPCS lifetime management to platform drivers Date: Wed, 23 Sep 2026 04:03:25 +0800 Message-ID: <20260922200336.2201212-2-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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 14:25:40 2026 Received: from mail-pj2-f5.google.com (mail-pj2-f5.google.com [74.125.227.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71A6F4AB1D5 for ; Tue, 22 Sep 2026 20:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107457; cv=none; b=SAgy2xGpTaJG31D67/CVD1f03Cu3mBGXCdAkWo2saPN1DHz5QzcJO/8UTnrX8J4WWrKg5U1xQSL6HxoU7xyhKa6hoA/6d/3WD45uCCaQQGEr2Vy9uX/S7MF985wl2vtXCg5g0O3haygAOFkB9CyzfkZoreZ8RIKikqHu+w7NVXo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107457; c=relaxed/simple; bh=RQ8/bIf5S9U/FiX3uQoU1u6/FV6K7LLD2uqZys3J7EY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HOMO250Yi22RJwqJdd4+3A82sl9sl6EOc8yFJhn1qjpnzgat35tgQuaAN6EPoGDQV+RQmTUePTD0iOuGfWwpU9nc8VwpO4rDlpK69ApaDq/Vu+y8e8Ym+IhP35IppCjGK6vEwxubjfjGLCRPbmpkKufziOrQYc06IuyETlzaYNY= 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=d7aTeVc/; arc=none smtp.client-ip=74.125.227.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d7aTeVc/" Received: by mail-pj2-f5.google.com with SMTP id d9443c01a7336-2d952ac253dso1213315ad.0 for ; Tue, 22 Sep 2026 13:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107443; x=1790712243; 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=d7aTeVc/rk4js/lhi6D2RU1PbGqx6YqBvY1FyIV+qBrBrNci13RLNSCH6AAxKUfcYu eYlZSXIjycIoUCL9bVE6qk235DIIXtBYJbkbVXKQS/60OX5eeUbHhI6OZTs/MCxEMAcy plpBCqvGEmu9Aq8IzAG4RW1eJVxAUvfdoF74lfQvvSFZ8oSz8VeQ5RLGqub75CJ0dnDr Z8RkzeRFwgiuxVwSWhnadv2HGkzyI7c2x1bHWRWfiFlT/osiGJLOrCyhKxlyv1w8E3FT vguKvMyZrVMnBVDOk6UoW95lgEN8v9eRkLffkrzVt033KdumaYvTD2YgdJ7xvYqAPYT8 p7RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107443; x=1790712243; 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=lRBwRlYMRCHhQ67bUtqQwAl7GEwmitpD8jv4c686BCtvVf8Xpm3ASx7VR29AKtSBgy SPHvwiUV4sJBKRsGCwJRhZpGV5VWyIIXQ8bH2PYNuNGlIDtV0rrxObcdSEVw3tr7NZHZ HFNfj1HcW6sDQYCzPG6yad655TcoUH6cZmKvXx8aMWUx4DCQzJqyIxXrQFGkdobvbUKQ ywcFwRaWr69mYSS/WIzTJBVFtsjjoPVUgPgzy8LAcqAViWqbCIQYCbSPJmp42/M5pFFz bEV+FMeVNW0OKRVelVLBzPz9bq6PmPpngGP95bvl7x7CAnZyWuxRhTiYdjQ3U0MtBLSN 1o9w== X-Forwarded-Encrypted: i=1; AKwUvBx34UeecqsPdmPgsv8mG646FgLzj8K4GRWf8vg3X8bYlStDu7F3mXqcmgSA0HDxnmtDztDJCeeseIGUSI8=@vger.kernel.org X-Gm-Message-State: AFuF++lphthBFXpN/pmr7SW6oLVlMxEtWGIWw8IYSb7flsv33YDIF2Ul Eaa7jMaCTtTIVekzDpGbHMnsFJIG/tEOFCEkDL3U0QHMncfNdVGB/hFQ X-Gm-Gg: AYBFou2H0+WwXnuzhfy0ON2PkPQBt3zk8AJ8UEJDWSBL26InVSUwCEZ62Y2HK0LvO5w gHr6+1Juq/O67Ke42nG2pl9tEJ02fWEdtW15LrPsyIvhKUgyzlJhVuUB/Dnj+sGf4DYzops9CoE O0AZI/FO0e9w+trlPDJ9Hb6xUK2/ZsgEC+EIFVerb7TXKAqSebrtnhhrlhSnbkU5I9ZesgZih9P eNyLES7Pu7f0CH4WQXXvHLkvm4kxQdd06Xg6Dyfim65N2OfRq6tQYqwGrKWuAR1tP++PZIEq6I9 8Iriychgy/NStp+TUfVZ5Spg8d9TCxqs1XLIWvpmF8MoHz/r9bx6G74agngueNNkYU+OJk610AD MCGFCsV4DJyiZFTcRoeLRoHiv9tteJojI6Em05/nJNXKFLU8j5RwUfftGKWQN6JHUvvMaxfd7fh RccS+rmH9ggX1X7KxOzcS1yejpquXMnXMDhTx5tDKj/rJ8HfpEtX2kX090kSSMdIAVjKQCRg== X-Received: by 2002:a17:902:d4c5:b0:2d9:68b7:c324 with SMTP id d9443c01a7336-2df69d368e1mr4567765ad.3.1790107443277; Tue, 22 Sep 2026 13:04:03 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:04:02 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 02/11] dt-bindings: phy: rockchip: naneng-combphy: add rockchip,sgmii-mac-sel property Date: Wed, 23 Sep 2026 04:03:26 +0800 Message-ID: <20260922200336.2201212-3-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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 14:25:40 2026 Received: from mail-pj2-f10.google.com (mail-pj2-f10.google.com [74.125.227.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9A914AC17E for ; Tue, 22 Sep 2026 20:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.138 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107463; cv=none; b=c/8PZ8eBx6uiDHFVfrP0WKtBwAoc+Cw69sriYG4hZeJlGA5J0U23/+Kz5nSQrfVYi21GAVtgIORMqrURgJA9g05s1hCpMI+Dd/pxNgsCSpsraLBjLgR4UsiRD/gEyIi0a2TAlQd0WgAXoTbv3eNPQ9Ix1l+TxRi5720vLDs4HxE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107463; c=relaxed/simple; bh=kq0vt9SckJqy94uGlHWiGVuBk0MckU/fwsg6pcjJXHQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=r94ywfVIykr1AzJkSkZxiR+iEPevSeRlKwgdCgGI8W426dSp5539lHEvTA+GeMF6dX07k8cqlH5RBBXGeP05vfH+pnzKCE1zXfRiYQZQUhsDDKHs9DDvOOa0jXYPM0vsPgVQBszqWaSyHx5SNMAbmCI58fiPnyW8HpaBdLTAl7g= 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=Y2njGY/v; arc=none smtp.client-ip=74.125.227.138 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Y2njGY/v" Received: by mail-pj2-f10.google.com with SMTP id d9443c01a7336-2cf5e516e67so454305ad.1 for ; Tue, 22 Sep 2026 13:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107451; x=1790712251; 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=Y2njGY/vJqA0B9SwWL7b9Q8d39A97yp0YX7pW7xGyqXQeffoFWBxKbhZdq1rFpz7DF dUG2q9AWrSDKt8axz/8qClE0aKSqOu7EVytCM3mBVNG7LndYG6P/ctfKa7M4P6ohSis3 JmZUAk6bAN5z1ySx9YnaU6UyUo9QDsy5Fo4PGNIPTPjwNGa/B5gSqrh6s43n+Jj+wBD6 91sK+vgFNIxN2MVTGZpfEvrflYciCQ9eTwUZrFJIb0Psl5IvDRPIr5jOHknmP+uLbWVw SrnHgtaKFrahmqCydHZcPKmNKGKVkS7kPJOME5qQi79crSe8FeyjBHmYpqTbvQmgkXZ8 2bgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107451; x=1790712251; 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=rIgFcDVJLutQYDmHlijohBN/Qu3dDvxcTY35K7B+2ta6AVRhy5pahMrIh4Y5Wq6WQr uo0v5gZfQ/zLQQM9Ij0IJeFkajSY/U1EIsfKJMK4abPgn+9w/jfUxzLCPdthXv8jlAYD YItVwPSNZPY0310BGy0lphxmuhzFBfrqdzO7eDmd9WnQ7LrKY0gPb9potyw8PGpUvQ3P 4j0IjNrCxLfr4DdvQ3cMeBmZSY7bB20zaoeBBSr8GEGp3tgdOI7EB5W/lo58+m3H07bO FYvix65Mo6wDjhGyUumTsxwy96mLPHK28AJB3tUdvQXzZeI//R9+zWRh4VKmARozqjl2 2A1Q== X-Forwarded-Encrypted: i=1; AKwUvBxnzbYdO2XrchL0xQ3Bm1bXPnC00OWuYLkRqnh26O4PQwvNzFyrqRXD1CzclYvcTiQT42OpaznD/TK8Lvk=@vger.kernel.org X-Gm-Message-State: AFuF++nCPBKlJHIWq8TYVmpnwd8kHsjY7wpkpCb6mDM/JY50xNxXrvhB lO6xHusb0kTenECMtffxxZNmFntCOY5C+QNXwGTqKMRFGV8TKuXgs130 X-Gm-Gg: AYBFou1Q2QWkJsTFW4Z44hxrnxqXtjlQS39meo75Anqdifw1aBv+U6xF53EFlA+t5Ln I2nJ48w1zmjh8eTgcT1wBjoIEKcuVIP56iF7QaxC6CUmCD7jCxBq4PJi4kngq+Amh6WOd9fumRa K/nU9WSjJNmSk6YRKMkaWUh6l9ZJ7de42YrNt3mGJQz4xDKGLdWpqMiLk6dEHSHAZuCvdR1pIbm A1sHYrf7794BIWkHQtA/Sur94sNCExrVJ1WyHtkYEM0dIU+DZUaTqOLNdmMJwibu/V84JusgimH VtVNogSjijxTFsFSKoGHkdby1k8pN2hsnvQaJoI0rZu9XPEJCIkaOslMJCPPbIO01GXEl2ftEtN pV3PMeTxviX7/E5Fsoz4bDtaa852bNZyDHoEfsD1CrPZsHCqL5IV8fZ45onmQ3OI6L0NITMqKEl CZhhblLTkiG6bNlaH894pQRAR84DRL81pCn8zaMl2wBQ5H9p/1O5FSFWRMjU040TabwvbP X-Received: by 2002:a17:903:2302:b0:2df:6969:7d5d with SMTP id d9443c01a7336-2df69ddf0c0mr4048995ad.40.1790107450787; Tue, 22 Sep 2026 13:04:10 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.04.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:04:10 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 03/11] phy: rockchip: naneng-combphy: add SGMII MAC selection for RK3568 Date: Wed, 23 Sep 2026 04:03:27 +0800 Message-ID: <20260922200336.2201212-4-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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 14:25:40 2026 Received: from mail-pj2-f3.google.com (mail-pj2-f3.google.com [74.125.227.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55F894AF679 for ; Tue, 22 Sep 2026 20:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107474; cv=none; b=C9lnNYTIdB074b8yiD92eVH/8iVhV7Sphcp4Q4X/YGYxpU2HOte0bU/pQeF4/ZOwhR/IMaFnLUWSEhzd1Zz+UFeF+pLhIsVMVj6BseSpnMS6bHYb3/UZxgBpj+KiMZVdgKhtrlPkIWb3Vz8iqBqaEd+2eQRea0/ody+hP/Wp+fU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107474; c=relaxed/simple; bh=uIxFaIx1maUJPzb10cLtB0jKa27JO2f3e4ujLzs23xQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PiLWQeTj5dXqRcZqfJK/e5HMv9LItIrPzreQbmNTp+4FG0NEuYu8D6hgxiFyNUASdXXutZOk5sKfZjxa/o7AdBVULXh6BZAXvgw6/doMssKVXdmvk7sNCuvCxMJq73pEoyxRZJzjGYg/cbxrwF1SVx53on+CCFXKmr9hiNBIrxY= 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=fIr2APoD; arc=none smtp.client-ip=74.125.227.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fIr2APoD" Received: by mail-pj2-f3.google.com with SMTP id d9443c01a7336-2d6fff25530so862305ad.0 for ; Tue, 22 Sep 2026 13:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107458; x=1790712258; 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=fIr2APoD/SvW9DLLtjKRuU1LziuuOor5RdzvIBWMKI4VwSbUlfXQuZk/ETywoUGXqu IhkSWZe6rfKdwRlrSWj7xUlXHn07E3LgLx6I9nzA6mKaJa83jxwOOMVyquXoHrAl7i9G tHwaPMIZVgaXDzvWyvA1SxFgvubjK2J5Oqvu0oigGYlnqBFsUBr/7W36py8tfjH6SuEp Ebu7os+bxbr/4Kv1z7XfViFqWBN0VrCAz7TCyK1RlUH0odSXC0QcL3Bc7NaU84/TP76I Yzn/RGt8ZoEO0jWTrtynNltc3MQOkaxv60Hkb6lJnpp0FhC0NdUw+CPfSn9O47JVF3Bt EaXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107458; x=1790712258; 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=JUBNpLec2dqzQ9r9RoxtkccbU6xNoW/LkFL38ZRIA+zaTKV8xG35kz8wp6BRkkQYWN U+vRSvYOTAkl+avW5mis7oePUPDn0tkI0lOfniW4svhITzoaO08dFEAXxoofO6/rko2g L3LZQmfw5m34iLQE0qyWkBn6BK+oWfASQL48VjXUa2K+mP7vKEFAo7Mlr95t6NU/lObY C6T8mikaE4SJVk7GxaFAxIkZ52uE76WN5Bq3M/4RBSItnyF35vg9A+q0ABF8ydJrD3O+ 7/L+snRZESRODKB01Ia2twAG6ejSx9oGTjNvwHZ2TQJI501pKxRcVs76Qai499SH0Bsa CTBw== X-Forwarded-Encrypted: i=1; AKwUvBxTDOK5ByI+OHQ+HChuCUO9RgTt4YCOId3ypgRbsvli2iyTez67kKjyLpBO30VlPeGXRpjbWFWWzcm5F8M=@vger.kernel.org X-Gm-Message-State: AFuF++ktsvv8LKODtAEcB4zX9MU/ehtGTaRSKc7OnAVKzrMvXhcLG7Ix uW0McSErCEMPVcZPFugNtrSkVZI3VHZSov0aJ4TF4h7Iqaa7dbXuwt7F X-Gm-Gg: AYBFou2NDAjwgQvx6SnWQnLg4zBTV8EiQqvS5C7VqyTc/jf+5uxeXyV3AltF9I3RsvB SEVHWkxrQCjkJJhJiNecYKmFtYKJD2gfaWSf7p7oquJMiYfB1Du82A7rF8uoTJchm+JHYIf30iE wcEDD2pVl1bGoyFkEWZvYAp92xhPFr7K26eOaokeI7m575QnWxg6Jb7KTxMmWHWjBTEuqWLjFjH EwpZTJCAE2sNqgpSoepKA5pnudSe6EvtU+gBrUfOj4n+SPcG2LfZhiU/flisJLe1lbbUl4rATis CxDaZm2l2vnWNWki+EyIQfIK547Mzgz0GxvLrDEl+1do5NQXuFhV3Ksiadfyi0fdmkxu25Cu4Y4 qwAJrndVzSxwsM83PyhYj7v8X/pzzyMrWlYrkcuwLUf/vjGomzUhTZfMvm0maezGAPyHU2rwFXY aHbACvLE/vgeehGR3DukUj3l4rpJpwt4CwiSxvSoinWYHKsMSxsYnJA6hsd/zpyBSVG+E4 X-Received: by 2002:a17:903:2350:b0:2db:31d5:1448 with SMTP id d9443c01a7336-2df69d689a1mr3760135ad.22.1790107458354; Tue, 22 Sep 2026 13:04:18 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:04:17 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 04/11] dt-bindings: net: pcs: add rockchip,rk3568-xpcs support Date: Wed, 23 Sep 2026 04:03:28 +0800 Message-ID: <20260922200336.2201212-5-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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 14:25:40 2026 Received: from mail-pj2-f0.google.com (mail-pj2-f0.google.com [74.125.227.128]) (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 826DD4B0C98 for ; Tue, 22 Sep 2026 20:04:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.128 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107480; cv=none; b=M8qHTQBV1WVhUe/QTjsvN5Dtl+eAcaaVTHH1l8PfhF4tE43GmVIgaHRUIT3K23T4Zp39hZgexuAnRQwRQ/b0VKoW7vpSHh5XxE87R+G/GLXHrgyWv4VL9bFPT2ZKDG219+3Z6wqSiwM2d/GHMH2V52DRbFTTI8VDI4JufOB+GcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107480; c=relaxed/simple; bh=xsSc6ydPheU6yQKTsn8eVtJAu8IiKQ9vJAoJqkKw3sg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pSStpzJZ7LRi4sDZ+uZgEt4Hf8X7MYtprB5eYLsOVcILbLhFPgjtEogwDFC+HEFXLjtw9j8Gh8XV+X0AQYhFZYSN3EIZSPFYjpUDFpcXpXhee3e3D1AN9yIOrINXFXn3o3b2Z3TfruZXSWaLZi845PKO7uOR86Y20LpFdJYSWRE= 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=aOeRIH6g; arc=none smtp.client-ip=74.125.227.128 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="aOeRIH6g" Received: by mail-pj2-f0.google.com with SMTP id d9443c01a7336-2df5ab2f7b4so756215ad.1 for ; Tue, 22 Sep 2026 13:04:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107466; x=1790712266; 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=pIbZ2Qb+jhg9YxUorYRFCm5h/dMc9oDQD6qvJFZg4XI=; b=aOeRIH6gNBwyXu7l5Z7cO83FPF3dKeNG2iYUnz4jNWJ+QrtDFFr1SywQRo4Im44NAd jV6snxM7C3DUvwoaIcpczNOg0FkwRM9QqaCceb+M20bu+xstqgWUWFof33epYjOkUPt5 arxga6ZgJoiM8ETG4kbK5wsBHpmmgGAomKI2h6kp6zeX64cjJTbyE15Fx64hK9+p/O0z UQlJSVkLF4NK1tWhL9v4eWPrwGVUAo8gP0jhacLug1Z7hNBPp+hWA4xdn4jlHKCEMvzf uwv6WuxINhUXD6hfD+Ve+VZorPK38h2wz+KyYIwCT8cvKyuKvW7943TuNJCF54CADEQ3 7LHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107466; x=1790712266; 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=pIbZ2Qb+jhg9YxUorYRFCm5h/dMc9oDQD6qvJFZg4XI=; b=02KTBQQD0Cw9iAY5d9J9oEBWcDlOf+SF1fr6HPcdMGNE6zZNAgQAaLRjL1ApsX/PtS 7qWr9sEnrVdXBMglvMRR3aIvVy20rxyuGZ27fVKc4a9efRqQd3naoAs68p8zKOjycz+E aBw+37OsSbJRDFsn1EVoeyluz5NxjeVFGj171e20zWt6v0LHYe9EL9lVw9vZlYAVak89 dZgvSFVmBUyySgNuHpMsZH+DdPNJr8KM9SMtItmBkMlsR/gsORwm5F2EPVn3dyoxjuJT reiP/+VP9SDiobgwaR9Q0d3GRt3Gl6HYBGkFMG8zDH3AJ/cWeUU65DJH2re5YJzTeDLr SXlg== X-Forwarded-Encrypted: i=1; AKwUvByk4S2i2hhfyIovYy6U9m4gpSh0K0A7ESsDpnRWyWNvqnHBUpdG8lqFC5XgRH2R7Ade0auSp2z0M7Mrq+w=@vger.kernel.org X-Gm-Message-State: AFuF++le7nw46LsjAED9mXIcs1HGfBSORxJ/hKOzjClSVbKjgzqq/mjZ 4UqULmjw7B2mSsHdDR51uKwvPYLed/9R/05cidTrQTeV4QtQiHDNpSJh X-Gm-Gg: AYBFou2SJXPdM/gU6u2/Mhxjy2SiOZYl/kEun5xxFNVRbxUgF1F5Q53QJ1tQohwuln+ H8BAJ0Tu+PcmmET1XgQrL5FbaypP83EXaZmIOi00O87mVPQr9LyHgbyhNMlgGjkEy1GCCCrnjKW JrXm1E/vO3f2rwRkTFzAcZZADWQfyDCuinlfaAASuUAjZylBeTOOZAJdVT9IPL4wOQIL91kXqoX MjQlfgJT6Erkgsgm3AgKCu1MHgD4jj0OTLu4XPL7ucToWO3e//szUuPXaFToPudrgDnccZxQEiu wWsn0ZmTotCXrAs8r48ETkBfobFCGK3QXFxxfqGVg6nGwuBgFKq/IaJWL1TLslGRnqXcPlpfVqx 7zk3zi5nFlDQbrgrxMc41MQD6pHvPIEvIwVqk/g7PyaH7QNiHHvRO7NHemFw+mPGlRGhFTtnHls WdPDEl+x1gRnjMbWckaLPy6pBcEKPU+6FQbk4D4lJLmWhKYX2DqELPeijHmJMWxWJTz+ATgKFrA XOUap4= X-Received: by 2002:a17:903:3245:b0:2d9:438e:b70d with SMTP id d9443c01a7336-2df69d0cfd9mr4017475ad.1.1790107465799; Tue, 22 Sep 2026 13:04:25 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.04.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:04: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 v10 05/11] arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes Date: Wed, 23 Sep 2026 04:03:29 +0800 Message-ID: <20260922200336.2201212-6-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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..2cea108b31a4e 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi @@ -8,6 +8,20 @@ / { compatible =3D "rockchip,rk3568"; =20 + 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>; + }; + cpu0_opp_table: opp-table-0 { compatible =3D "operating-points-v2"; opp-shared; @@ -110,6 +124,37 @@ 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"; + }; + }; + 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 14:25:40 2026 Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) (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 975D94CCDDB for ; Tue, 22 Sep 2026 20:04:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107491; cv=none; b=R/ESsrv7v8mYfl9XuD0+YFO8w0sdk4bjB+QA1eRY4HlopPbH3YzKdovp5ELxqH3WNgKvBqLWIIlXrIgHKIsPkDQyY37vpa+p5d5bFG0/43OdzzEfhnwMliH8HqSOjB6DuuZh8aaE9LcwY7F/7P6WNcl4GQmktlGhP798RpbCxs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107491; c=relaxed/simple; bh=k9eLD1ZrXZD1iMizDWP4jTUk+ML36ocfJ7jazjazAIs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yqvikhrmi3WD7OWQ3mwKk/DvVODJ+E2P7KTft/NmTuJ8BBPp/LTRm0UeqqysnSyTYNby6x54sn8gpR20XLTHfdu7fdWZngJ+jGcLytzOH7YC1YuXwTpeTZLT9ceJhSEwWDcr52UorH+1/9tORS+aPdJjw+G8fNNqDoCUtdOL4VI= 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=LeAb1uHQ; arc=none smtp.client-ip=209.85.214.196 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="LeAb1uHQ" Received: by mail-pl1-f196.google.com with SMTP id d9443c01a7336-2caced6038eso1810325ad.0 for ; Tue, 22 Sep 2026 13:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107474; x=1790712274; 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=LeAb1uHQ/QEIx5DWr68k/8/JzDe5qrf1AnKNJ/S8U2S/xNTt7Vu6iiHAY8H802PwLT 6Qh1VHdaTNdXVbWJLu65mIIKngtxIjJXXE4ESzchdCLlycBZrvFBN1tsx/SWVLBSXpC9 unelFI+6rqtJyp8wu0Zep9dop7wetSHx2pKcvTDeUfixbeMUSCT0Uw7CE2UZOn17Vaid eLQrJABKKEj9ZTV1BkPYbZO+Q2ozAx7rpKh38vfaApkzYEs0vdCBCPohW8B6wrCI9mfa iLyJApwBPIZwrFDKU0DwsAfF3EvpvuBvFyTC2MIzHlvG4xcIYSB6ut3TT7BZFlxpQcVw gqrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107474; x=1790712274; 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=zeZXvEnk44NnK/5mNNusq7QSljlBYvDqsZIl5ZE+NUlgw8z4kH3MndOhU7XzbVdWqF I9+mceBuWH4vAUa051zgASBfDfF/h+TUcw+S77arOjvlB95rlds5mHV8P1QiloShF+Gd +S7JM3U0xVxKFk+rYq0d55FkrwF3lRLYahPMuD4WiLknjBMtR/I3033RuW51kjRlRLv4 Qs5EsHsiIyG3S8UbYs+I5IN0iEDB3F7gAX3PlBwcWS0B69BjUvXv+GvhTqdMlFVBmZQh xNgt3U43aIwkWuqDKHwvmutqIPEgAd3HhlrMiOoCO93Xdq3JMSY1NEPuVCg/icPVP5Bg O69A== X-Forwarded-Encrypted: i=1; AKwUvBzQhKrSJNT2cgCXL163I5OFuU0bpuSZ/lq90Ac/wGvAxZFWLIWYrlTM0Z/rvNfM+NHCulOd15/QWVNBDts=@vger.kernel.org X-Gm-Message-State: AFuF++lNIt0kFn0IFfsK8SyLSsaD4I2B4PmDD/MZm7MGTuRfvjj9JPpD tSPF2wHkPKJQY8rWjUArsrOMsMOTAZSOxSLWq+5Y58dtar5LgseEwJAi X-Gm-Gg: AYBFou018TljOb1HkqO7EcNI+b348BDqwoPlP7QGZv+1gZ6j9NURbJ3D7d6RnGDd8TZ 70Dfum7uVqRkMXtkp7oFJUJvUNOB6XVHbtzoQsPNWeKX2+DBQQn/feBkCOmryRSb8sw3GcfNDRz GoyUeeVa7MLHe9CgqWnCssXZzCPwGRL5GmGHVbW63I/C3FpaRZA0CvaVVJqKbJjIaTpSO6q/Y3A qSW+xbM3/BB1ZXBN81dYi3QPICTY7KBRW6CBt8RDNACRUzwGdE//6f0KTrdyIvxvOjE7P8usWHR mJVyn4jjwtHqSPhVvR6u+rUR+lrC6sdxwAXUP9CGcPMlgH6FLyaq80axlkJFtlKSjyDeJRIlhfN XKXYqnG4Ms4o0HUUv8CQsho1YvsqUPeZGlwVG9fpvEEvsBboN4IsAMygbjMWS1MuVWlpgeW9LiQ fYniqelEnwmIXXbFJ4mvCx7GXr4kGjeyRLBU+Cb09yCBoOHXv42fkORnv3grXLTt8JiaAy X-Received: by 2002:a17:903:1b30:b0:2df:5c13:b37c with SMTP id d9443c01a7336-2df60b6920emr18526165ad.26.1790107473545; Tue, 22 Sep 2026 13:04:33 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:04: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, Jiawen Wu Subject: [PATCH net-next v10 06/11] net: pcs: xpcs: add ANRESTART support for SGMII link recovery Date: Wed, 23 Sep 2026 04:03:30 +0800 Message-ID: <20260922200336.2201212-7-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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 14:25:40 2026 Received: from mail-pj2-f1.google.com (mail-pj2-f1.google.com [74.125.227.129]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC20949A3C0 for ; Tue, 22 Sep 2026 20:04:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.129 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107505; cv=none; b=BMWOsbZUAyOygtf/+wGQDkpiz1AOjHGbv2vseA3mqFkw+PNi5Et7nfA6GyNQd3Cj3M4UAer5mysqDPZLz6yA8dIbgCOeULcV795bwGjkJ2TLOJdtY9FH60l3orIo3MFGVUEg/+e/WIsKNmUG65oszK+Rm87VoKuXV/1bUfAQmhY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107505; c=relaxed/simple; bh=/xICB2EjDC5FPGahSN2PB3TKG609TKdB8qfi7ZuBGRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OKXjU+U9d26ib7jBrT8dAYE7ExS57KRmqM9hnGSFqrtdyrdOzg+gVnEvapC8Y9DjVbjJNC2PXOJ71d+n/tlKDUtlVL6XIyyi8L8oxkfR58m4py7VWOoG0BqsITN9az4oUex/f6StYO4sh0oeSQE6Vn3imvtbAH4lRIog7BrwMX0= 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=bMDk37wf; arc=none smtp.client-ip=74.125.227.129 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bMDk37wf" Received: by mail-pj2-f1.google.com with SMTP id d9443c01a7336-2dae660f31bso1049875ad.1 for ; Tue, 22 Sep 2026 13:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107481; x=1790712281; 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=fCXz6Xt3mPz+WufwUqHDBTXpyUqzwHqKx0ma6QVgw9U=; b=bMDk37wfGGLFl5jAfKnpwiX6f8RMMD1JO6NxJg3LHmdUYYkSEqosj6FS7hZ/WKddmR nnYt8rEHERh/4Bjl6juiJYSd1z/MlyDU+JRaH8M7+pe2TldOIGIdry0ffK9UYcoOdNhQ +s0ftF7Th8imIb2+fFkEGwi6wZWcYn7AFZFtWueBXbQCE8/3f7BVFI5hvdcePt9ZGizm FPuFM9lnvPqRcaNOgdkIp+gm25JyB57ek4GJ2Abu43gSVYtPgrQRs0j4EhcC9w/YOpDY OX0L0QvJa9rmgBHnPumIBvaVAdS+YSfvQj/ANEUDAw8L9JV5jHfhlhEf4lfBN6s7SOv+ XaZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107481; x=1790712281; 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=fCXz6Xt3mPz+WufwUqHDBTXpyUqzwHqKx0ma6QVgw9U=; b=iygSwYxQHIF+x3+UhcSOccJjt5NP55fA2Jk0W5E8ib3Ccb/+ekqE5nljpyo3/pJkYU 1PP8hvfvEVXuyvvnJxyQeU7gh45COGTsD5TPtbD86em9fRw7+a9f/7YzURkPEkhN8ZZh 20g/xLIXKS99KqyI+hFVKhv+8gDDq7Cs1f/4sNJiGg4huLBU8ZCntgqogXVmC8pMZstv Im7jhrBIIrxakRYTcJWFaQzUKvv+9QX+Erc3RGoxbIEgdBPzytQ71irjrxPs9KbIfPnI IrRJD1NWLJB+B0n1YMxVUobTSANLDDMwsJV0UoBOXh0/bN5dCZXM7PSHxRsav7EWYSkP YLKA== X-Forwarded-Encrypted: i=1; AKwUvBztEfCdVdLIa0KxctLJfrU3MMls+yk8KYHDE62ajBumIPmtBuOsbjQiRdTJmhs/V61TypCiTXKv71FNPuo=@vger.kernel.org X-Gm-Message-State: AFuF++nPXU4vpvQNQhE6FWSQggPNX5ej+qBDZ9Epp7ak7NsrLhbu3ytK wYdSixj1jbVH7nE/b46HlI0N083qGKGrDgKSVpHVJmhcexzf7TzN+Jz/ X-Gm-Gg: AYBFou05Q4NddOdJxeKe6EWha1coYyIV6YQlzssFYK45fyKaybJSV/yhU2gQC2yDBvC lQODAnXvKgvwUlIxHH0ule86ToR3MT/BKMKONDJRhAzpCx47lOn7M8YcvI9PsmgiXM6OoToHreL zxbzel9R424PsdTmy9WF4uGmKJiqEf24DdXEfkK9h/kcI44K6tJ8k3rWiBXruhLLP/XQVORmwM0 7Haj1vfftfS/3YrDgdw2tFLMvbpYFadNYRy82L3q10UM6Pfs69MchbWwNvFrF1L0bjZ51BYLWsf 5eQKJN+G4g2CPiWz5ahr+qpYQD6mx0IBG+jxSziIk5f9Mqo3uwB9Bp1PujZPWo+dJeJ28Zpnu9Q Ipngf9ukR8EWZSVNCBhicr6U1qVnoqH7bw2S47pI+D7ZBLAsI9/U+2XplkkFW5bboIjZ7veC1rB EdKA69BwX0n/cnoRcG7+kjWVXYIYxx3xkPu3n2aDOoVjU1nD+GxYMcu99kvmUjCSID+b/t+g== X-Received: by 2002:a17:903:26d0:b0:2dd:ad73:5b70 with SMTP id d9443c01a7336-2df69d5fdddmr4305305ad.32.1790107481209; Tue, 22 Sep 2026 13:04:41 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:04: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 v10 07/11] net: pcs: xpcs: add Rockchip RK3568 platform glue driver Date: Wed, 23 Sep 2026 04:03:31 +0800 Message-ID: <20260922200336.2201212-8-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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. Power management =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D The XPCS, its SerDes PHY and the SATA/PCIe controllers share the PD_PIPE power domain on RK3568. genpd powers the domain down during system suspend once every consumer is suspended, which also kills the SerDes and the XPCS. Boards that rely on MAC WoL need the PCS and SerDes alive to receive magic packets, so PD_PIPE must stay powered across system suspend. Keep it on by marking the XPCS as part of the wakeup path via device_set_wakeup_path(). genpd then leaves the domain powered, because the Rockchip power domain driver sets GENPD_FLAG_ACTIVE_WAKEUP on PD_PIPE, which makes genpd check the wakeup path of its consumers during system suspend. This is unconditional because the XPCS core currently has no platform callback through which a consumer could convey the MAC WoL state, and the state itself is dynamic: WoL is toggled at runtime via ethtool, so a static DT property cannot express it either. The affected hardware is limited to RK3568 boards using SGMII, which are always-on routers where system suspend is not a realistic use case; the extra power draw is therefore acceptable. Runtime PM is unaffected: the runtime callbacks only gate the CSR clock, and dev_pm_genpd_rpm_always_on() already keeps PD_PIPE on at runtime. 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 | 619 ++++++++++++++++++++++++++++++++ include/linux/pcs/pcs-xpcs-rk.h | 11 + 4 files changed, 658 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..35ee980a759e5 --- /dev/null +++ b/drivers/net/pcs/pcs-xpcs-rk.c @@ -0,0 +1,619 @@ +// 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 lives in the PD_PIPE power domain. 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 int xpcs_rk_system_suspend(struct device *dev) +{ + /* + * Keep the PD_PIPE power domain on during system suspend. + * + * PD_PIPE is shared with SATA/PCIe and would be powered down by + * genpd once all its consumers are suspended, killing the SerDes + * and breaking MAC WoL. Mark the XPCS as part of the wakeup path + * so genpd keeps the domain on. Unconditional because the XPCS + * core has no callback to convey the MAC WoL state. + */ + device_set_wakeup_path(dev); + return 0; +} + +static int xpcs_rk_system_resume(struct device *dev) +{ + return 0; +} + +static _DEFINE_DEV_PM_OPS(xpcs_rk_pm_ops, + xpcs_rk_system_suspend, xpcs_rk_system_resume, + 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 14:25:40 2026 Received: from mail-pj2-f5.google.com (mail-pj2-f5.google.com [74.125.227.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BE564D7D24 for ; Tue, 22 Sep 2026 20:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107496; cv=none; b=FmmTnr57KncnLcB0SXBOYaIzTXzqFLYDVFDKKxRpHZjdy9OcA9gPf9t2emcAlGo/HaNkKEWSQYolidwvay4bWc0HuFzOs4Isd+/igBHkqBa/Op88bQr0VkzeYpKry7W5GHkEUKXXdYybXJwstdlwPpVx4LrBKWuuS46ud7OdH/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107496; c=relaxed/simple; bh=Vpg12s5aCfYhqiZT0MliutjEHvX20bbyVe8NFEbpumw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k/K48z8l5p+ORI8/fHvSbz2yvweXDuksUy33UCdXhIifqRd8cxFbe1nR/wtsWjjw2kpmFj06eGYXJ28zI/YnnktneT2HYNImdF+A9qqp+thfXIw/fZsL8ThJA2t1ujZZPMde01O9c7WKkKVgJmSphH+1Ih9TErI95LPd1D5AWI4= 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=W1xiJ9KJ; arc=none smtp.client-ip=74.125.227.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="W1xiJ9KJ" Received: by mail-pj2-f5.google.com with SMTP id d9443c01a7336-2d942de6574so990815ad.0 for ; Tue, 22 Sep 2026 13:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107489; x=1790712289; 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=W1xiJ9KJ4RWZ1iletsqCG6k9ZncFdwx37U+P0w1fFrMrWnw/4I9t/bQPpxy9gcQkWU G85wNCVv2ly5C5vc+utUv9IXzmdKs0XhDlbNPQ2U4MgclAkxsAq2cyBVTjIxg4B9cOpL mLtY8MNfe9iSl5Z5hL5lyW6cuK4o3Wwu6t/3cFmBS30UxQE/c//RIfwl9dNqlND60Yec eu+sj8j1tnWalosiHA5kjcaYNOGmYmYnkm2D2M0ebelE7z9uYuu/59jwCQjnt+sGUONH nQ9ZOT7mAprdAq/O9uRfwjUTyTzvXcYqxLoX0tjeUHHV4gE6X2/qgT71NGichSH6SbkH Bd2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107489; x=1790712289; 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=NIV2pbBs8nBmM9AjYwmoOD+6V+1srZ2kiVgPnMTwTEGO5AF4bi1Iw4so4Enwd1H4zD vFjQSZ0vIAI0RlDfKLAvQQDxvmFxjDKHczZB7GuQIhjvR780XVZEOu9bRrIjbA/c1uAW BW0z7pZAYsX/wPFW+V8kLIkqpF7shxlRm14gw5C3CF+P2JSNL2M9s/jyPJch0p9AyWs+ cN+EmPgS+h+lFYyTkqtPVHpldxfZKRixuJaWcxv42bWLgXNUtz1OdpXlG/adImg4pZ7M wDTqSxGDHoV8J64oNRxKGM2ZQ/iddQhsZTC3N/vrjehOH1CDB/p8/ujXqFfrEXCrLmYI Rr2A== X-Forwarded-Encrypted: i=1; AKwUvBxGyhRBQFgcm7kV3pTMmIju9gUdsRhmn+WREio5BIdoKR7wRMUNNMXC7Elhx14W/C6TSdbnOhC5cXWPYIo=@vger.kernel.org X-Gm-Message-State: AFuF++lJBfAKNNbwKQAlyqBQRMiB+n2L07OymBWCc18Qy9RQSSs3CRnt gwol2mZQjDYOQVioppT6haetlaDcniINRWOVQ+vnjmhCv0jQ3B0P+1Rk X-Gm-Gg: AYBFou3Ft4aJdF3dwvLIJJ9IaHSaklZOFV6rVp+4ErroktRCIkV4+qWiQNP0oJFJjmo Ek3lG3ozU4tj580xxvNeosg/snGRmpLzk89UUj3VqpycBqz1QXvS+xJkr9TguZGgiwXAIffJA6l Dgz6PEfECyj2jlVnpiKjd76wyIkLPc35oPQRr7VislQa/0KLRFI3mBaTJWhxiwJnAV2JCa3fYnb wwAtyQu4ByEgqeaBXAR4nhQOtcuqHIDc2Q6OsQNHI2lTX7clYfH8FNRBGVxAe73lIG05Hz+LdOH 1AuL/IIihscuAoO8K8I6dXyDJRBoFJ/t6uWOdhfVSZpgyAclO0PIZsqWZQRAZgb+F207jt4JBNd oDOiClRwWVo4mPtZXpN0KsC39O3v1Q+Hox5+N2Dqa8EfGEFz3SBdJKiAmIBdW3jbOoAcBZu7mLa ihUMtdztvt+FHYrnDuH9qDFeBIZ9bmTjV4nwPKvholALmKUsLFuizfh0ngFLdkCGKNcCOG X-Received: by 2002:a17:903:1a86:b0:2d9:520c:38e7 with SMTP id d9443c01a7336-2df69d1b106mr4415425ad.1.1790107488984; Tue, 22 Sep 2026 13:04:48 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:04:48 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 08/11] dt-bindings: net: rockchip-dwmac: document pcs-handle Date: Wed, 23 Sep 2026 04:03:32 +0800 Message-ID: <20260922200336.2201212-9-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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 14:25:40 2026 Received: from mail-pj2-f7.google.com (mail-pj2-f7.google.com [74.125.227.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DBB44CC635 for ; Tue, 22 Sep 2026 20:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107524; cv=none; b=rqpV9uvzMJZ3nGk3DYIyLzwarvXSHcJleFOL3iXIluHP6bJM3o4fX4bwAiZ2dTrrjm5CGcyvLklXW5XUNpTjPXgf6noNtLw10h75VRY8fc+YH9Z7eSfT2ro55z1yTUdfAM2P2LJelSsRpXgUBmgTx5x9QaMtB4+uG0EHIjebEvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107524; c=relaxed/simple; bh=1pDHNl+G4CvtPBETGZyEKzroIwhv1rFF6EKCi1dNVNo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C2HDaCNZ4j0K31yEBzIY1xKuYwxSUfWpp8g8eCcp4zoVxHOK6CV6AkVGk/c6qvLZDnz/qZJ6vYKVhHaRGfE57oSJuPZKSgZhiKkovoGO7ardroFP18dXOPVO5BPdlKQOhnTZqXgsAyJi9DfNrtP3cXCUst98G+P9NpElaOmmioM= 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=RbhJprEH; arc=none smtp.client-ip=74.125.227.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RbhJprEH" Received: by mail-pj2-f7.google.com with SMTP id d9443c01a7336-2d9181b7e1bso439735ad.1 for ; Tue, 22 Sep 2026 13:05:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107497; x=1790712297; 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=RbhJprEH2b38dT1VC7soELYPQ24qmeIctbZcLX3JlsFRq2t6+8ZC8IvEueauVcJxVu SG30ShTblculUji+2wpZVW6FSFO80PZyuCJCJS7s0UJa8qR/PGSUAsgj4mmbI9wmfWY3 Nt8UNqsgJc19pGLWI5CVc7Gg0xKc2Z6m42j3OQ2LODkHmt+YttiWUCm17LUJIQADFNNG YWmwOU9gnVfbM6msnGGFQ0XSEXBGLia/2wiMXrbHwRhF6vCEGUISzXUZ6ehxrMSICmJv FXNoCH0hV6CcEz4VTKCIWr9rdNNMjliuZaklWD88I315ayzpFV8bWqLK/Kga31rRbyj/ 8+Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107497; x=1790712297; 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=gPoEKQyr3Bj47jLD3o+ntJC1aElvf2R0D3IW0tVhfKCWaij+jnE6ZEXFKL/UzkTAlX KGWU7iRGLuke+vW4L1yUw4bfxGgzy+QroH1VpLztVnzL31ZVrzJ1Qy76zlPSnaf9IMk6 gQdKlGMgeXcXX2/Xp1p6/JCtOYs0ABiSFhb0A7anGuTirUvAv0ADhu+cTd0sKB3tU7Bw pyzTWZaP5/2Cy6PVwF3z1Tf8hi24O0flHTskgRjwsY0weU6Ovg2uYB2w3EpZuvEdZXL+ 0vLrbRPfGp2jrRU2sXOFZguuKDBmyozi+AvHE5nhfZahCoOWmbXxczrqPL7attmel6OU PabQ== X-Forwarded-Encrypted: i=1; AKwUvByZRfqSsYeiVEVHX7oSWslzadpmz/1k90OX4mKaSG/e2N2XPPWCxPFjU+h/rVyalu9+g3htI4DQRi2FQ60=@vger.kernel.org X-Gm-Message-State: AFuF++k2Qto+2lC3XScUQecwP3HYMgfAZ8L40W9RAwAQKTghBgA8Yzam LLyv8wdkb5wIrhqpytQAa20ThMH6Eo3bE09fVSzruPnSM3YEc5PCsRkX X-Gm-Gg: AYBFou23N+TrwNp9DyTUY93bAymNngWrOg79upwXiOLXvWskfSzGBplg1lunBf41vge sILxUNXjwbftQ0WZOI1JgLwQ2TRQUg8GK1eG8mVj49ghx3rpDmOI2Y6YfhUHpw84owhcsj7NE1x Fb/ZGLn7ItKZ5H/Z9A/AMdtCPa82FGArt+hegTOGVIces1wGIOAq1t5Eb4sSRnAfi2vCzD5RDQt g7i7nHPNSyScXnQ+tlsNY7RtCPV/BvS3KJtYPChc4k0I9H37gqk2I5lCPPUG2dB8kJ+P7IVFOcz zf3xfuPFOQlLQiWcfMXWV8iWmQR8nFaWlF/03qZRNEdAYo0QFZGmVrTdCgrsOoA5eqJL40uG5Gr 3/63H47LIbVZ1LsgZGplzPiC4VSIxA6j01MTniNLWpU2W09DtlS/OVv4A7m21eBLQKOVRXSuG+t je+mJCmK+kuZFAGr0308QRhmVUrUHs34MNGhv04P+cwHO6ZcvLEq74+SZNkFBbkeB+JHJ1AA== X-Received: by 2002:a17:903:24e:b0:2dd:c053:b9c9 with SMTP id d9443c01a7336-2df699a3de8mr3224195ad.26.1790107496552; Tue, 22 Sep 2026 13:04:56 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:04:56 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 09/11] net: stmmac: dwmac-rk: add SGMII support for RK3568 Date: Wed, 23 Sep 2026 04:03:33 +0800 Message-ID: <20260922200336.2201212-10-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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 14:25:40 2026 Received: from mail-pj2-f5.google.com (mail-pj2-f5.google.com [74.125.227.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8215C4B95B3 for ; Tue, 22 Sep 2026 20:05:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.133 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107520; cv=none; b=QEPfCPradRBPjEQEHyac4kRxq7EqDm4ZDd9P9BS2oljD50RMgLNPXiCVt6N6zRzEmvortUYWJFmgiYVPE1iur2YTUXi1yR4BKwPne4cfCsup2GUKM+JKwwMpUC+lJvEyxW2ulBMAopihtZYuigyJLHCuYSy8FuAYMorsSwd2lT4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107520; c=relaxed/simple; bh=EAepGZi5JJgVl5A2Zgbnsm82y7MavVep4jBcaMjh1U4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LGY/9an2gxxKT5q41iyLKX5rXLdyBwzD6mmNy0jn7rwe3lwo7TdVpzYrLPNoz+Lyq7GIMSlcE3PU6kHSVc5jJXLMAs7Ev00mhn3z4e+IMbXTf8iQXzk6lle1SwnSftUBdTnoea2vuivXSS3gJurXN8CUBau0ybu90sDcCQaVMMY= 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=ehzT3xUx; arc=none smtp.client-ip=74.125.227.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ehzT3xUx" Received: by mail-pj2-f5.google.com with SMTP id d9443c01a7336-2d6f9dddd99so963185ad.0 for ; Tue, 22 Sep 2026 13:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107504; x=1790712304; 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=ehzT3xUx4rW/uBTmhMgoj333w78TBs0axtGyz1PuWXSgzFgovhSIFTBMgMikJOrc4k vHCtiAN0fJk+Ya9hRaCZcmQjOoE46/QVdISEQZOf9cpnpUElvyTVj7cbxxa57FiLlNAB jKp6D6uUTqgIbRDtPBGtUpTHVZAomote5esBDTvq/4U1PZrjFlr0ON1sbIMIgqNTGaTE tLO2l8zW80vI2TQEfmJUitGA/q9tnk9amO8cYAXzEbv3HND/OnHoG2g2dkuAz9vRLHcT iyzJfvrD+HN4PHZmzzuHPKZqr5Rgw8OOCL33l9oJm3qcF3DVws+4iJd3YxA8c8k6RlVs RNfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107504; x=1790712304; 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=iRyJ7D+KaUwBGnaKtSDEUzVurp7nehMRuD0hy9FfagIPrt/zLhHqoZgNsMDLbwiEcz UToYkFfv4rqbeNTVfQSlB4vdKMAYXzVFi23yPpgbLeSUWBYdiRMIzB1oQwhv3DPAjEhV m/SLWMzJVRSFHWIObNaaozZJ5ZYwsZ6pz+2hyRHYtgf9mQRJyQknICsh+WcEoz86310u G+uCE+/pvNXy1fXNO+DIB+/a5lycKLVILQ5dVPESc2tN+gqmWyQcNS7GMta1cL48EEgd Imp4PflvqI9PYjGc0o83E7gHHixZBSVOFetv91Q4LZ07ZSd4LLCZfy7C46+Iq2UtT1M4 THog== X-Forwarded-Encrypted: i=1; AKwUvBxbyP3keA1TB76aWDVKh3ekWFO+YtLCFIsL3clLEGQrQNrI8Bys2y6RdB431pvMLLVFhM8JU8uIqtJJsjk=@vger.kernel.org X-Gm-Message-State: AFuF++k2wSLzNkVyQSAxb54fgGzShifTImv/Z7jOOv+CQ2iqkfE2t8Sm 7BKUaFLl3IJy2nfJxY8ymIaUpQJumyGLGlAzraBmtX6DXQdLUE8xY8ZW X-Gm-Gg: AYBFou0CTjlzMfkERDJzNEyXkTlIByuyzKDZ4t79JjiiU9y7Pfp4DGsPwPS8Ov93cfJ RfEyjUM0QRm0SzVDhnPqg3tG+rgYzPpajHr+aCGOfQfb3VfXFOX0f4B4M9HuwL3dwuTEbvTXM8M VwOXDgR6TDGqnFYIFxTSgutV0PiKlOtEnaEokLVR+o9KMe5hbWYLaPAAJdFyZ+jN6CVj/l6P5r4 Ht323AsV8TpqHdKM21iaUe2T4UqmCy/x9c0gkvywsPV4zcQ5y+dWhI6sgdiYwklWta5Xu22x9OT PYmkT5JJDSjWQip8VDMzyP2K3SN23HtC3QLCMu7OMeurWABpdWxypSDvx20DZNu6XmL4Rr2bH+Q ZIcmr2OiTbrmGrXz/sX5HWAX7VyTcaC3YQ3MLPiWwKsCuUxnmF5o+8Hxqfisno/woBjHBF53p99 q98PvWgNbIw2IW9z9yST3pGDfzjlWrqJzGYWrlAhUQrpTSMt5DeKePfa26dc8FaxgvEguK X-Received: by 2002:a17:903:228e:b0:2dd:ad73:c984 with SMTP id d9443c01a7336-2df69d5ac91mr4126585ad.28.1790107504081; Tue, 22 Sep 2026 13:05:04 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:05:03 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 10/11] arm64: dts: rockchip: rk3568-photonicat: enable SGMII LAN port Date: Wed, 23 Sep 2026 04:03:34 +0800 Message-ID: <20260922200336.2201212-11-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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 14:25:40 2026 Received: from mail-pj2-f7.google.com (mail-pj2-f7.google.com [74.125.227.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 867654E2F01 for ; Tue, 22 Sep 2026 20:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107533; cv=none; b=V8VP/nN/BtXEaEabQwD63LaNvGd1lzDC3gKyVpVi194yX0lUoRFw1qmhwM79aUWmtCDI1vbE9Ik+oceDV8bmrciQXGz1+OZWJ9/noY6kvPHFf2/ag1v1678qLIEJL7RM67MT8Op5OMERhUeXFxAUQhRF7tYpvaVJxFTI8LaAUJE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790107533; c=relaxed/simple; bh=fh2Uu82ejF0DtKt0brgXH//fEo0R202bASP2cymwUFU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qT0Lg13hGRtjqTvLlfAaJ8px6NeBTPuzi/mzwyh/coRZhrFcIscZYVR02NVXYOqf1tALfmpYRMebxuzt1pmvz23jq6gnFFq64r32qJM/hCq15QOlp7BhY42AV5FC3p36TN3xoyLlYLoVkLvjqUxAEv/4mm9U1Ecddnsly4cqRtU= 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=UdSVq3K+; arc=none smtp.client-ip=74.125.227.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UdSVq3K+" Received: by mail-pj2-f7.google.com with SMTP id d9443c01a7336-2d903e972efso1031805ad.0 for ; Tue, 22 Sep 2026 13:05:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1790107512; x=1790712312; 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=UdSVq3K+yojQHpnGmXGkAEkPTwJMk03Ajk4hF9OLMwsODOjQCbvDf+WSAgGPzHIWq2 nRgmIJdoOtiaRZUQPD/DhCTuMORzVe9/jqNUoQDo7z8ZzIP1FdXm3Jbo7tZViUWx/m31 mfF3kkwqEvFh+8FkrYN59yqQKqKabszHdHIUpi3BwZZ4l9FlpmJHXUFjaMmFfT8kaew/ dqm+gs3l9v5N45jo9WZ/YYs9i92/yVuHWd1nTp1K2lPxtAkEO6cXxCakPlh1XJj13VRM YMCFM8YYrgdAsN6HoQjVmGG1cS7BIFlI4ER2QtgfLQl7oyIKbQBmNofZOf90LUkmEbNL KdyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790107512; x=1790712312; 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=t1cJ4iN5oqvxiS97dy9fw8vUu0yL6OWbc2nR9a7fORvF7W9cKM8glAX0EU8nHcqvTJ padnHm+FmU/J1uFiq0/cgJg2KwAai41f7cQQQ+aCLaxRflAYPxH9GSeXP4Yj2OzUo5AJ XSdiWbtzGql1H5fa68dkIBvqxPUSvs5R10t8RVMS9zhgiuCkYU0M/apoSXktArASeggy w9+f4TX8n1yC3y0rvkWTNV8XP2yurkX9eAjGRO7md7S4rympBZiGXyBOASriRNyT/h2l dBrsrGq498zQFxHsbHUtFUwDThqwyS11rHS9p5x8NFbF0uncgiP3Q9bFGitdvzZToqbs na1g== X-Forwarded-Encrypted: i=1; AKwUvBzHGsJEsw92EWWb+pdbukpwwu9NVdy8EvJYdSTl1g1MNEKPtxLi1FDpQOHCs7nE3CWhyxjU9mnDI4J1+GM=@vger.kernel.org X-Gm-Message-State: AFuF++l4MLCKpd0PVuhVTyjCaQg4Z1wlHnQef5c9IIULzZVjzp0/LAS7 OEO1MrYKMJUf9Q+JPUjWzaVyN32B1qAC/423yBZ+9MOrFZorzuzCYYqh X-Gm-Gg: AYBFou2NhgtEWGoCBg5s8w9KoRVSkLdQkII2Com4z/3d4MQ8lq84B8EbYmFqMWiRFfc 6JTr4xLmPDIW9UBSzO3hTVPFJxI27Blq3+m7Pdy6ILobMEmAgOM3Kc7rK+IrocR9c5KFGOXBzOT avnSW6a1eePBOXkNbstzMP79vhQT/8U5G0N1QR4IRI7V5ScZNxqOCCTQIycS6lj/6HgRi+LRXbt 4rZ/RON67/rSdn7AwAmsMfU5W9YSo3+jJzr01XQbIiIJbeH56R1GRjO/PWDFehxS7omL+8o2mt6 UXhFhn3ZXBqQKPJx7olf/sRwAy3ZPsvDk2PWLaN0y6gKGj2d89D8SsCpNiYuIqXXr7gx8MqBTnj qrwpHDLpc8jKx6+tZU/lc2840CsHO/UPcDh+vWOUGdeBmhSQV+ThBem1RpFrx2B7wxEecw1LvQY aFBlXQPJg2YE6ygSewhWeurMi5Ws5m3SYU/LvhZvitCDtHtwCD66E0CinWPAZ/4QTCH8JJ X-Received: by 2002:a17:903:234e:b0:2dc:fcfc:bdeb with SMTP id d9443c01a7336-2df69d3649amr4211185ad.22.1790107512560; Tue, 22 Sep 2026 13:05:12 -0700 (PDT) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2df6a5eea15sm654515ad.64.2026.09.22.13.05.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 13:05:11 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v10 11/11] MAINTAINERS: add entry for Rockchip XPCS driver Date: Wed, 23 Sep 2026 04:03:35 +0800 Message-ID: <20260922200336.2201212-12-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260922200336.2201212-1-coiaprant@gmail.com> References: <20260922200336.2201212-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