From nobody Fri Sep 25 23:09:01 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 85ECB4F6466 for ; Mon, 7 Sep 2026 15:38:44 +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=1788795526; cv=none; b=HPuWYhho0pFTCG2jbvSKsxEjpAlwEwGUzUxNc3gFzmSum2oXNP4cHJLBZDuYMJzOPTENy8PkwY2qvjwDT+5TcX5gBratkqk6E5gK1cNAL9K6Ba0ARTVd6PGzxzwphRfxg/EAGWe2tagsOx5Noe7iVoDVml3DNKylnI2lcWJIBZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795526; c=relaxed/simple; bh=zZSYG8rWqVaAzW0x1OGOA5ZHFOwtSPX4AOCPih9NuHQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kAuwn9p9ZRnsv3zNbFYq4U+wnbgQagpPyOKm+TYo9wNWNe6tatARhHZkavVUSolpVBV6zstkNlw7beGYTlvsD4VZaJY/cXt5R4QEU8Qupf2hTn/IVhIrFiqP/vCt+WpI4R+VeZSz7kxydcmG+AaCsUx/6fM1VILiT8osqujJKpU= 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=PijA6Nt/; 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="PijA6Nt/" Received: by mail-pj2-f5.google.com with SMTP id 98e67ed59e1d1-3965683e9e9so2174940a91.1 for ; Mon, 07 Sep 2026 08:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795523; x=1789400323; 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=072DC1m9sjwH8vCItObODzKFi49PQQExt3kYnkoGu5w=; b=PijA6Nt/pPQS9vWtSF3135f7Wz8mVqAA7YIZA//alUllP4ygDaYA27PsvJMAxpzKtv TSIH2+2rWVX7R2v1ZXXTmHBj9zHI9E4DtmETmfZA5g/5JkObg0puQCQ+gH471CUZLGJa K7L7N+29hInXMeAJ3bYwzGzkcmrPg8Zw0YKEn2j26vSgr/HXeNEb4viIXW8iCbwGZlH5 SShfKUjXHxFJf+SlM6aSHrApj4kjPAgpb5QvD9ggqcpYensn8vRtJfoV0NeC00j3uGJO iZGVOkZGD2GkQ/dTte2A8afCock7VWvxeb95sTREhA+RgfCHm2wRKwzTcIzu31/fD+Gv ONNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795523; x=1789400323; 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=072DC1m9sjwH8vCItObODzKFi49PQQExt3kYnkoGu5w=; b=Cuv7NapEQw/E7n03CtncR0XP6uR0/H5+YIPxW5/MG6ePPl8OLQEx8hfzu6ZeS0aUDg kDzXXKfNHTTv2zMJec6dboPOjWh6pE1MAWuUgzDkgasF4dCu9ntItlniY5ehMTsH9f9x 5yZo7fAHiB1FuVo0XVmgJ5IoCW/jNKx9VHb08hf3/n5LFrjYvJ38/3LkJYjsWRB5ckkq YE4EL8U8wLnwHAoMh+KjLemelvjiQdhhpbDlNCGmBCV2SSybf56euhbx7L1TKBo5OiSG kcylXFk4zCsahLRPj4K5Q0ThkTNmDUEKycXm0rjKhVj9usuqTOBNDFJRRROM35eo5cZF 9FJw== X-Forwarded-Encrypted: i=1; AKwUvBxMNx2DPMiTh3sfDW5jgrnX7xjcTfgQZojCExCJ4kqo/m3x0bAX5Bf7Gi9ZOB5LrqhkIINQs/QNfxQVUmI=@vger.kernel.org X-Gm-Message-State: AFuF++lLNLTw68u97P+eUCZmkNt7u1XZ913cOdJMRbyRX69zsxMQubFP kRYhcr3fP2wEAv3WIYoZjx5PNIiuQso/IXOGV6lNvvy5uosw7GB5ww2Q X-Gm-Gg: AYBFou1Ym9tpYW9YdLdQfT+sTMh4DMqEtefeJUcvmMvAEsDrJYvAbQAFzK1Z0PxZeK/ XkQd0A/sgivmrNUDNmyl05FwZMsX5cqQH6MO/qDG6XTeeS4AP+OtzisfFtcZLzxc0PRqpQ16Odj 2o0o/Ryj3qAXlUgBVcJBrKb9JboOpzpPmLhMr9IFBB/+5yFwYsa6Pdv38esTz4T+R+08LdI+Dfc hULx9JVGU39tMuAPLv4Z+WAm4iORf4K0soV8vrqZLH+adIaQ6N7DHTUs6baxJr2Try8O/OZtKmW sVLW8WSc02uI4lF+8RV3c697lGzgR1PonN3V7vw93s0rr+7gm3S87+XB6DH+xPWM9zHhy28lYoX y3mEFqPZ92U8OAgDoKuUG3dQCVdwzRvqpNAfgqGyU6Oie05HUKAPwNG3ExmxVjA50rY+QSWAhGU AeKE5fGvO1tQDtduXKGjc7GL9gohcTWo8GkuNDw1qI0rnVWd/UKm+z2fMKNno= X-Received: by 2002:a17:90b:2542:b0:38e:6aa7:68ad with SMTP id 98e67ed59e1d1-39b26101402mr32970239a91.5.1788795523343; Mon, 07 Sep 2026 08:38:43 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.38.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:38:42 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 01/10] net: stmmac: move XPCS lifetime management to platform drivers Date: Mon, 7 Sep 2026 23:37:04 +0800 Message-ID: <20260907153713.2572547-3-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The current XPCS creation logic in stmmac_pcs_setup() is problematic for several reasons. First, if a device tree specifies a "pcs-handle" but no select_pcs() callback is provided by the platform driver, the created XPCS is never used. The phylink framework requires select_pcs() to actually return the PCS to the core, so the pcs-handle property becomes effectively useless without the matching callback. This is confusing for developers who expect that specifying a pcs-handle in their device tree should be sufficient to enable the PCS. Second, and more critically, when stmmac_pcs_setup() fails to create an XPCS (either because no pcs-handle is present and no pcs_mask is configured), it falls through to the else branch and leaves priv->hw->xpcs as NULL. This will silently override any XPCS that a platform driver may have already set up during its own initialization, for example in a pcs_init() callback or during probe. The platform driver has no way to prevent this override because the common code runs unconditionally 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 introducing pcs_init() and pcs_exit() callbacks in plat_stmmacenet_data. These callbacks give platform drivers full control over when and how the XPCS is created, configured, and destroyed. The common stmmac_pcs_setup() and stmmac_pcs_clean() functions are simplified to just call these callbacks, 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. Existing platform drivers (intel, rzn1, socfpga) are updated to use the new callbacks by moving their XPCS creation and cleanup logic into pcs_init() and pcs_exit(). In their pcs_exit() implementations, the pointer to the destroyed PCS is explicitly set to NULL 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 | 37 +++------------- 5 files changed, 61 insertions(+), 41 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/ne= t/ethernet/stmicro/stmmac/dwmac-intel.c index f5f9fa67ecd77..fd5f01c8941c1 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 =3D NULL; + 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..d2f77f0c223a7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -426,36 +426,15 @@ 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"); =20 - if (xpcs) - xpcs_config_eee_mult_fact(xpcs, priv->plat->mult_fact_100ns); - - priv->hw->xpcs =3D xpcs; - return 0; } =20 @@ -463,14 +442,10 @@ void stmmac_pcs_clean(struct net_device *ndev) { struct stmmac_priv *priv =3D netdev_priv(ndev); =20 - if (priv->plat->pcs_exit) - priv->plat->pcs_exit(priv); - - if (!priv->hw->xpcs) + if (!priv->plat->pcs_exit) return; =20 - xpcs_destroy(priv->hw->xpcs); - priv->hw->xpcs =3D NULL; + priv->plat->pcs_exit(priv); } =20 struct stmmac_clk_rate { --=20 2.47.3 From nobody Fri Sep 25 23:09:01 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 5E5494F6466 for ; Mon, 7 Sep 2026 15:38:51 +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=1788795533; cv=none; b=oahcPg97f4OIS49qIktoH4Q9qZvUpgGbXg6kJ7zAbZSEAWOVdf6BHt0rGQS9ob73p8r1tUwTZwRaqJhOflAntGP6pKe9HTmVFcckDV99PG8Jtg963MfkiVbd9CDyX/LPgvwJdSqX61ar7fdXI67GLtowFi/vzAIRY5a34lrfwNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795533; c=relaxed/simple; bh=RQ8/bIf5S9U/FiX3uQoU1u6/FV6K7LLD2uqZys3J7EY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C6YE44FQnQnqw1cIjWjWAMgpdvWYea41VLVekwYXsUKcldJTyCtmbmg+WohkTOXadgr7IHFzO7lHOMXrJaVmOU8oBYaO4ZSiZGf1zMK36tavQXWct1AsuGC2oC6eQap4PVElS1IBY1r7Zj8uNfZfpUaorCCs1WVk9Ec2e1+QPyA= 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=Dv/vx9+F; 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="Dv/vx9+F" Received: by mail-pj2-f1.google.com with SMTP id 98e67ed59e1d1-399213ef56cso1810096a91.1 for ; Mon, 07 Sep 2026 08:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795531; x=1789400331; 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=Dv/vx9+FdyaJ5K0zDCPhMClqwDcb5KVaepp/oSxDG/LtCaX3Kyis/ZX1PEFp+KT/54 l0Z3+0WN/9GdcyDAt0RWEcbLCFWEIffYYOqg2yQb3UHoscL+Vz2blenkFln/TENttXUG hKfSYPHjqqs9tzfIcCYvhun/I+F6lsz6+1sKLdRc0RJvLenqdb0NdOmNagNT7Sk+p+g0 ij5aMKhzl+0TrmHWORIrgyfsbujZpATAxePIwq3071xmuin5vgvQcthSvcQVQ4lYwCap 1ijxd9HAXK73LO4qohu5D4M8dzIuZO0kdlcZVvfdqv1TUz/O3PImNnhg4OJ2Fm1GI3O8 Jhbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795531; x=1789400331; 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=CHmLECw6YBwuBGM2TUFZf64lXrWDxhsCWhAAJUFASrzSbVAY1re7YC7Mifte0EYVlL wRjF3cNvZijZJLGTPrSfDN/c9vdQ3uoGNGABdEBmsO4/tex+hbIseRT/UgkDEzxKOV4W sqjrRQSOn1ZBcN5qkWlU6aqms56aWrGayyMgSL0d2I9BfJ2aZjlVk6uTRoE9jH3LaMQz EtInLWGdBSXAStrgWb7LmWkj41dsT+esOAF2IzUsBjLiFQjhcCPhcLKaQkraZlL++i4B ODQh214VyFa9lEvVUWoInxKluybAL3VvL2gEvkN6NMHXCvQVQeFm5LRgaCLXzCn51Oux sWtg== X-Forwarded-Encrypted: i=1; AKwUvBwp4wMv+l3YE7A9QiQ8Zz9BtY+sSJB2phjXip0R4AV+yVS5wWouBbXlIPQ7xTIJsh73+Xs99/xrG25o+4w=@vger.kernel.org X-Gm-Message-State: AFuF++k+bd3u4icK/CaiD9df9FF40r8j/Q0lhKidj/vb128fP2ht7Keg a0Wahw+6e3OmBkSfbbCuMmruQhR5RStlkCJvC0IIZeBFHmU9b8vENHwVDk4yjn3G//DB+Q== X-Gm-Gg: AYBFou0oR1p9zOevywAKypDgj2UMhGCMUXh+AWPB+W/k8UEd5hmlp1JqitUobEd8jK2 uSBBtiNCO+6/A+OA1tUegnw3FbRuWtHyIzcz2z+dbxXwgl4els9YawCyJir5QB8LaZNTMseySGI /cR/hgLfXSmPwvhpNJnyv9zAvrrfY9B6liijvNlP5sOLBCqNI0MRgf3kvc8RwoDWD95YGdNvToW y+qDrqJWSGXEAEZ2MQ97jvW74xoA2twjB6efKP4SIvmuzviYMWsiJZboKSLjvVdvbbMRzEdA2kS ok8mjoxLQgcCXFmtl9x+KWRK/ruwUHY+JAUB6JXON3jFO1lAgDDO+JwJ+jXrdH+B2UzQvV7suEi 91vb4qKivRicqEPGop6F/TuL8pVqXe1CaCyhrlaT/hY7Z/KgDNuZhcYNs8t37K9pr/uwGBc/7dH 6oEPjzDLN5tcAdLcjmoKF2cTtz/W71hSypjomnQ2yUT2IrsYbl2SpGfXTvw98= X-Received: by 2002:a17:90b:2ccf:b0:398:a2a3:b631 with SMTP id 98e67ed59e1d1-39b262aaf3dmr37885553a91.19.1788795530498; Mon, 07 Sep 2026 08:38:50 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.38.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:38:50 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 02/10] dt-bindings: phy: rockchip: naneng-combphy: add rockchip,sgmii-mac-sel property Date: Mon, 7 Sep 2026 23:37:05 +0800 Message-ID: <20260907153713.2572547-4-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On RK3568, the SGMII interface can be routed to either GMAC0 or GMAC1 via the pipe_sgmii_mac_sel bit in the pipe GRF registers. Add the optional "rockchip,sgmii-mac-sel" property to allow the device tree to select which GMAC controller is used for SGMII. The property takes a value of 0 (GMAC0) or 1 (GMAC1). The hardware reset value is 1 (GMAC1), but this can be overridden by setting the property to 0 for boards where SGMII is connected to GMAC0. This is necessary for boards such as the Ariaboard Photonicat, where the SGMII interface is connected to GMAC0 and needs to be explicitly configured. Signed-off-by: Coia Prant --- .../bindings/phy/phy-rockchip-naneng-combphy.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-comb= phy.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combph= y.yaml index 379b08bd9e97a..8e898bce9af73 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combphy.yaml +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combphy.yaml @@ -80,6 +80,15 @@ properties: description: Some additional pipe settings are accessed through GRF regs. =20 + rockchip,sgmii-mac-sel: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + default: 1 + description: + Select gmac0 or gmac1 to be used as SGMII controller. + The hardware reset value is GMAC1 (1). Set this to 0 to route + SGMII to GMAC0. + "#phy-cells": const: 1 =20 @@ -105,6 +114,10 @@ allOf: maxItems: 1 reset-names: maxItems: 1 + rockchip,sgmii-mac-sel: true + else: + properties: + rockchip,sgmii-mac-sel: false - if: properties: compatible: --=20 2.47.3 From nobody Fri Sep 25 23:09:01 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 1C06446C825 for ; Mon, 7 Sep 2026 15:38: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=1788795541; cv=none; b=J7+Hov696Np4o/l2+L4ZMDxUOCkN/qsZyL/1Ai9HLgvHwUH41WIcjxSRgVstgpZfccUpIkR8FGbex8Aok0GaiBcBxjYuwhUKjaSTV4Y8oLAcGNmb9pV4vyVU0Mo2uEOe6dPWSxqRuL08hNF9rODo11dYsXffTB8Y8gUb3a0HMv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795541; c=relaxed/simple; bh=puR3hcsKpnP6vV5Zl58WDpiYi4UfmWoBZ4wnS5ijiiI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B1hadBmta7+M8Zxg9c8512k1AZrRpcqnoYwADXlwSth2Gk9lplhOu2x19qT2rFCnQkvGhA+iLASsNPOHfEfHWHqOl/LWBtCv5Goq0eRKdk/f5y1Dxcm2oIBHgbhRq+cFWUu4prLYDE83kZ/pVUhIJ9DYbC3qF2v9FzuLXA+5U08= 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=UI3O3T4i; 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="UI3O3T4i" Received: by mail-pj2-f10.google.com with SMTP id 98e67ed59e1d1-39641d0dba5so2300779a91.0 for ; Mon, 07 Sep 2026 08:38:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795538; x=1789400338; 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=F3aEYb5uf8Ywd6IPUhePKv9EQrcFVFS6EHQyfufoEjE=; b=UI3O3T4iGzvEB0cILW/TGWfjP1gZkN+8K9avsCp2k3PxlaL87Z0sXRCcyjATTVGV2M D25350fBCJ0qbmnqsn9ioibB0qbFi61Ly6ahxG+2m3Iw2stOhk5ptmJBqykA495Rt4TS M2shMkaDqhbGsqBi8hKQZo9TQ3x/FOt7eQ/rIvKy2yUGUYvc8gxzBDThx9avhpaj2jpb dArJVJfwa0jmjjxoeLyCzm/fK0Ovv4f58kseyr432H12HAXVooZY7/TzN912ws5nS3Hc MQjk5Grp5T1b67B23yxKqUI7IYuMj2/Azjj1fZVFTpDWraEvVti+EYuIqD45tpaiGRvB qVVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795538; x=1789400338; 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=F3aEYb5uf8Ywd6IPUhePKv9EQrcFVFS6EHQyfufoEjE=; b=hgqRBs7sPHcwnim5AhVs2Me0ISaPcCjIWW6LyODXpvXRLWk9l3msX5diuoKkWAu+Mn eVHoIijJDnEQxYT+dM7RtfLyQcrF7zF8fgWR7sS0nJ2Bas0rpSTfMSnoskzgxhRTstHI sMx/nz4TEG17s25p+GPmtYP90XExRxVNtkZlQoMweuPJHugy2VgsH8T94R4tbRJ+2KHx VQVT9UgOYKdoijPEU1fPT7uyllqPzxXJUkNHiOEp5UNTSgXQlCXtb+Y1LXtCx6u4oKNj E51tWQBh4UqCjcht7I+xgRBPksC2jlKMukEEMTrmZ9lfhNsXaI1bIkY1vONR4sKdNnYs KRVA== X-Forwarded-Encrypted: i=1; AKwUvBzjJp5wUujCLXTAEZu0vJD8TVD58iMdx1Yk2pIgbOFX20IwNLHaB552TFDXr5hZMbMs9INA5lIF40fvc/8=@vger.kernel.org X-Gm-Message-State: AFuF++mTW0Egq1ap3PB4av5t+ymBUcEZAf0QgnTzN9ZIWgxtH+MablHZ Hy5tS9fjylVsmjCnwgvfI3roiVICCihlTMKPdVnRK8ZTfP/T1arRUYTL X-Gm-Gg: AYBFou0OxDF2OYAaCP+R1+64Qp9Rj6e3+PLQLVYq/Gj6V+UnKd12ZGgbNm8EssWKurM vmaIwLI39xmvPFwafCwdT7Zt1Y/41giBDaD1Her1w5m/6cCvc901ooCYZvoTVAG4axCOsq14+ej wVyGDVEDlAl5VAxgB/OvdjDqvEioNDEwEWYfCpBh0tiLINMRL10643Hz62Yx9N0kP/tEuSx1A2U i7nLbWwtSo4vbgxkwJqqmCTB16cKleLnNJ+WGK8e90oHMlCaH9l8s5Q5iNMw41+Cf02dX/6IhJ1 SRLCQ7362Yjc/gdNz3a9P2A8kB3JRh8W00rWJb8YZTaTP5mFiEpaeQ2mMv6/mDCG42VpIuW4Ac8 pwKnNVE6sLEJwNvfuWeuO6pbcb3E2Z4/iErATW9RRgazzHghIj4p9rpzloGQvyhLl4DK5mlZlCe LSR0SkJXvkGxMIsBxx5WhdagmLdZLg1soCOgMz3rQ8K4DXVRWnfdGg0KPjflsD X-Received: by 2002:a17:90b:5106:b0:37f:c22a:c188 with SMTP id 98e67ed59e1d1-39b260feb03mr34662494a91.4.1788795538351; Mon, 07 Sep 2026 08:38:58 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:38:57 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 03/10] phy: rockchip: naneng-combphy: add SGMII MAC selection for RK3568 Date: Mon, 7 Sep 2026 23:37:06 +0800 Message-ID: <20260907153713.2572547-5-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-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. The hardware reset value is GMAC1 (1). If the property is set to 0, the driver routes SGMII to GMAC0; if set to 1 (or omitted), it remains at GMAC1. This is necessary for boards such as the Ariaboard Photonicat, which uses the SGMII interface connected to GMAC0. Link: https://dl.radxa.com/rock3/docs/hw/datasheet/Rockchip%20RK3568%20TRM%= 20Part1%20V1.1-20210301.pdf (Page 229) Signed-off-by: Coia Prant --- drivers/phy/rockchip/phy-rockchip-naneng-combphy.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c b/drivers/p= hy/rockchip/phy-rockchip-naneng-combphy.c index 7843356a4dd47..919bb97a4b182 100644 --- a/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c +++ b/drivers/phy/rockchip/phy-rockchip-naneng-combphy.c @@ -186,6 +186,7 @@ struct rockchip_combphy_grfcfg { struct combphy_reg pipe_xpcs_phy_ready; struct combphy_reg pipe_pcie1l0_sel; struct combphy_reg pipe_pcie1l1_sel; + struct combphy_reg pipe_sgmii_mac_sel; struct combphy_reg u3otg0_port_en; struct combphy_reg u3otg1_port_en; }; @@ -212,6 +213,7 @@ struct rockchip_combphy_priv { bool enable_ssc; bool ext_refclk; struct clk *refclk; + u32 sgmii_mac_sel; }; =20 static void rockchip_combphy_updatel(struct rockchip_combphy_priv *priv, @@ -375,6 +377,9 @@ static int rockchip_combphy_parse_dt(struct device *dev= , struct rockchip_combphy =20 priv->ext_refclk =3D device_property_present(dev, "rockchip,ext-refclk"); =20 + priv->sgmii_mac_sel =3D 1; + device_property_read_u32(dev, "rockchip,sgmii-mac-sel", &priv->sgmii_mac_= sel); + priv->phy_rst =3D devm_reset_control_get_exclusive(dev, "phy"); /* fallback to old behaviour */ if (PTR_ERR(priv->phy_rst) =3D=3D -ENOENT) @@ -873,6 +878,8 @@ static int rk3568_combphy_cfg(struct rockchip_combphy_p= riv *priv) break; =20 case PHY_TYPE_SGMII: + rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_sgmii_mac_sel, + priv->sgmii_mac_sel > 0); rockchip_combphy_param_write(priv->pipe_grf, &cfg->pipe_xpcs_phy_ready, = true); rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_phymode_sel, true= ); rockchip_combphy_param_write(priv->phy_grf, &cfg->pipe_sel_qsgmii, true); @@ -984,6 +991,7 @@ static const struct rockchip_combphy_grfcfg rk3568_comb= phy_grfcfgs =3D { .con3_for_sata =3D { 0x000c, 15, 0, 0x00, 0x4407 }, /* pipe-grf */ .pipe_con0_for_sata =3D { 0x0000, 15, 0, 0x00, 0x2220 }, + .pipe_sgmii_mac_sel =3D { 0x0040, 1, 1, 0x00, 0x01 }, .pipe_xpcs_phy_ready =3D { 0x0040, 2, 2, 0x00, 0x01 }, .u3otg0_port_en =3D { 0x0104, 15, 0, 0x0181, 0x1100 }, .u3otg1_port_en =3D { 0x0144, 15, 0, 0x0181, 0x1100 }, --=20 2.47.3 From nobody Fri Sep 25 23:09:01 2026 Received: from mail-pj2-f2.google.com (mail-pj2-f2.google.com [74.125.227.130]) (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 A66B94C0436 for ; Mon, 7 Sep 2026 15:39:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795548; cv=none; b=KtmpzA+WrEtIZJYo6YH8BPwFR0hevqomyRqefmK1ao8sz54R+4UgToZyA60fqn+u/4ku1ybCROGfoiir3qgziKvzVFbcxNHwGnxeYJFbhGkzv9aBpax43GPsUD9E25RbStlfHsH1ESmunjTARtmiMuS19o5KZSC378OEA0vF5Fc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795548; c=relaxed/simple; bh=oHYaNtlraUhl8j1v5uSplHKtyNUdHyxN7c+7WMfLpnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gnZXIkgn9VpBCkC7nj/vttrbTqklQOg+AfOvOwf0hcoRcQSMLq72hoDH82zyiah8vHJV3QjS3FXXV31T+/HG/yfiZ/nWiwM5vmcAnSf+BijRaHOqR6eYitYV1X2m/i2FI0vf4DwViL5dr4sD7eUJMJEtKjsm1Un8HqRYBwpg8ok= 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=kncc1AMP; arc=none smtp.client-ip=74.125.227.130 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="kncc1AMP" Received: by mail-pj2-f2.google.com with SMTP id 98e67ed59e1d1-39b2ad83680so1545196a91.1 for ; Mon, 07 Sep 2026 08:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795546; x=1789400346; 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=z6aB1UFx2dxtuDUMhshejketJxUphgoMFv4AnQI5Bfw=; b=kncc1AMPckBK2wC/EFxqB9keSVfJrlb1S4qWK2o3eyKbTQ4JOgFJdyEWaZIeDcCPJ2 kuaa467DGAiuPW/Hz+txbTTAm0ga5x2KB8wIhwJc9iskEj5AaCYyhA4wBjYnRYrvEusZ Pkk7r66F1vKR3DpIW6EbWGRzD4kXxH0WlJUr4oSk8/nTqtfRalXqENcnDrEv8fAmQaYO /MJt0xkma3JMXp6T1cDfuPsX/LEO3rPtzVUkf/OWLkN6nav1LO0T/pjUDniS5zSImxbX klKYCfSJX2gR/hIZT0noAz3laDPo6leIFu7We/qyKp/S/zZjlsHudMjPphBwSufMo3Is jGAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795546; x=1789400346; 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=z6aB1UFx2dxtuDUMhshejketJxUphgoMFv4AnQI5Bfw=; b=YS+b9ffjJkxT3JjV8LKYZxvZwkhwO9rrlBwkjiDgbEOqBd/76yMMYu7oPXwyNJYd0O rbQL8wSUQ2MIaVfLQfM6ViQhM54lez0IBadVXPKT4DVyqY9eUPW7nCp1AA3ZKItW/hR1 cvgeJa3j5/+H04UeQ+5V5Js1RX/AKD0UejMiC19cGr9PZIqvClK9ePUM7Bb5RBBBrfCV +uIgj6DdFcyKvyNzpTWhKL+Zv/w5aOmobNoA1a0RX723KtC9CPgaOKqEh5IlQkV+3HWF zK+aQATAwWHMlJM91ehIv/8sUNwDTeb2VjmiDIip8UkCyE56ymJ93SiAN+z/+NonF9rL Wpnw== X-Forwarded-Encrypted: i=1; AKwUvBwrX+jDpdTOGMbFrCDXUamjV2GCPL/AuDtsRIm1h4v+GLE13udU86P7U1LHoXh/6AFAECIbABr0vcsvp1s=@vger.kernel.org X-Gm-Message-State: AFuF++mP/FN1LbNS2p/gNw+rA71bxsNoKff6gjvmRX3naJCnAGFTRMhm zNKQjvIh7uGFpwX5jRKjZKK3ckdoKWJ9dPzB9bxywTr5Ej/TGM35VJcM X-Gm-Gg: AYBFou10QPZMSk5T/llhgGChIwIUJ0viv91qca96qKZMaP7rxGt5igfDiemENpLCME6 /fz3MeZ0RFy+E0hTmhfrGuRpR0npkI1si2CiDzDBjK1duc96fQNRBPWCvpGB4FgK2PeHCxLr8Va jnGkYV/9XmcsKE6erKIxBonYK0P4dMOJbi8+wPcvrSCanffugqJmusQvbDPIMwaUUVGpyxjYWpO 9sgA7DFVL5euTKzrMDMP7hnGz0JIZMqS+GP1pxpHvCT+eTzN0SPf/FERawWZvshVpeJH7WegdvG qgDzJfBml/5ummii4k3ACQfKr6xPbU3ApDHjfSCJZZi6VckokL2OuS2hmQ0AnKNpnrUtO/L4sKo rG4MDsq4tuxpOzrRlKjMwmjvFmPu3TqYWXGI16V/nwPKSiMAjPLf8m7B4B8bBvJ7J1jxVFAN5h5 D2goPbULiKLO/665+FYLjMhBKINVMLmpd7RFN1pH4lo5//mA4eYkV/2rIrDzM= X-Received: by 2002:a17:90b:3149:b0:393:194d:5366 with SMTP id 98e67ed59e1d1-39b2618060cmr36557328a91.10.1788795545874; Mon, 07 Sep 2026 08:39:05 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.38.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:39:05 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 04/10] dt-bindings: net: pcs: add rockchip,rk3568-xpcs support Date: Mon, 7 Sep 2026 23:37:07 +0800 Message-ID: <20260907153713.2572547-6-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add device tree binding documentation for the Synopsys DesignWare XPCS integrated on the Rockchip RK3568 SoC. The XPCS is accessed over the APB3 bus and internally connected to a Naneng Combo SerDes PHY. It supports 1000BASE-X, SGMII, and QSGMII modes, with four MII ports. Signed-off-by: Coia Prant --- .../bindings/net/pcs/rockchip-dwxpcs.yaml | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/pcs/rockchip-dwxp= cs.yaml diff --git a/Documentation/devicetree/bindings/net/pcs/rockchip-dwxpcs.yaml= b/Documentation/devicetree/bindings/net/pcs/rockchip-dwxpcs.yaml new file mode 100644 index 0000000000000..0852d0bcb66a2 --- /dev/null +++ b/Documentation/devicetree/bindings/net/pcs/rockchip-dwxpcs.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-dwxpcs.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: + "^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 + + 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>; + + pcs-mii@0 { + reg =3D <0>; + }; + }; --=20 2.47.3 From nobody Fri Sep 25 23:09:01 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 F157D4AA401 for ; Mon, 7 Sep 2026 15:39:15 +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=1788795557; cv=none; b=X2yRaJXRFsovVz/uvZ6NoY/dc0ZDM+y9OrVGJcMNMBwpFT4gkcMvwDDmGGHxePcvEBb6KN9cfvKhKGj8ap4zAqzj3Y9mLgu6y0TepwX0lDmc/gVUDuHA7PVhnCi6BateQEgUXvGs7WLkExORc5lu5XyJNTCTn4grSAjKFFx6Pho= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795557; c=relaxed/simple; bh=A5WWFF/meLRT9K96dBTf7EzhnS37KtSW6R5N30B3Ssw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EsHNtBgI9OYT7LfLKHYdd/A+/HpfFXLKGwdvdNOxIb6HCIrXzlgv8Pz9V4SPkFEGGh3Nm9oAoasmrekYN7qEDbP4gWSVHuxgLF0rW/rcdu2xZX7gWz8dw85PhCEnyknntzgjgxGX6DlupDOhyiDO/s13rsTkNe3tc+xy/Yh9gB8= 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=D9xOXlLr; 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="D9xOXlLr" Received: by mail-pj2-f1.google.com with SMTP id 98e67ed59e1d1-398e10200a6so1899658a91.1 for ; Mon, 07 Sep 2026 08:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795555; x=1789400355; 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=7/ufsj+YTp5B4a6XdY0sQWUkJ+NQSUpM6CSLQJOVS40=; b=D9xOXlLr68TEJ+JBofZUaqo63eKYDmeOhvDTY1ZCmAPOg3xcz1CvcaIgr4TyTXnDOJ 8PWhf6ztv8B5284R+9xulnkZSJoOD/8bVJysmGN0vOscjmcB27/jx/nzHMiFDat4c43w aq5MK5RrxUG5rUfXoYtuGN4x7LFYjSP5MzHQNt2Xn/Ao2lWJ4oz3IfVcmjZZxlYxY3Cu Gk7eMsh4L2UcbRsmpOGM0aOryw3w3jZyklS3Wr7cRx6w5z/P5dWu7Wz99hdX5xQdIl37 GWKz8a4JsaHMYYLCQvsSUHwTB0J9shzMfq6nfYo368IZJBzWcQvC6NH3L/wEn9uxpZ1U Frkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795555; x=1789400355; 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=7/ufsj+YTp5B4a6XdY0sQWUkJ+NQSUpM6CSLQJOVS40=; b=hJR3xQWCx6NmjyrqHD2J09jA4iuj/7t2WDJoOzxi3dJ3yYNGd7OH5TMLAZIiGIs7dY Mec0Jfdop9PwKA/UBazeMZZSy0TCwgt60SfoeUI6/ugA+pdLWMvEq0UWNgoy3w2MYBcp B/Lf/2bfdYimULxPugFawhy7UNSBwWTjngn9ibtSFAqZSlUvFEy0ylMdhkIxzQ4i9HrS nofHpjgQAJHAYr909grG1OYyg+dbNzIiR1sYFRnnOeEAAlcrdVYxX4kr4avH56Mp812D UGastEqbolfAK5v8eFAB7MoA7BLcTEsyaymA9W1CGSKsAGHk42zcpFA/cqfA7z45tWv1 ceBg== X-Forwarded-Encrypted: i=1; AKwUvByvkQmgJr3GNSN9+FBfRkTiF3hDmNU5s5o/3DV3669c5PHPfuxfIUCvlYMzOXCKnvoufWSKsnK32qkuMUI=@vger.kernel.org X-Gm-Message-State: AFuF++mn6SAjOFxiGoe0Qj2m1kXuWIzpwj7iB2Rvfrmybb+Q72HmrQMh vArvPwbHvfKnzPPbzFRGMVYi64FG5xLooUioazR9/bC/JbYEGhK2R+tu X-Gm-Gg: AYBFou1VMgQ9AQa8hyfX0NF5WLA3i0n2ddjcc7M+VgmbTaBUDLEjhMerDn1GTBkAV8w +z7ITpJ+/fh3d8Nf416obivvXmFpaGSBBgq08FK67E5otdVcSUQZccpuWKa5xymZGTRRhfPpwSH QD1GCq35L1CNjAesrgMoIGXt8Ex1MslpPSOxLLBrL8twBh4jWm0Lrr4cq/RjqpT4NrxE+dFatkC 4QdnnH53MbKBhGpYWpkjb+NpWDjsLE8EGaGvagy7rCp3sjOc4YwmUZHc3q9pJg0PaBbiGRlthGE usd5EALRH3twdjqFiAXWYUEWjWe13jBG4wHwJo4cfsTJwJOp3Em5JuHP/fMdXSbWVxaHw32Ij1f 91iUZq3y0DUakr3wTGksLPIvnYHnBfFe++oSPwr3luUPRi/jq70hVEzmtlis7qhVTfLqNvBGuqO 7eOHQoPOuDHNVXM61W/OSX8/Gjs8Sa9TPz8Izh3ons9TRbfFZhxiavER3Xsq4= X-Received: by 2002:a17:90b:2681:b0:38f:5801:dc0e with SMTP id 98e67ed59e1d1-39b261d52a4mr35850991a91.15.1788795555107; Mon, 07 Sep 2026 08:39:15 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.39.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:39:12 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 05/10] arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes Date: Mon, 7 Sep 2026 23:37:08 +0800 Message-ID: <20260907153713.2572547-7-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RK3568 SoC integrates a Synopsys DesignWare XPCS that provides the Physical Coding Sublayer for 1000BASE-X, SGMII, and QSGMII interfaces via its four MII ports. Add the XPCS device node and its pcs-mii sub-nodes to the SoC device tree. The XPCS device is accessed via the APB3 bus at 0xfda00000 and requires the CSR clock (PCLK_XPCS) for register access and the EEE clock (CLK_XPCS_EEE) for Energy Efficient Ethernet operation. The PD_PIPE power domain must be enabled before any register access. Also add two fixed-clock nodes (xpcs_gmac0_clk and xpcs_gmac1_clk) providing the 125 MHz reference clock for the GMACs when operating with XPCS. These clocks are used as the assigned-clock-parents for the respective GMAC nodes in board-level device trees. The XPCS node and its pcs-mii sub-nodes are disabled by default and must be enabled at the board level when 1000BASE-X/SGMII/QSGMII is in use. The fixed-clock nodes are always present and do not have a status property, as they are static clock sources. The XPCS node also requires a reference to the appropriate Naneng Combo PHY via the phys property at the board level. Signed-off-by: Coia Prant --- arch/arm64/boot/dts/rockchip/rk3568.dtsi | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3568.dtsi b/arch/arm64/boot/dts= /rockchip/rk3568.dtsi index 3bc653f027f1f..989e164c0eb39 100644 --- a/arch/arm64/boot/dts/rockchip/rk3568.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3568.dtsi @@ -110,6 +110,51 @@ sata0: sata@fc000000 { status =3D "disabled"; }; =20 + xpcs: 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: pcs-mii@0 { + reg =3D <0>; + status =3D "disabled"; + }; + + xpcs_mii1: pcs-mii@1 { + reg =3D <1>; + status =3D "disabled"; + }; + + xpcs_mii2: pcs-mii@2 { + reg =3D <2>; + status =3D "disabled"; + }; + + xpcs_mii3: pcs-mii@3 { + reg =3D <3>; + status =3D "disabled"; + }; + }; + + xpcs_gmac0_clk: xpcs-gmac0-clock { + compatible =3D "fixed-clock"; + clock-frequency =3D <125000000>; + clock-output-names =3D "clk_gmac0_xpcs_mii"; + #clock-cells =3D <0>; + }; + + xpcs_gmac1_clk: xpcs-gmac1-clock { + compatible =3D "fixed-clock"; + clock-frequency =3D <125000000>; + clock-output-names =3D "clk_gmac1_xpcs_mii"; + #clock-cells =3D <0>; + }; + pipe_phy_grf0: syscon@fdc70000 { compatible =3D "rockchip,rk3568-pipe-phy-grf", "syscon"; reg =3D <0x0 0xfdc70000 0x0 0x1000>; --=20 2.47.3 From nobody Fri Sep 25 23:09:01 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 ECF67472559 for ; Mon, 7 Sep 2026 15:39:24 +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=1788795567; cv=none; b=jjY/ty/9H4auVX2GljpGgsRhaBs2EoArhXTboUgLy2sQutsb/DhX6v+IFTnQLHrBFQ3xAnNGbeF8xrIV2f8FeZxZqKmAV6qFZ++ZcHYVXt0QESMcf3t+chgDiMyrKD5SlFnfZ6517FwuWc6uscfTb3QiqChyN9nxMPRzyq220Mw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795567; c=relaxed/simple; bh=iCQafZpFqsdcijM7wQ/VBsqWEiby6qk8Gp6Xz65rtD8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cMyejzmIRiYxYplooTeZPkoWKM9pzT1v8tYa4tm3Y7egdzk0xeca4ZbKTwEhaK38nfDV2uuL60sEgV/XriQOH1yDMXVJvrd3BxOjtnCiJbeEa1teUcfLo7gTzEulSDs2KuFfCLBJwVdLT2s5nNNEgnOG8JYtk06sS961RYWh7q4= 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=nq3peZFv; 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="nq3peZFv" Received: by mail-pj2-f7.google.com with SMTP id 98e67ed59e1d1-398e03cc38aso1351274a91.0 for ; Mon, 07 Sep 2026 08:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795563; x=1789400363; 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=7inwahIcNU1aV9djAHi258zSUQz0eW0dslHEgzobBAI=; b=nq3peZFvmzK87LoeWIpAIpyGBN4zVxHSK9kgopmCrgyEeldFt3bSk8VWcWHZva4G+M SVGiyKBEPm4Ir3PYejzyUpBa7ZBSbA5yNPUPaAMjPACDzgWDEnQIy1t2NsARUl4fWpVD UYLj3SOR+U4AExfQ9i66C9rrPsh4hs6RmYTT8/2kt7cggshcb6LcB5l5nrSSEB/xkFdn Uuy3weqqrUSWxSFFFxDXvdd/EQQWFOvePMqmu0h5R3gUltD73wuNl4S3MBY9DyKHw4KO PEkYUQAUrmNcVuVDfKhqp9isRC9/mALt3xVq0gJr+0YY5P4NSE06gIAxPJDBOv2gweYa MnHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795563; x=1789400363; 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=7inwahIcNU1aV9djAHi258zSUQz0eW0dslHEgzobBAI=; b=HAZkNnCYqZYEss2DS4E6tvaP3wBlXoIcgYNhuIxZgOFZ8ii4TIclLau+6MAqYbCg3f QKAMVpM4dCJkeMqMFCuc5hvA1uov51z0gXNsdfPSIqHsi8Zsca7GcCF9dXq++zXSa9eq 8DptaMG0eL46GWh8GenOHH0c5P+k6s7XzZOJz+JgZ34+fg1dNcixG0RdyOJMM39hdjv0 V/jUezBz+XnwcWR7EvuUVvcPBnxRti4HfEuc2zIrTXJ3UTLRu5N+Rig2xZ0GZ8pfD3ul MHwUXmK5+PcMb0Odhpk/m9bqoQzLOq18Nbe7y2H20RqLYq2R3+NVxG9+PpzRcxjTk+G1 RpcQ== X-Forwarded-Encrypted: i=1; AKwUvBxty11Xz7057bEWtesEtLvGPwN9Or0eofS9CxV0VRJJPKGv/X7BR2K49E7unW8VJYchRn70caSuGz/FDS4=@vger.kernel.org X-Gm-Message-State: AFuF++lc+QC8pE8yEdB2IcHvGo7baWOf4GdhN+aL0uXn91fuh5T36R2Q ATHqpbJUVoGIHFWnd1G78arIPbH7K2yfJEfFptzdXxdTRhImGrfseSVC X-Gm-Gg: AYBFou1PbPvDSZPO9WRfz8Zf01Dvuv18QgjcIq/0+xRbJY86EtoGCz5a7jyC4ZVK2FT 7JUqhLgBag1UEeuo5xdlWMQKLkTwakBNTtodLFsnat6SKCoEQ7TdNPeI7jMlfz6aeJaugKJGJEd Rd0sfELitJtLLqDIbebncnSLiZS7y9rswN03aZGHD87YDab5JF+ZbLi+m/hcsbveJJVOrHUdluW viWIJMddAvBQIUqYsQAzC7ifB0mOamKeplrzeMBMVXVdq16yE64KbgAGCOZaowRENXIX0++gmZg C16wMdOsCSoY+m6JeGqy6fX/MOmx8j20KJR4BFpTD14GB3DiaKOKUdoSzW6zPhtIKi88eV+OkOc dhU0u1e0hgHqAZeKoDCQZcc203ahRhzuMfKDAGDsfcoHL5E1KIb1cKMTQCIt4bAmd/r3Uwvfj0p qRR4flKEY2iUnSpnjNDeH1UaoFwKMFFrpVq2QZSKeoZrIq7LLpk8MaJ5j9krE= X-Received: by 2002:a17:90b:384b:b0:38e:524:8797 with SMTP id 98e67ed59e1d1-39b261e79f1mr34240199a91.13.1788795562857; Mon, 07 Sep 2026 08:39:22 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.39.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:39:22 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org, Jiawen Wu Subject: [PATCH net-next v4 06/10] net: pcs: xpcs: add ANRESTART support for SGMII link recovery Date: Mon, 7 Sep 2026 23:37:09 +0800 Message-ID: <20260907153713.2572547-8-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-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. Tested-by: Jiawen Wu Tested-by: Maxime Chevallier Signed-off-by: Coia Prant --- drivers/net/pcs/pcs-xpcs.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 0337e2bcc0125..50b9cdf94fdaa 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -816,9 +816,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,10 +1098,15 @@ static int xpcs_get_state_c37_sgmii(struct dw_xpcs = *xpcs, return 0; } =20 - /* Clear AN complete status or interrupt */ - if (state->an_complete) + if (state->an_complete) { + /* Clear AN complete status or interrupt */ xpcs_write(xpcs, MDIO_MMD_VEND2, DW_VR_MII_AN_INTR_STS, 0); =20 + /* Initiate the next round of AN */ + xpcs_modify(xpcs, MDIO_MMD_VEND2, MII_BMCR, BMCR_ANRESTART, + BMCR_ANRESTART); + } + return 0; } =20 --=20 2.47.3 From nobody Fri Sep 25 23:09:01 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 3E51A472559 for ; Mon, 7 Sep 2026 15:39:31 +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=1788795574; cv=none; b=XQDppfVQ+aT4g8f6jBJd1vDVldXI4Tfm25GRPp562BAmuKuqqk/ih3UtnvCCwanzMqJaLqIYDiO5ZVp5ZcMOlo2PMpOMaaZRbnZyijogc89Woa2YmhWkgmnXRsZJFT9kVttGazB7ZTeFWCxiuPE1An5xLWMqJS4KwyqYFPuuJPM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795574; c=relaxed/simple; bh=N+CKECl3TXAtCKPEctmR99/oBi2p+LKkRBlJ+7klc88=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PPpGipzQL5IplxPKBspG8wV+FVZh95k4dcPtTA2sis+hufbO4HBfWRsIQpNU4VwDUPQrMNR4AYyUh7CqEAaUhuAAawXnbAfvNLczpddVjZDmud3hRHb8s9CH9dRxeXiwqaYkKu0CiKDnsW69dvQk+jxVLHAHCexgmFSLhh6zi/w= 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=Po5BLPnd; 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="Po5BLPnd" Received: by mail-pj2-f1.google.com with SMTP id 98e67ed59e1d1-399213ef56cso1810286a91.1 for ; Mon, 07 Sep 2026 08:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795571; x=1789400371; 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=BstDUit7ot3f0vACARqatGMXlo+FEmZofFVCm43cwtU=; b=Po5BLPndmhBwSwo1eNvbaGi9rU4+DAj3gbDipZgZ71oWGe9xs3G5XHxiej8eXv5BH4 aJUQ29ocN1XKf2RC5BME52zq3bQgavkBkAsm7tqHZk6R2GVuQNipLnLuy9e5z7L9n3dL BoeTaZq+3YjUu/1xZyBJiLsJ7j3A6Lzd8z9gTUGKyuhfWhEWQ8svNCLFBDCMRZJdrOu+ Va6kI3Tmn99w633KNkhEY7Iu2QiaHt7TV8puafcsxZfatXSqP6EE4H88hTin8sOed1AH CXt9sRBt/Zrc+nSPFW4+lhN/5J7n8hFWS3B2iMKlXis6GbwLuBRkXSAo+qaynqG+ETDA m02Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795571; x=1789400371; 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=BstDUit7ot3f0vACARqatGMXlo+FEmZofFVCm43cwtU=; b=ph8VLgjcxnf3tEdwATykNSKLtcP9Lvu0KS/RI+hZgvBGSTDkJPWPxWLEmACVo/vReY q/BkG+e4Ro4LaSHCgQMO+0sjJmxJ9obBdXGIuiSCBnVl5O0yuwRS/TfgVKr64/rbG9OC s5fL38oQ2Ep5xiJnrpnAxs5ZHK8bQX8MkU3nw57vcECkHpTCw0UR/sKGueBDZ+Kyk2p/ V5/FROrmFenuObPFU7ibbYCbPihACmDU2R5A7GBwL2VJNTE5yvdCfE41/oIrZy5kBTg7 6p+YCx6ErWdYJbW1Euxlf8QqQbJ1eDcN53fME8q179YmrizgfxO1Rw0D116OVWIjLgYO dMpA== X-Forwarded-Encrypted: i=1; AKwUvBwlRECnDjv7MutLJ9pjJ+dcPuM6CzsU/hiUQHFfqDJ20XbJQ7Yi6rTHv38ewign4Uk4kbeS0FgO9pWs+/Y=@vger.kernel.org X-Gm-Message-State: AFuF++kg8MbQjTu0H7jRaGqDd+F9WUHYhjHS7dFmpqwvEIJVhWzgqYgf QZiVA8mHPvIp/QVVq741rP2JlST2Q1Hq+/2A3M8EYMizNJYatuwdSxLL X-Gm-Gg: AYBFou3BKk2VPtQ3u4EO2VZpwccV4AnuwW71QoNK9wap3zsdBDoNxaU63QYY3yiu5E4 8TWXSvnMIBNaL4tS2EehfrTVJt62uFFrRMtbLPCspmydtzAXXv2I/4DFFVOnDbP6IIov+iS0Umr Q1DsbGjSL0XfMM4OGhovT5m3f4yQeWGZY20OfkVEnDT/KHg39/eac3Ot8BlahmKCVZfT0gNgsVw o/NZKBr63Mq1SxgGS+fANJDtswkpvmb5oShD2n4Y5MyNkBmUStfmiGL7/A51XrjK3Oau1bKzh54 GecGr5RG2rizFbX6sXwEZ4aAKNo9kaYgmd6c/iyvn7Rfgga9FXovY1TLHFta7pxN+AJJznvKGgz tUAtSeCzZ/i/DSpliHPWMoTEQQqd/myOh0jx/9Pok72zNdGGbusXrvtOwL8xgeea2wremOuKEUV ARQCcvpzs0HgwtI2shwgSRiMTa/3u9bW8xqqg3xsoOVgPhoDYxVItlUBj8h4k= X-Received: by 2002:a17:90a:d2c7:b0:398:9bd1:3216 with SMTP id 98e67ed59e1d1-39b262e4e02mr33977790a91.23.1788795570525; Mon, 07 Sep 2026 08:39:30 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.39.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:39:29 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 07/10] net: pcs: xpcs: add Rockchip RK3568 platform glue driver Date: Mon, 7 Sep 2026 23:37:10 +0800 Message-ID: <20260907153713.2572547-9-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-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. 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 | 23 ++ drivers/net/pcs/Makefile | 5 +- drivers/net/pcs/pcs-xpcs-rk.c | 543 ++++++++++++++++++++++++++++++++ include/linux/pcs/pcs-xpcs-rk.h | 11 + 4 files changed, 580 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..88bc40791e69f 100644 --- a/drivers/net/pcs/Kconfig +++ b/drivers/net/pcs/Kconfig @@ -12,6 +12,29 @@ 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) + 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..68bcaa1a5cbbf --- /dev/null +++ b/drivers/net/pcs/pcs-xpcs-rk.c @@ -0,0 +1,543 @@ +// 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 "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; +}; + +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; + } + + /* read remapping to MII is performed by HW */ + 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; + } + + /* Writable only on MII */ + 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; + + clk_disable_unprepare(pxpcs->eee_clk); + + pm_runtime_force_suspend(dev); +} + +static int xpcs_rk_init_clk(struct dw_xpcs_rk *pxpcs) +{ + struct device *dev =3D &pxpcs->pdev->dev; + 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; + } + + return 0; +} + +static int xpcs_rk_init_bus(struct dw_xpcs_rk *pxpcs) +{ + struct device *dev =3D &pxpcs->pdev->dev; + static atomic_t id =3D ATOMIC_INIT(-1); + struct mii_bus *bus; + int ret; + + bus =3D devm_mdiobus_alloc_size(dev, 0); + if (!bus) + return -ENOMEM; + + bus->name =3D "Rockchip DW XPCS MCI/APB3"; + bus->read =3D xpcs_rk_read_c22; + bus->write =3D xpcs_rk_write_c22; + bus->read_c45 =3D xpcs_rk_read_c45; + bus->write_c45 =3D xpcs_rk_write_c45; + bus->phy_mask =3D ~0; + bus->parent =3D dev; + bus->priv =3D pxpcs; + + snprintf(bus->id, MII_BUS_ID_SIZE, + "rockchip_dwxpcs-%x", atomic_inc_return(&id)); + + /* + * MDIO-bus here serves as just a back-end engine abstracting out + * the MDIO and MCI/APB3 IO interfaces utilized for the Rockchip DWXPCS C= SRs + * access. + */ + ret =3D devm_mdiobus_register(dev, bus); + if (ret) { + dev_err(dev, "Failed to create MDIO bus\n"); + return ret; + } + + pxpcs->bus =3D bus; + return 0; +} + +static int xpcs_rk_probe(struct platform_device *pdev) +{ + struct dw_xpcs_rk *pxpcs; + int ret; + + pxpcs =3D xpcs_rk_create_data(pdev); + if (IS_ERR(pxpcs)) + return PTR_ERR(pxpcs); + + /* + * The XPCS may be attached to a power domain (e.g. PD_PIPE). The domain + * must be powered on before any register access, otherwise the SoC will + * trigger a synchronous external abort (SError). + * + * Accessing the XPCS registers also requires a TX clock from the SerDes, + * which is needed for the soft reset. + */ + ret =3D xpcs_rk_serdes_phy_init(pxpcs); + if (ret) + return ret; + + ret =3D xpcs_rk_serdes_phy_poweron(pxpcs); + if (ret) + return ret; + + ret =3D xpcs_rk_init_res(pxpcs); + if (ret) + return ret; + + ret =3D xpcs_rk_init_clk(pxpcs); + if (ret) + return ret; + + ret =3D xpcs_rk_init_bus(pxpcs); + if (ret) + return ret; + + return 0; +} + +static const struct of_device_id xpcs_rk_of_ids[] =3D { + { .compatible =3D "rockchip,rk3568-xpcs" }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, xpcs_rk_of_ids); + +struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *np) +{ + struct platform_device *pdev; + struct device_node *pcs_np; + struct dw_xpcs_rk *pxpcs; + struct dw_xpcs *xpcs; + u32 port; + + if (!of_device_is_available(np)) + return ERR_PTR(-ENODEV); + + if (of_property_read_u32(np, "reg", &port)) + return ERR_PTR(-EINVAL); + + if (!xpcs_rk_mdio_addr_validate((int)port)) + return ERR_PTR(-EINVAL); + + /* The XPCS pdev is attached to the parent node */ + pcs_np =3D of_get_parent(np); + if (!pcs_np) + return ERR_PTR(-ENODEV); + + if (!of_device_is_available(pcs_np)) { + of_node_put(pcs_np); + return ERR_PTR(-ENODEV); + } + + if (!of_match_node(xpcs_rk_of_ids, pcs_np)) { + of_node_put(pcs_np); + return ERR_PTR(-EINVAL); + } + + pdev =3D of_find_device_by_node(pcs_np); + of_node_put(pcs_np); + if (!pdev) + return ERR_PTR(-EPROBE_DEFER); + + device_lock(&pdev->dev); + pxpcs =3D platform_get_drvdata(pdev); + if (!pxpcs || !pxpcs->bus) { + device_unlock(&pdev->dev); + put_device(&pdev->dev); + return ERR_PTR(-EPROBE_DEFER); + } + + xpcs =3D xpcs_create_mdiodev(pxpcs->bus, (int)port); + device_unlock(&pdev->dev); + if (IS_ERR(xpcs)) { + put_device(&pdev->dev); + return xpcs; + } + + if (!device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_CONSUMER)) { + xpcs_destroy(xpcs); + put_device(&pdev->dev); + return ERR_PTR(-ENOMEM); + } + + put_device(&pdev->dev); + return xpcs; +} +EXPORT_SYMBOL_GPL(xpcs_rk_create); + +static int xpcs_rk_pm_runtime_suspend(struct device *dev) +{ + struct dw_xpcs_rk *pxpcs =3D dev_get_drvdata(dev); + + clk_disable_unprepare(pxpcs->csr_clk); + + return 0; +} + +static int xpcs_rk_pm_runtime_resume(struct device *dev) +{ + struct dw_xpcs_rk *pxpcs =3D dev_get_drvdata(dev); + + return clk_prepare_enable(pxpcs->csr_clk); +} + +static DEFINE_RUNTIME_DEV_PM_OPS(xpcs_rk_pm_ops, + xpcs_rk_pm_runtime_suspend, + xpcs_rk_pm_runtime_resume, + NULL); + +static struct platform_driver xpcs_rk_driver =3D { + .probe =3D xpcs_rk_probe, + .driver =3D { + .name =3D "rk_xpcs-dwxpcs", + .pm =3D pm_ptr(&xpcs_rk_pm_ops), + .of_match_table =3D xpcs_rk_of_ids, + }, +}; +module_platform_driver(xpcs_rk_driver); + +MODULE_DESCRIPTION("Rockchip XPCS platform device driver"); +MODULE_AUTHOR("Coia Prant "); +MODULE_LICENSE("GPL"); diff --git a/include/linux/pcs/pcs-xpcs-rk.h b/include/linux/pcs/pcs-xpcs-r= k.h new file mode 100644 index 0000000000000..28723d5bd75cc --- /dev/null +++ b/include/linux/pcs/pcs-xpcs-rk.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LINUX_PCS_XPCS_ROCKCHIP_H +#define __LINUX_PCS_XPCS_ROCKCHIP_H + +#include +#include +#include + +struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *np); + +#endif /* __LINUX_PCS_XPCS_ROCKCHIP_H */ --=20 2.47.3 From nobody Fri Sep 25 23:09:01 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 9FFC250AC19 for ; Mon, 7 Sep 2026 15:39:38 +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=1788795580; cv=none; b=Xfcx23PvKG0oD0c/6HH0aqUI8kM3XPHb7DyNUVRO3UslHYm58Bg1kZ55v9qwV4jS1bqPQ/2DkdAX6UihYXdpT4OpSeGz9LvUkm6q6z7CZtoCFJthN+hv6qH+YVu3m3PowYFy5b7RtSmSeqHywkTCaUge9naVba7elCas6FjFBPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795580; c=relaxed/simple; bh=VOAurFL7jA8voxkXH97NS6Gp7xhM/ME//lhZoGkAL8o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SdwmoJdszNevr5P+SXA2gmm061MOAP1iynb8FrmIzzlBURpLs7CzrBi9M9OacPayTyU/lRD9k+K4VzrgEZp197hRek2v+jEJtQ7JeicPP1JEhxfucY9OY9alf29BvNJQzrD8pQYBJHqSxtVLvAFKrioDkMI4ELBrQIQ6jhOzCck= 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=W2R/kACh; 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="W2R/kACh" Received: by mail-pj2-f7.google.com with SMTP id 98e67ed59e1d1-398e03cc38aso1351361a91.0 for ; Mon, 07 Sep 2026 08:39:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795578; x=1789400378; 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=+mhyAyWoHthze/cOBp9JB11+QGvD+yrpHzboGCXlpZk=; b=W2R/kAChiZ5MA/cgOQP7cSsxKixR9AbXiNvolJk8ar4xVfaX2KChI9o0K+pvRZxP8J bd+dR33EEWsC/P5UBOggjgemNy7C+3w+sdjWI7ycJUSij4XnfjqU3IDuxwGPI+iC7pQB dtzTju5bkTqnXIdxuLD6Ac8C/P//I4gmSmY6yGjbeoo5kZ+kVhg35mY+VsRKbGYoveJ9 Z+h30CaE+uPleq7VWgXqh0RJH293mk4XVakdspmvHuB6O+1G68WQceGTlM1O9DtmNxA7 oFQ8oEQzTFRcbNp2nwlNb1ZS9dIsFaVYZURm4XNg/GLWLzvoWvGI/y7m+bmsh5EeIsbS 5+mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795578; x=1789400378; 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=+mhyAyWoHthze/cOBp9JB11+QGvD+yrpHzboGCXlpZk=; b=R1AwIUNcMv23fWGGXM0NakE0FjYrr0qDtL3VEM+5F/G+88WIr49HAlGcFAfsDabqVO vKz3FjUL9+EWdl7S8iT/FZ+Kf1Krtqtq4DZoZ4JD/YB55pSIJk/08CVvLEVccZOerddX ByXhk/8uGGLkd7RM0zSohXhr8MRn4FBy0LlQ43p8kgo3PGmyW/zpbW6nDQ89YhJR+ywg fTBuV+8cEjqmulfBEayYQEWBXquNWbO0LyNj6YrJSLLDc6ZIRBepEZ2NAePDnRKi840r 6+xcrKNyGI2wBp4OGGdOvxcL9IAE6GaLU84R19SA7dcCm5N+BE34vrlrK42zVfSmaOup 2r4w== X-Forwarded-Encrypted: i=1; AKwUvBzCgLhLqH2wfVup8iXwO+ALJQyraqeL8g267H3c6XiQJwDA7RhPzmlYrz19VAyLbFxYCmv9KpWVhVtXA9I=@vger.kernel.org X-Gm-Message-State: AFuF++n01qnP1LNT41K1GrwUMET6RhfAl30X9utU3B2S/cSyO5R0U3CV ACv+1BChDjLAsSHAiqRR//gWysuGWkpS+oBoIa4DthnjM2AY4NSrPBOh X-Gm-Gg: AYBFou2S1fH9mbS071X5cWvLwYlCbUR64es8U0bAIQz/3mpkE3e2nq2eM4eeCAhzZn8 FYhhOQEK+3pPmxSB46zHmUgM0tAUX0T3ZiwBhn2hAW7vaZIQTxWL58I3O66fVZjIX9nOE0hi3Fk LU3e9eux8+OQjv964nMsE/Fu14O3qo5nHI13SO+2Kjt4Ql+fHmjVABW51rvbtjRzBpcyb4akn+O /mhpXgY5srp6bT/YqHjNsd06UuqKE6iqxFWsJgcT1KNYnQ+kHLG8hHx6BYdhmrrOkNJLxGlq2Mg 0U2w/WabsSEaQmvkEYzZc1yPE/sWSqvHhBGHQJ1O0kOzJDWIf4xvtQNru5IT7F88R1xgUdk8RIw LwGIQ0gFCO//5ougXtRqzuu6QlrWzGeWGaxCbPVD7ohHq1GCtVZiU1bxiDm+pglausZHw52Thtt uXfgcXq8Kx8Rj4swOWPqHFgESl0LxSP3/txyD3bBo1W2wKgJNrCS2aET1jwWE= X-Received: by 2002:a17:90b:4c06:b0:396:b98b:a3c2 with SMTP id 98e67ed59e1d1-39b26116d9fmr30692166a91.8.1788795577748; Mon, 07 Sep 2026 08:39:37 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.39.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:39:37 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 08/10] net: stmmac: dwmac-rk: add SGMII support for RK3568 Date: Mon, 7 Sep 2026 23:37:11 +0800 Message-ID: <20260907153713.2572547-10-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-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 supports_sgmii flag to indicate SGMII capability. 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. While at it, fix the clock enable ordering in rk_gmac_powerup(): gmac_clk_enable() is now called before any register access, including the SGMII mode setup path. Previously SGMII mode would bypass the clock enable via a goto, which could cause synchronous external abort when accessing MAC registers with the clock domain disabled. Also clean up the error handling in rk_gmac_powerup() by using a unified 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. Without this, the stmmac core would attempt to change the clock rate on speed changes, causing TX to work but RX to fail. 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 | 121 +++++++++++++++--- 2 files changed, 104 insertions(+), 18 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..e47ca1bec5b8b 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) @@ -851,18 +857,32 @@ 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_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, + .supports_sgmii =3D true, =20 .regs_valid =3D true, .regs =3D { @@ -1208,6 +1228,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 +1387,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 +1419,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 +1441,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 +1464,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 +1473,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 +1509,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 +1530,10 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_= priv) bsp_priv->ops->integrated_phy_powerup(bsp_priv); =20 return 0; + +clk_disable: + gmac_clk_enable(bsp_priv, false); + return ret; } =20 static void rk_gmac_powerdown(struct rk_priv_data *gmac) @@ -1486,6 +1557,9 @@ static void rk_get_interfaces(struct stmmac_priv *pri= v, void *bsp_priv, =20 if (rk->supports_rmii) __set_bit(PHY_INTERFACE_MODE_RMII, interfaces); + + if (rk->supports_sgmii) + __set_bit(PHY_INTERFACE_MODE_SGMII, interfaces); } =20 static int rk_set_clk_tx_rate(void *bsp_priv_, struct clk *clk_tx_i, @@ -1602,6 +1676,17 @@ static int rk_gmac_probe(struct platform_device *pde= v) plat_dat->suspend =3D rk_gmac_suspend; plat_dat->resume =3D rk_gmac_resume; =20 + if (plat_dat->phy_interface =3D=3D PHY_INTERFACE_MODE_SGMII) { + /* SGMII clock always runs at 125 MHz */ + plat_dat->set_clk_tx_rate =3D NULL; + + /* SGMII requires a PCS */ + plat_dat->default_an_inband =3D true; + plat_dat->pcs_init =3D rk_pcs_init; + plat_dat->pcs_exit =3D rk_pcs_exit; + plat_dat->select_pcs =3D rk_select_pcs; + } + plat_dat->bsp_priv =3D rk_gmac_setup(pdev, plat_dat, data); if (IS_ERR(plat_dat->bsp_priv)) return PTR_ERR(plat_dat->bsp_priv); --=20 2.47.3 From nobody Fri Sep 25 23:09:01 2026 Received: from mail-pj2-f11.google.com (mail-pj2-f11.google.com [74.125.227.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 951DF4F474B for ; Mon, 7 Sep 2026 15:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795587; cv=none; b=cCns7mNoAi6+iRIgXLjNCJpxPhXXHdwIziykx6BGxp9l/qcANBc2EKaX3KFh5p1ZRU2E9FWPhKnRSBCsM08CO/PuOp1YUFyF1Ru6W7kWdI5MOpky12KmCbfcOHZjBrv1uxA/vgQ2RKAIajWx09ayRlS3Mn3+AVLU1hA3fJlK5Fk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795587; c=relaxed/simple; bh=Pbqc17ixdKV04mbPvez2/xb4avNWEBnmgCndr6ae4z0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZA+Dkps1dMEvPuwMpLx3QHe4Gdtwty3hY5LJZw925C5solnKKfPYo/kQWXHc5m1Fa892Hil/BEuXUCp6Ox/oEOXFrXpqPEKW+z6/OVc6JHWgE0+Csxsb1L3pmtJ4r3eBeTskHR0cgpFaJvaVGbPc1pRpfwvZH8IG3Div9NMnS+E= 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=LNTRezsL; arc=none smtp.client-ip=74.125.227.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="LNTRezsL" Received: by mail-pj2-f11.google.com with SMTP id 98e67ed59e1d1-39569e136f9so2170393a91.0 for ; Mon, 07 Sep 2026 08:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795585; x=1789400385; 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=2srrqsfvZcRiNitfhUr7DhaIgxeXboMwTknQApvQL7A=; b=LNTRezsLA4/pyrQprJySUmdEqEmNmKHmTulOd58FBcLRM9EDSh+45rbgOSgtiOk7I2 Qfr8xBUt6co7TYauKOZhRvguRKaGM1AW74TV5AKZFeAKGrrcSouIRWZTizVBsPhpdoPu jQaLqskHXQAwWlAGsrhmSKw43pnvZOBdHpKDfLMoc+JTEXCGEvqFs7owgOrUKpmqO3BH 19THbpnrTvT4zzT8gB/LiURsqpjm2EckuDlOCbURYygARDclA+Lxfyp3AsVjTInba/WN chSl/8HXSw+CeNX/BlAOLbS40CuvSo2Kt/0EWB/DENYPJnvqOSp5IW3zKuIJcjl0qaeW E2Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795585; x=1789400385; 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=2srrqsfvZcRiNitfhUr7DhaIgxeXboMwTknQApvQL7A=; b=Ux2SvoGMh/DAX9102APCYbj37Jk96LVc+1ulFE7P4vf97Yv4huHL/Q/ufvopO+lIfI HCVZdjVtlRyE93B2YvGefk+YXPss4TzN4w2U+owBfMTDQKfNfBylCfUSe9iOWioGQAnd oknYvPE+jYlABHX3zWtIGnZJMG2i4+XZpQoWQya+FcIHA4Oczy2DGA4oXIWjlhuZZ/L1 xHRx70g/V3WfV1KpwVdczLxpvkPZVlj6Fqm1OagK8Rz21P2BHaz9KleDNOG0um8rOoa6 mGu1/1xLDzBQ8DkRcYOaM4it5vNWor6mrwB6QB36w9/mVKCA41JW7ADLpMxfouI6EgEf tDAw== X-Forwarded-Encrypted: i=1; AKwUvBz/MOYbr4nZwqPXWSfXP55YIQvePFA9v+vifbZx7Zy1s7ea9pkHDaPyd5A0rAxBBSLhvvBCp1prFJqVnXg=@vger.kernel.org X-Gm-Message-State: AFuF++lR73SpQwK5riwSehUn8vswY1AiDEBZzUk4iBUruBeZXKFbfY5S VjafGkbV0+UwoLlIHxkN5tePh/4I0L19q7jU+3OjRgB4yX+Zo+n/l1aawpdWguK3 X-Gm-Gg: AYBFou01ie2FHcFzeCO7ZttDePalyq1lEwJq1v3qHh9KXC8WKSKh98wFLDbCOrqTpgS 6uWeP1F28iF8I/6sCxgbYD2XqgU+X0O1KM2LzG7VEJrqOg24ZdzO5xM4BgoVHNPkVMLHr4pMfMX b/oBM4sTO1VH3SP1yLXl+1D1ZHR0LLL/u6SQVcwCWtely6b6PJY8kBV/KcCytPezwyNo0LNrR0u eygTb/YzWrjX2X/09xu7DfaAofeBGjvHm1NtdqfI2B2FW9ixMWSG3ehOP14yIChXx9dDpIbFgCJ h5eK6RaKacLb1kqaGGME4mUFmppyAcnF5KL3jK568OyPFTcV2yTuJ8cq9t1gUePQX39sZIkraKE CJWJY2CHyhHsAtWS32BZijm2bdLZt0mZTh8uzJSU3miZzP8x+7CroCB71hhvGIrBKRhzthSPspF iglELtztTP7XuAgspTZ3bOko9uw7X7M+IOlnZmuAbMP/yY0BG4x20tIeUuY2Qx X-Received: by 2002:a17:90b:3c42:b0:38e:fea2:df53 with SMTP id 98e67ed59e1d1-39b260d2977mr35605265a91.4.1788795584940; Mon, 07 Sep 2026 08:39:44 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:39:44 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 09/10] arm64: dts: rockchip: rk3568-photonicat: enable SGMII LAN port Date: Mon, 7 Sep 2026 23:37:12 +0800 Message-ID: <20260907153713.2572547-11-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-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. Enable combphy2 with rockchip,sgmii-mac-sel =3D <0> to route the SGMII interface to GMAC0. Enable the xpcs node and its port 0 sub-node, referencing combphy2 as the SerDes PHY. Add the mdio0 node with the YT8521SC PHY at address 3, including its reset GPIO and LED configuration. Also add LED configuration for the existing RGMII PHY on mdio1 for consistency. Signed-off-by: Coia Prant --- .../boot/dts/rockchip/rk3568-photonicat.dts | 74 ++++++++++++++++++- 1 file changed, 72 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3568-photonicat.dts b/arch/arm6= 4/boot/dts/rockchip/rk3568-photonicat.dts index 58c1052ba8ef3..25caa44198843 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" @@ -242,6 +243,7 @@ &combphy1 { =20 &combphy2 { status =3D "okay"; + rockchip,sgmii-mac-sel =3D <0>; }; =20 &cpu0 { @@ -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 <&xpcs_gmac0_clk>; + pcs-handle =3D <&xpcs_mii0>; + managed =3D "in-band-status"; + 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 { + status =3D "okay"; + phys =3D <&combphy2 PHY_TYPE_SGMII>; + phy-names =3D "serdes"; +}; + +&xpcs_mii0 { + status =3D "okay"; +}; --=20 2.47.3 From nobody Fri Sep 25 23:09:01 2026 Received: from mail-pj2-f11.google.com (mail-pj2-f11.google.com [74.125.227.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFC2450AC14 for ; Mon, 7 Sep 2026 15:39:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.227.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795594; cv=none; b=CSbA4cT8jFdu3CGG3VmNQevrt6nPC2VcImJRHsHvUPG+GuEZA35lhtJmxNgb76xS0bSKIDJvKNIsSQjep2XMhDebZrjNPUgnjqEPMKgB4Ud5sZchnP1u+DyFc0xQAHPSaiEsYPKf5Mt3HVV2sEl9nYby3rwTbEfSWlY1CYnQVzE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788795594; c=relaxed/simple; bh=2iJPpKOoGy+/l4LMviPQoRKnjhDXm9qqPLLD9Cdfo1Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bhKtUlLhPOZzwkU+Vyrsnv+8EH5itBmacLgVgDbWf+0hOQXZA08ICVkPkRI3PJ2zCRuUGItVfhbklTkxI/boMWN7b/G05aQsA8YDES0Ng56zL22XP9aQnjkz46KFq0AEv3Bz5FwF8cFrQ+wqqib7yOielexYIP5LmlEuwr2ofP8= 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=jpG5vmr8; arc=none smtp.client-ip=74.125.227.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jpG5vmr8" Received: by mail-pj2-f11.google.com with SMTP id 98e67ed59e1d1-398a0a87595so3223591a91.1 for ; Mon, 07 Sep 2026 08:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788795592; x=1789400392; 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=cBvlH6prRmF9is7rqvJqNTGgh3P2sJVPtfOXauJIgQo=; b=jpG5vmr8RyoYuxxhINnbMRJJHBsO63kyrYnOzsysJq5pf+picb46U+vDQnLeiFI5Q0 z8cKzEtL07FuOToyRWjTluUjVnsbM85ailrYeRyXvaYY5goo6iQdJ9EVgSrkMf9imUCv /amgMKsl7StJiBFFYAemNAABFUYby+6BIlkOZ5QSyJ8jIlXnvteO2WiRW2T+YTYIfM2l nJy0pDEeZmIfiCC01SZlKa1e4yPP0alUN3NHcq/d+07g3E71Z8bTjqqqvpeNKgqkXmpx 7lZZXKMVfilt2gaxaM4BwUd4eTyurWJyS3oy0wUFWO0d+LAflUSS4rniA1rVLsVi3XnU Jg8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788795592; x=1789400392; 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=cBvlH6prRmF9is7rqvJqNTGgh3P2sJVPtfOXauJIgQo=; b=pEAYh0IvbdS2qtfVhy1dUuTkrI3Vj5VN1vUl84oPZ9z1oBc/tMW8ZCst3pszkq+IMp WsogO6b1WpVW+FClXHH70iXH2OWIAY7wqqJ5d/nOQqx90Yo9JnPVqPh8hX1LyPn6qpgm hQejm8zB/NpHBcVMxncRe5pPrQUGQocJi9yduRMzrj+tGRJYRe2b/ncFhrdj7FLNdM1Y V8OS5w38HfEEsGyb9DSoUnjyYRYSxh+3FN/WoJWSxUhLtJO+AInL4B4+oEvdd94T8X3z vTuTYUAxPpRLXykjFTOuvqFWJaLzmPLFrflTE3rRQ6BAKLUKk/Jjf8hneBFaOv7F8GmI 8Fbg== X-Forwarded-Encrypted: i=1; AKwUvBw6n9UVp2YNmrKODstcQo02fzJXqFbmGKVqdpev4HgIaxYUoUAS7Tjw8VVU+t/eSU89Cj9pHB5UJlCwKos=@vger.kernel.org X-Gm-Message-State: AFuF++mg8I9cqTqpncDaATnaL/jx3+757AB0lPcoYHZOTrci7muw/ttV gtU8N8m24XQQzALzJ+0sgyltRKXkWwj9pl07fUJYkGb8tnzIktaAaM/m X-Gm-Gg: AYBFou0qIPlSzXmIHEDPOBguYWpwzS2xzPPu4SXjOV917jmWZBRDDkzGN5YLT7T9Jop z5+wf/wyge3UjjqH1EAWMGforMIPQnu6HxFieXBRkwOB/HCI1Y+xnq5GS9Wcw5TVNgCVK7z8OSX n3HUB+Od6UE1WjCLFWCkXo/a4fc3Wadh8mLj/IhwWHaF5CSwBJ3ujbX1pmiQGegw4e8BWHiqeKv /4jieqr4o7JV0VFqvaVrkjmtFYZYnUPv/lHNywC119qmZvbzCbot+6CI4iz+C9glaRaAPwOiwVD 3OM8cgMuZLleof3ST5vH/nIarGGE2zOXMAzdK96KdHbOX09GdW+Cfn0fyCtRjH+075xaAYfV6YG aH21swRHejMNTuAkLS7QSFc6QUWbi8alIGxeIPuroMOUnFI3aazI1GB6eTErVQD0weqxIY963Ka zJIPZ45mCOOyqx0gZP/K7cpWdscq1sSUxUqmW1v6n6+eWEsdvlkV62i0dOOU/+ X-Received: by 2002:a17:90a:1c96:b0:39b:66ee:a14 with SMTP id 98e67ed59e1d1-39b66ee3442mr7209213a91.25.1788795592309; Mon, 07 Sep 2026 08:39:52 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b260fdf9asm21690121a91.9.2026.09.07.08.39.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 08:39:51 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v4 10/10] MAINTAINERS: add entry for Rockchip XPCS driver Date: Mon, 7 Sep 2026 23:37:13 +0800 Message-ID: <20260907153713.2572547-12-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260907153713.2572547-2-coiaprant@gmail.com> References: <20260907153713.2572547-2-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 fc320b373656f..dda4d211b7db4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23738,6 +23738,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-dwxpcs.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