From nobody Sat Sep 26 12:26:50 2026 Received: from mail-pf1-f193.google.com (mail-pf1-f193.google.com [209.85.210.193]) (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 A12623D5640 for ; Tue, 1 Sep 2026 15:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274929; cv=none; b=lXAYif6PqXPeYjRJe+h6l67/MNP/6uOko3DyrKsmVnkUVfwZIhXJaQvK8GVA/66Fa7xj78DvZerUAZ4ozvRBOJ4uONElMYBLBxHV2WKuOiHcy6o4L8WuC0YOiLKf1Vkqut8sRt1qcsqmWA+HhuHaBDB0nesZF1XTXeYpwLp0wmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274929; c=relaxed/simple; bh=KahhwWv3LV1Z5vSb8cR57abZncM8NUVD9NyltpQLZvM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lIXNy0oR7xkfZT51cRxTFfM57VuvbbmhgzIy3D6QvEm3nK3Ey+rxZ8ISsFZq8McBnXI59Jb3Jt+kcGn8EDGGMjx8giRMTXgaKwWnPKSw73g6f6Ccp1+koHFoXW1Kv0/HNXrtvZlBwiQkORL2ze9lriCSWnsoC53OLcJhmX/0dso= 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=oAgSiCpx; arc=none smtp.client-ip=209.85.210.193 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="oAgSiCpx" Received: by mail-pf1-f193.google.com with SMTP id d2e1a72fcca58-853c947bfefso1159419b3a.0 for ; Tue, 01 Sep 2026 08:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788274927; x=1788879727; 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=fphDOyDXIc9z55x5SG5ifvoj7feVaMiS/8ezdRLSxrI=; b=oAgSiCpx0CenSw9DcYiQ7kW9LLLQ47ZllUvolsqiWQpmxpzMJQZ+QIltdSd/qJclJ4 N6w+PXZ+8T6oTGOZ7QzBQuTnl+RQvr+svj7ASleNGVQfXOkHUu4oi2cssN1pVjXCaAga FtNL7WLEsBdCHRSs+2VISe9VBsFbRZNVfcO0vNRdFoRN4FW4m4/5KrzEjRepfecOr3Ke Of/bhhpjNOjpdQRhm5ZGoIy4rmlIqaaL2ON2pzHJA8CXiohUZDSHsat/7TcXsS9EswI3 fbAh18BGP882VMCTXwfxliSSoRjFecEheXSVDVkHYckePyBQb0eqoAroJmv6K0+WdmCg Lumg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788274927; x=1788879727; 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=fphDOyDXIc9z55x5SG5ifvoj7feVaMiS/8ezdRLSxrI=; b=i6d2Dabrw1+1rYEW8Twnj2cJw6g3HikLuRLvQgFL4ZiHFofg2/ziKKAx1f/37QvO1l pFNBNB5P/X1ILtVbbIXKHgV20JAqUdnQlUcmSz+wTORPG6jGNZ35BRzG06VN4S47ooOy clg/nkQY4zRpggZ8nqpxDd6DEAAy8/kCcaai8iWqXU8RXK3dghXUB08KDJVra9W0so/y aZbKnv3B+5WDP2glyEsj4lyRf9HBAfFy23jg5SSReqjN/UGMD1h8OMBpxi4qkOnvBpKt Suex1QIwEUCPlI2PMBofq1wj/t6O44mqYnJY1z0GA/PcuqUwTjQ4Xbk65WIG9p0zFxib SDeg== X-Forwarded-Encrypted: i=1; AHgh+RrV6qgTE2zJ7UQIxy3hUZueh9Q/iDpI97gacAFByV9fg/33+JECErmxAsPDJdUgBK9D7GqWBI1PhEdTC90=@vger.kernel.org X-Gm-Message-State: AFuF++kMqUu3L44ifUPaJBJayzEmW8w+I+txa/xioCgdothn3lztjodl D44peXECSM5hqN93nRZzW+NrpbhYXAl9UOFCkagZ8NYCxHruyYj9YerE X-Gm-Gg: AR+sD11q2D1Wi50x6exi1XuX2oSw3Khbz0EBc3c6gB0TgZidrFL2K6eGDx6h8G+E9S2 Iw5Ha0m619cMwc7Q1UVasCz0VRXKDOeY2IXFYcIzYyyrty+GBlMf7qEEjYR7jNu2OCWSe9BJhzb 4eCmfp3pF1Mj0o2sJeNMK1NOi8CyD9EVzrggaJO0D+u7JI+dd/W3OYX1cP1M0vORXq+jwjWwaFb o/8cxNP06Vw9lYBuyYSq26F4yriIOXSb7iM49Tz5Dd3sFyodZnHBaKFcpodJWwXYPmBhsyqhCqD wD2RrF8hAV7Q9n8cW262iR5mzFq4yTMt7tdt+sOwjbch8Xsgs1cznA89JJNliu5M7CLU5oWMLiC E64a0l5xr0HP8Qzc4lCQz7l9yCnCLokFGs9SJm1nZ/GJk3N2U3zqmANnDKSTSZZ/tUX0aTxsaF/ IFXwM62U9QB7Ttrg1NJNsNQRsxgvhpq8hrdW2Q/A6ckcmJz7xL7VIm/qKj9ic= X-Received: by 2002:a05:6a00:1591:b0:857:73c3:4467 with SMTP id d2e1a72fcca58-85bcc75002dmr4811294b3a.22.1788274925534; Tue, 01 Sep 2026 08:02:05 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:02: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 v3 01/10] net: stmmac: move XPCS lifetime management to platform drivers Date: Tue, 1 Sep 2026 23:01:01 +0800 Message-ID: <20260901150111.141037-2-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The current XPCS creation logic in stmmac_pcs_setup() is problematic for several reasons. First, if a device tree specifies a "pcs-handle" but no select_pcs() callback is provided by the platform driver, the created XPCS is never used. The phylink framework requires select_pcs() to actually return the PCS to the core, so the pcs-handle property becomes effectively useless without the matching callback. This is confusing for developers who expect that specifying a pcs-handle in their device tree should be sufficient to enable the PCS. Second, and more critically, when 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. Signed-off-by: Coia Prant Reviewed-by: Maxime Chevallier --- .../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 Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f7.google.com (mail-pz2-f7.google.com [74.125.228.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDE7C415B66 for ; Tue, 1 Sep 2026 15:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274939; cv=none; b=DERcC5QgZnb+5oMZUeHFom6x/bGvDOBLB2OIxdFbZrOMhzdAXsU+JqmMoy8KJNDJT44FH6TCh//x/CRmc/sJN83uaw0HkNFwdpgX8UZjNwo3aWIgHgBdGr7wncM1+PkAChowNZEbJV7ngM0GVXaIqvZ315stqlO0T2thtHYD4us= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274939; c=relaxed/simple; bh=RQ8/bIf5S9U/FiX3uQoU1u6/FV6K7LLD2uqZys3J7EY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I/8PtmV2xp8utibltKMtbMfoLOFJkYJ6iO3dijSdwSrtRLkcnkv9V9+yJ0mEZvzJ9FERiW57PBhYqZVAdiwhCzxVA7XCm4E7WCaIJeZDTP77sVGYssHyAyOu0xl612lcDDaz45INx0qyuuJRrN2Q6x6gd4qhEMfV7ovaKkxznGc= 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=phKMX6yC; arc=none smtp.client-ip=74.125.228.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="phKMX6yC" Received: by mail-pz2-f7.google.com with SMTP id 41be03b00d2f7-cc1ddb3ba3eso3186180a12.1 for ; Tue, 01 Sep 2026 08:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788274937; x=1788879737; 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=phKMX6yCmRU+sn19V9Ec4B/16hFIG4NwfKpkhwTT656O+VqNUMHUeGgfsu1E2F4Ocd cBoBJx0YPgBwdJn4aK0CUhRwvWzI8u0YP2zY8sPa0l870pJOKFyHN695jhRE5RHxgtt8 nc52IWKZtV//CwtJP9tIvmMZTklH6ZV8moYpHZ1TuhCfPhuUaSBF7i7GeAa6wD3AqpLE xu6m2NW0kERdP6yHRufkm8eiqWfWVaf63QRvksR4GU8dTH9jn4p7SyCOFlieqrff4owr ElJMHS0dBm+b2AIzB0DNL8l6MuNPbS/2qWr+jzInGij0C8zly5uoz+z9dck3CDFuBA4Z /zfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788274937; x=1788879737; 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=nepM9VgiqltesEihs1o58Gss1Skn+GcO/1DpJx6lAB/MuCbB82Yat5ttp4cp/d4290 w13rJkuPCMi77bC49ILh+kj+eH93dhwM6kOmetqMOyfRzKq0KxQ3qaEMwN31bDFqmqv2 fR0AhmeMdaCZzzDM05dLF35HQSqqs49cFZk8HK/RYkXP56pK/uwYA9Wwn0B+eetdR1dA cOKggWzeLA3IUl3r90NkvCMofyyWrgmPPXHy4SCLQglHJDVc+OoABHkBkcw69yATwjBh GMkEuWyGAbsp6rdm+PiYKZbG9pN1WCQcx1qlYXeqO+H/2pEbC0gTl47nAVfGeugE/PKa mKaA== X-Forwarded-Encrypted: i=1; AHgh+RrD3DOKWIYSX9Ry7wSkTt9j652UtyOgToCUoewCw2DRQape9PBMULTprglqX36rbOaQel68em69S1qzYpU=@vger.kernel.org X-Gm-Message-State: AFuF++nWRT+HTD0m+ku9UdBudM/TD036XMxBfK5MF7NRZ4/w4kN46fGm 1rhFs9cWPeotbdiIDPG4vDsYMy57KAxYiVh31FZn8/g/3+MmGAtK3XKi X-Gm-Gg: AR+sD13LMw1mA7+sIPLH2aN9VeAhSqgGUiSesv4OKB5Py6EjAWHRygbMddD2x7mLpaJ yPkx/Tt9HEo7gJfxi5iKZenKAEwDEIyoQqlgEXzggss02Tm9b2uQ2MTpgn8GR2q4Pzu/hfzVg3o JNfDsNS0o4EZqwzv5WEvtmTnQVOKq4L6OiuJRntrBxZ4y56epe769uTDcFOPAT1OaBQKN0wWs9C +RPVGluVlSP7NAjHmB9uztpV2t7zkSC/ow4VMbWaT6qLP1QjtjR11a1kI4nL251HTH8M27I29uL bfjvHbYtU+sQ46mFByfo/dF7c6/kLG0Og7BkTjqLA+FXvnkqzGqkS+UuZ4Un7MNwqybmZ9pvq46 T5ThQZe7YChJvFznLHlPOeLe7gtaHNsiKTyvXm8aG8minK3Xpg0ofHbh65dtXGyM2RryGZV8u/C NuS3vugKgd2hIK1UrN5tU4G0QpcWAUteljsG7PUGOzoFOV2RhyTmCjKfn9nTU= X-Received: by 2002:a05:6a00:3397:b0:85b:cf16:597 with SMTP id d2e1a72fcca58-85bcf1605c8mr9714948b3a.19.1788274935860; Tue, 01 Sep 2026 08:02:15 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.02.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:02:14 -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 v3 02/10] dt-bindings: phy: rockchip: naneng-combphy: add rockchip,sgmii-mac-sel property Date: Tue, 1 Sep 2026 23:01:02 +0800 Message-ID: <20260901150111.141037-3-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On RK3568, the SGMII interface can be routed to either GMAC0 or GMAC1 via the pipe_sgmii_mac_sel bit in the pipe GRF registers. Add the optional "rockchip,sgmii-mac-sel" property to allow the device tree to select which GMAC controller is used for SGMII. The property takes a value of 0 (GMAC0) or 1 (GMAC1). The hardware reset value is 1 (GMAC1), but this can be overridden by setting the property to 0 for boards where SGMII is connected to GMAC0. This is necessary for boards such as the Ariaboard Photonicat, where the SGMII interface is connected to GMAC0 and needs to be explicitly configured. Signed-off-by: Coia Prant --- .../bindings/phy/phy-rockchip-naneng-combphy.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-comb= phy.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combph= y.yaml index 379b08bd9e97a..8e898bce9af73 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combphy.yaml +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-naneng-combphy.yaml @@ -80,6 +80,15 @@ properties: description: Some additional pipe settings are accessed through GRF regs. =20 + rockchip,sgmii-mac-sel: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1] + default: 1 + description: + Select gmac0 or gmac1 to be used as SGMII controller. + The hardware reset value is GMAC1 (1). Set this to 0 to route + SGMII to GMAC0. + "#phy-cells": const: 1 =20 @@ -105,6 +114,10 @@ allOf: maxItems: 1 reset-names: maxItems: 1 + rockchip,sgmii-mac-sel: true + else: + properties: + rockchip,sgmii-mac-sel: false - if: properties: compatible: --=20 2.47.3 From nobody Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f8.google.com (mail-pz2-f8.google.com [74.125.228.8]) (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 67BB24137B1 for ; Tue, 1 Sep 2026 15:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274950; cv=none; b=OSd8Gw3ydVS/zQV7kNaoTEJL9XURXLBx8uWqhds34dxDZeF5Cl98/0jsO7s46yoIVeMQoMGV7iSuMvqI8pkIhkezQTeL9MCVWqpdCIf0Q5osURiY8ORyTCE127+AyQB63aB//ovS1RhnX+CepVemcHs4JM5hOEFjPEeKMmi5qDE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274950; c=relaxed/simple; bh=puR3hcsKpnP6vV5Zl58WDpiYi4UfmWoBZ4wnS5ijiiI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YHoAH8ieI4EI4dFyb5254JMCs7nu0uM9ZJyBIGgaBCdbQR+JUTY7OdD1hlIYOoPKtKm0gATv/PIHKbmcrCtV1EReWBhB5dsAkePlhoAW4Kn5MHTu7M1eeGNuaVQ2EFe4XW7lU6GC8euz0IQ7NWf2aV0Lo/NHxSM8KBMrjhqMWBI= 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=dthL7zDV; arc=none smtp.client-ip=74.125.228.8 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="dthL7zDV" Received: by mail-pz2-f8.google.com with SMTP id 41be03b00d2f7-cc2085ecd44so334429a12.1 for ; Tue, 01 Sep 2026 08:02:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788274949; x=1788879749; 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=dthL7zDVS7pmd54Q7GgVU2wElDdRjieQ3QHvheiQ2d82CJYJpd59OCM83qDHj5QOiB RTrg2ESpMaXLWcr8UB9dBhSLWBD4FwyhrntiU550oZ1Kt19tZZYFNOrXKM/J4cWVbvQq zkMOWaTyYJPYb9Kr09MoGrsSSBFsNndQ2VoMSkaW9+jh9lJ+c9qn27RfsekWWaP1GOOl RIxOYGv+Gvy7sUyzoSU5wpeC89Ic1lL5XZVsmnjHIgBIkRpWmwk/PG1xP+j7hw7IH2Y/ OOEX28ElK26XZITXwB3xxcmJMeU/FD8ur4/HX63kLUPLaAlFCz8HYO+iq2QSXd9NMfW7 ukGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788274949; x=1788879749; 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=mWxOAkwp5T1iTm3hkytTFCSCAKubKxyqsT3BU7xL8p27nranSFqSnOo7sB3dD08BY0 7Ln+i9oSdO4b72UYz/2eJ5u8kQ7rgXqpnvsgpX6R0ND16D/eUqBndICPmi/9w3NaWdR7 6GHFO9tuGH6AyGmB23ueK5jpAY4jUigqICnikvHmY8ZSYSe8Jr3PScy9P1lGwz2pDKGr XM1bmyJ4q5i314GDAyjegVNV667mA9WEyzh+94F2V+l5o3lofaJtpTRB6wtg6pn1cn0j jXA1aGlJe4+n1HYB3OwXLmr1/39pvlABADguBqi3YsDzPC5zbqeen8UTbhqZ8TsWS0fT VzJQ== X-Forwarded-Encrypted: i=1; AHgh+RoNeyiVlxmBvP2pviNYBy/1uW97NHAYGHYaxiYMfBIbSAxWQLNjlz42Veiny5zOjK8JeiTFTzFyFAqWLMY=@vger.kernel.org X-Gm-Message-State: AFuF++nyy+M4JQs10QxAOj2YXNknMr7YVoFAQie+8y/i6AhgyCt65p/x q1/irZaksWmR4IRMwLaZyVSXx5V1s6e9MJAmAZmM516N6adrqKRkaNhB X-Gm-Gg: AR+sD10PFrRtpHs0kXou6QKlqPZusS/yWvVN1tyNQmoOPoz/071w1iuj2IBYrD1m+Wj +k9sGDEFoCPRWNgIN3G75wswj35JklsVbkZTdkWKLlaYcUbNBURT+1iXS48IAMONm1QsyzKXsjr rmBQ/8UGMGX74uni591y/+JHEZK70o3Fkfwkp/ScdjrXv1mQReaoaYyfr3dsA5ACuVyaoC27sHI WmYtD1CxZ9Ogdg+xTAYPiveC+TBZ6fiJ/kT1r/Bq+iEUw2jNjUJPYqz682T3d1hlTytD1zbKCWy JBUta7ov8v7+CavaGIydu4LjcgYwKcWp57Qs38guk2dn+FiTMKpgsV1+kwC8xuvYjIyKnqGD+r9 Gq4UDmLIaPciQmPsZkLqBrRzeJ7wGGq+OtrTBT+vnp1HRwQx9Tk7tQVVQxGvXDQgeJJ0eKjCPd0 hTZF9VtjCzAsh9EpU+ORjCTT+IGVZlVL16SSAcYLZYVKBTxjHb/Q1yBqSRU1k= X-Received: by 2002:a05:6a00:b46:b0:848:30c3:45dd with SMTP id d2e1a72fcca58-8562b499a35mr49867000b3a.11.1788274948514; Tue, 01 Sep 2026 08:02:28 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.02.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:02:27 -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 v3 03/10] phy: rockchip: naneng-combphy: add SGMII MAC selection for RK3568 Date: Tue, 1 Sep 2026 23:01:03 +0800 Message-ID: <20260901150111.141037-4-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On RK3568, the SGMII interface can be routed to either GMAC0 or GMAC1 via the GRF register pipe_sgmii_mac_sel. Add support for this selection by introducing the "rockchip,sgmii-mac-sel" DT property. 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 Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f11.google.com (mail-pz2-f11.google.com [74.125.228.11]) (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 CFBFE41DE02 for ; Tue, 1 Sep 2026 15:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274961; cv=none; b=aZ+zhcQibkZAkavgC+5rgtUfw60oRvmXY+uPEkQYJMTRvcGCF/SqJC0tfWslvEXStgKoFlLtRZ94MOwm1La0QvQ5PnHctNt6fv2EGdt38qjZLednXyFj/WlyAkm7lblMNzjy3OPAwT0GBc677pCe4nLWR/C8KPU61kdfZhlYnXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274961; c=relaxed/simple; bh=oHYaNtlraUhl8j1v5uSplHKtyNUdHyxN7c+7WMfLpnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PLdrRQrF+SvYIRmxgIoQ8ujnaU0Dc91h9D58u6ToNM1b10BeD2rGJ5TDrtU4izSnxQcqFxJmQICgHVptrb7NB6eb9IUh7ndhrZJt91T/n556npg/BdBTSrz9F2bWsvRHeDKevS7sz6xze28BALKTloHv0beWRO/3STpSzUpgtlY= 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=UE1tn0FK; arc=none smtp.client-ip=74.125.228.11 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="UE1tn0FK" Received: by mail-pz2-f11.google.com with SMTP id 41be03b00d2f7-cc1c2963c92so1656592a12.0 for ; Tue, 01 Sep 2026 08:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788274959; x=1788879759; 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=UE1tn0FKQJZ97opEKCUhNoaAK9irazidnyzUJpdl9uAjj8XEqbQYeotwYhcvsE5Wmc //czlsaiuO9FJPl8M/cj7rfDbhqaSa/Hh4OBRmYRcMUk97AdYE0B67fzD4FFdKBo2Y1n wvV+LfBcgJOrGQCDIYzNJbdv2CZbE8H4NduitZ1TxuKQJrWb0o7DhzGHLVD/5PxrMubx aqPImzDlsZ6gpT/zaNENi+PXa+jh5uGQyaaC3jHUwpzXAzyP6mcwO3QabguNv+vtHT3r v9SyL7DYRtuAhftOniVfUnQ09VR9imuR//M1yW3Hkj33rQSghUG5f3AqyHhmFEONSEqW 388Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788274959; x=1788879759; 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=s1X12MmAe9V9JCJwZ2op2sgBgLfUsbrhZfDw7Y/TRovgwkZsNY52fHfe21KJVH4v7y QTyG1xzwIdt3n73/yEzk90xE6sKeNgfGxrj1rmlLGNJ7S8+6eq7pTdzyIjN91vbl9E1m w3M6cjpbOCA9Sf/HI3Wym1pLByTws31vDd7a4GMS46YOWxHuM0BIOMUI9udoTqgv11TM ZbHBlUXfPCwbpi8VHjDMEuVnzwKgIfJacnF2HgK6fp18RG6KMUon9fsNAibRdiOXqHj/ /MgmJNC4yb16u+gq+XkHiMUb41a5/V6TQPev0UkjVVH8aPURkVJqB98MuC5nf8/rHF5H 5Aiw== X-Forwarded-Encrypted: i=1; AHgh+RptqAEVISg0KKOiBXR6qYT6jXuwqMkZRCvBccKHXEINO9lyMoa6rX5mr/M/D08yvnzyQeaT9Er/tLExoNs=@vger.kernel.org X-Gm-Message-State: AFuF++mrQw9Dx7OF41To3SDtEoaAhdwkjYc2BdUDiMG/ZCuPv0i9XPAV GLndOPTHhZtnTWFDL/pkrWbTpr28sooEzk7UfJwzXIjzi7/o4WaxOBeV X-Gm-Gg: AR+sD121mj3/mR9Agh5glUKjXQErqbwPKmfu2A8fcquzoJ6xvkFOKpn+QbSkgHJRVDN gI2QTSnbTGc7R+xdgfQonYXvWvfAqH3h7p0vLWDSY0cKiss40g4KS1iY3j4xslSLQFemsHjkrRc yxqp4k+uocaSmW/suo9MH9e5OAOHOxPohNKsoYItwkEweeJ58/Uf6/I0qjFqSwc7OaExNerFkmv LofKbK4J72ZTIwiSfwu+lLgmOtpIkTmxSyvy4MViwH2fwaMDG9BvziF+xTPKu8iuFzJQSmynncn QEfIqr0YuID0dzkNajVZrMQ5jSOpwr9oWYDFwi6ACZzIXDw21JSlL9oXyXCG0P3y7Nr1oSALgmV NDWa/9R4k8EYc0GaS17R9KhpzLt/rrvbahdvWkzQm0Whx3nuDLt7Yxnpmth4mPr1wGGbbTDNJx3 ha6SHM/wC1/f0Gq+8bogJMrpAYyYzfBEzIUZdo6Pp6Ow6mqMxB0tKp7/MNLLYD X-Received: by 2002:a05:6a00:3ccd:b0:847:770f:da4c with SMTP id d2e1a72fcca58-8562bf5a609mr51668111b3a.16.1788274959110; Tue, 01 Sep 2026 08:02:39 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:02: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 v3 04/10] dt-bindings: net: pcs: add rockchip,rk3568-xpcs support Date: Tue, 1 Sep 2026 23:01:04 +0800 Message-ID: <20260901150111.141037-5-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add device tree binding documentation for the Synopsys DesignWare XPCS integrated on the Rockchip RK3568 SoC. The XPCS is accessed over the APB3 bus and internally connected to a Naneng Combo SerDes PHY. It supports 1000BASE-X, SGMII, and QSGMII modes, with four MII ports. Signed-off-by: Coia Prant --- .../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 Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f9.google.com (mail-pz2-f9.google.com [74.125.228.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98C2A3E0220 for ; Tue, 1 Sep 2026 15:02:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274975; cv=none; b=uS/g0VT1ZpM4H73RJejbR0++gdjzSQjJ3YeFB5yv1hb91f113Rlrx9zW+hiqq0NHKH35epIpnFhOJd3jOwxfrvC6tKJ9hRNcZ4VBnwwFk0RfwK4wAthbV3B0Hxtd4uInFI45YjDcE/hOYy18km9tay5mfOgo+PEJ4Osf+GEZKpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274975; c=relaxed/simple; bh=A5WWFF/meLRT9K96dBTf7EzhnS37KtSW6R5N30B3Ssw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SK6BVQKXe9TCOwSsrylYHIg0/dZyOEinNyuSGsUUd8ZYRHNWGxtTDiadDPAcLJlDvDRD9yCT4VGn5dimC1MTPTl9OBK78aBsg9B0Ah0VjCJ9Y9oeWoPtDLxe9ykN8gTQiln4ZFQ5kjmzyqMA+Lnf+uzxMNtLUc06C/wksGN7CFI= 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=RYn+MPpa; arc=none smtp.client-ip=74.125.228.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RYn+MPpa" Received: by mail-pz2-f9.google.com with SMTP id 41be03b00d2f7-cc188c38a4cso2651194a12.0 for ; Tue, 01 Sep 2026 08:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788274973; x=1788879773; 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=RYn+MPpaRnU+UI8/JU4pkHEQGaS/T0CaF+kGuANe0jv8pi6MeaoiTfXR1c+eai2Vwt V4fT5/HkYVUeWAYdubgRNxvHcn7Oj2qH0+OZPdp9k4J8FGxhNHTtXGAADHna7GSCkavd NafG3564BX1VIw5VelUjMctuAHFDZMsGkleDWm4G5yb8X3lHHg1bMM+YHx1pinqjANoU 9y2e7BErJWLRQQ1J9Svzef6oaMD/troO58sRhMm9TcGFa57CpMu+lUUxCCHRkdr2hBTZ AuYfVErHto1dZ3uTGEQ4isylKPLw7N8DTT4+QpFSIFVMGkeOpfTTzyt6k0B6ryjCnb24 DRxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788274973; x=1788879773; 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=bx2Bv9vxwzu2YRvBR3VW0vJ1GMPgltlNTAVir6pKLWr9s1jWMEYeSmpfLTmU2nwgSS Q4+Eo41+lxASEZB/XkH5nj85UcsbMRAjFSdV1Eg4lgzgzWvrY2xZTxoLLPyy0QAoVGFS oUL+h4YjUV82V3wu9TWJuUIq3Fyh8fIHd9vF+M7Cki4MPJ+OLZ0znxThqp3u8Y9P7XCf 7Syh+d/TAqRdMII+kfbclS85klFOpopSepCDL7PzPLfJi7Z9nKaLbRclPkpAN835fBA7 6hjLhd9LmNCqn6qOa2p1KHBato6fBTCwpAEuaceO5dBlLeGj+OrtWHsb4aDxg0cLknRy darQ== X-Forwarded-Encrypted: i=1; AHgh+RoLJB4sAAaMt4OfbAQhbakAX1ayJZX3sN0TO4GvO0oc3FodFtsrcYI6HINi26ZhKpbxyPDFmycDV6sK8r0=@vger.kernel.org X-Gm-Message-State: AFuF++m576v8h2jOILUW/0CmZlVRyZ+PBikO9mcqErsNvGH11Y0So/Vo wCjaDTdE7mUm3Yf8rQ++ycdHk7OcO8B7XVPiMFR2emb5xrLhMxZANr5T X-Gm-Gg: AR+sD12Qwj2za0tv+JqFfifu/eEkqa7w3BX2IJQcAazEiCz3redV0C7PYHSGRaUwIbE icaj33osXOpV7AaErxQ9LmUuC2Z/Ey8+ENYCB0qMfGNjftJMxjwbKY6v72gcbV0D68Lysz/yCaS oMdaMxVRzqqpDFArs1MkR6X2UmBHOD3XEVSYz2Yn8C+06Nin5b0Q9DGC5MqIFazoLEz9hl2ym+k nQMDAWZPkh/kN8oyyEWJRh43q6bR2EyHhOxZXqGjdxtJ+RjALICcqAOTc3ogygnPOcjtOpUYCgS dgT7KutE6pQueV7ftDwRqBNRLizDFEf53dhDPS44YNwX1mjewcNC+K8d+FvqGAUUUCPXmgBKrhZ ckvHj5piKIzaKg1Xy6ktvGgujzhI18LdIHtVz6F1gb94T/p/YB7sL2xzWfS39U6LTNcFnXHU6tX gqexemspD+RXuwbd+/qaoPEmkvXGFkvd8tGDqfOG4nhKgF+msD2jy1bblKeko= X-Received: by 2002:a05:6a00:4187:b0:851:b03a:fcb with SMTP id d2e1a72fcca58-85629543442mr61618818b3a.14.1788274968953; Tue, 01 Sep 2026 08:02:48 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.02.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:02:47 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v3 05/10] arm64: dts: rockchip: rk3568: add XPCS and fixed-clock nodes Date: Tue, 1 Sep 2026 23:01:05 +0800 Message-ID: <20260901150111.141037-6-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RK3568 SoC integrates a Synopsys DesignWare XPCS that provides the Physical Coding Sublayer for 1000BASE-X, SGMII, and QSGMII interfaces via its four MII ports. Add the XPCS device node and its pcs-mii sub-nodes to the SoC device tree. The XPCS device is accessed via the APB3 bus at 0xfda00000 and requires the CSR clock (PCLK_XPCS) for register access and the EEE clock (CLK_XPCS_EEE) for Energy Efficient Ethernet operation. The PD_PIPE power domain must be enabled before any register access. Also add two fixed-clock nodes (xpcs_gmac0_clk and xpcs_gmac1_clk) providing the 125 MHz reference clock for the GMACs when operating with XPCS. These clocks are used as the assigned-clock-parents for the respective GMAC nodes in board-level device trees. The XPCS node and its pcs-mii sub-nodes are disabled by default and must be enabled at the board level when 1000BASE-X/SGMII/QSGMII is in use. The fixed-clock nodes are always present and do not have a status property, as they are static clock sources. The XPCS node also requires a reference to the appropriate Naneng Combo PHY via the phys property at the board level. Signed-off-by: Coia Prant --- arch/arm64/boot/dts/rockchip/rk3568.dtsi | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3568.dtsi b/arch/arm64/boot/dts= /rockchip/rk3568.dtsi index 3bc653f027f1f..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 Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f10.google.com (mail-pz2-f10.google.com [74.125.228.10]) (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 8CAF7429CE8 for ; Tue, 1 Sep 2026 15:03:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274983; cv=none; b=Ttv8rzhcgLvO958p8sX7tsePwV1gDZWRsYlHCFm7+FMvXpf4GHKasTGlm+UkSAacDfv5+dOB6hBHMjMcsKofDYG2WbNobasJx0/wS82xyconaNyr43n5FYIuaCO5kTN+IQcrsuXgn53/hlYuMAB7NgQulWK5AT6IZqOYHXxjYiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274983; c=relaxed/simple; bh=iCQafZpFqsdcijM7wQ/VBsqWEiby6qk8Gp6Xz65rtD8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZHDz3vQPjowcNb15pfhV+mXBxYIdH4xDeZHI1iN98tD9e4uwpPVLTT7qK42q6F5KHvR/opxKOJMvAqrPJeCuyRuPNtM2cHeDT3Fg7REyD7euHHl5GyWlEn4Zj/sngcLGqXeIUW5SxGlelZHw6rnmzfmqay7Q93Cf/dXDUZF+FiE= 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=rkktWk4S; arc=none smtp.client-ip=74.125.228.10 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="rkktWk4S" Received: by mail-pz2-f10.google.com with SMTP id 41be03b00d2f7-cc1c753b1bbso1220991a12.1 for ; Tue, 01 Sep 2026 08:03:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788274980; x=1788879780; 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=rkktWk4SfofP6WnpAL5ws1bWPxRUKhfc1yDrgKLcjuibn4VjzSdmuTsdpUVs5Vkrl9 aFZohe9LfrVWYyNiW7yWYapLl9W/3KhGA6I5ubzudlBMgUeyTRhhcB+jjH/6b5nTTgFz wmUcz2W7UJQRpnoGI2xAGfnJ0pmuHlkrGcP11+Axk4ofyvpB5fTJGcnT+XaqgLooCl3q Qr81TNjne90RGvlUN5NeP3RmbgKi6DhQHeRwwCfS4E8rgRDBX6i6VsYsxg8ya8JAReVU A7TsaK4tjgk66McWdiM1i7p/JPHrOo4THDXLt2rHiuIQqDwUhOXN/Y+usZAxx38ZzZvQ gihg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788274980; x=1788879780; 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=lp/ttOHCMiXSq0Opj86pbluZQHylASKz2nA/ug13PgYIC2t4rE6RYLz91hjfFLxbp2 WIaT4vKLaPp7XuTSXVaTh3H6c+nHRHVgtAIUZnfFkGM+h277wezeZEHkVbxrEAtUK5F1 4HayaKB0MH8ciBsNFvOG35+6iBw3yzVSJIYR+vQD0BHUXbpGFrj2PiNC89yxmubJOGN9 6ZqdputumWN2IHLM8gq0ju6uI35UGAFuBxlx2JSkqehSYtpKvXXPlnPaGKDSSwGnt0yb pmTyDRFNIptx5E+jrf+owAgTCseXfERTyYEF5x3oA0ED7mOtjpA+5OnLpO4Ez9Z+BtxZ NMDg== X-Forwarded-Encrypted: i=1; AHgh+RpCukNjnKVWGQP6ZamBh18pZIMF3hP5c2RZrzJdSHno2q7RVO/09US+nc1QCjr4rYjq+fITZg21ACgEP2A=@vger.kernel.org X-Gm-Message-State: AFuF++nckCiXyNiWQvBssc9R/Yc9OX3JAM/8kIIzLLCdBambSPVOX0YB c4h1mKbBDhpgs06BC2xjDt4lpB0oFH/ZN+6I99a9t5POp9v/nmI3qMM6 X-Gm-Gg: AR+sD12ONjDWB4+TG81YPF60sn+3Er/jk1Z+wMAMQ1sireSmqaSuIRyzMplBg3Z/Ow1 e7oWstStKgKKTg3I3vS/2vPQIo1t3L+dPLiyucp9GOm1b5Az36mjGCFx17axbPIIb3JjsXl8jgK 3174ZIrvUibeKftnvtlbwGISvEatiqG/NqbvCcEka+D+xnns+2cQJr9f0i8M/LOHvGN3rzT4NHe jBohIxoxIRwJJVWP1qHn7kHbu77FG1PwRF59ut5cZnhuyVSEtrapvZs3/k0UVGqcClDRxw47n4o zanLQsqsIqjKelwAfDqg22xkUOjvPl4nhCslYMnc5eNgxg1Pc8JdnUczp/JkSJR4Fp7YI4MCXoq S18O0Rl1btmCHXHuovFq1YC2lD6log/QeJ/4yzZT7lk2kzHYeSWTbTRLSkwHJ7PP0aSGNOayaae q3Ly+c61ftlJNXs+CvUpzKjkkt4/tqsMewqK7gQQSlqlSXaMvwJkaeAie1Xhk= X-Received: by 2002:a05:6a00:3d0a:b0:848:417a:d1a6 with SMTP id d2e1a72fcca58-85b5b321d25mr11818840b3a.15.1788274979663; Tue, 01 Sep 2026 08:02:59 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.02.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:02:58 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org, Jiawen Wu Subject: [PATCH net-next v3 06/10] net: pcs: xpcs: add ANRESTART support for SGMII link recovery Date: Tue, 1 Sep 2026 23:01:06 +0800 Message-ID: <20260901150111.141037-7-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On some hardware using the DesignWare XPCS IP (e.g., RK3568 MAC side SGMII), the PCS does not automatically restart auto-negotiation when the link goes down and comes back up. Without an explicit ANRESTART, the link stays down forever. Add BMCR_ANRESTART in two places: 1. In xpcs_config_aneg_c37_sgmii(), when starting AN, set ANRESTART alongside ANENABLE to initiate a fresh negotiation. 2. In xpcs_get_state_c37_sgmii(), when link is down and AN completion is detected, clear the interrupt and trigger ANRESTART to restart the negotiation process. 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 Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f9.google.com (mail-pz2-f9.google.com [74.125.228.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A375B42586A for ; Tue, 1 Sep 2026 15:03:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274993; cv=none; b=I5XwbdsbsEoAzRbI7sIAPAxR1OgSS4qOBpO2mfJKoHtatpy+mpJTGZyxP3y9dZUX8hrRkZt9uF9GuzlShLIp50RmUPWJyTkj694StgsT61kJ+nKw+cWLDD3G1r5JY6ihLay8R1+rn+38zKNwRzxJU/mdlHsnkzG8hmqy3j36qL8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788274993; c=relaxed/simple; bh=aA2E1JW/YN6BoCFyum8JDD5Dt2RFbvJ0cPSop1iebR0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CFFzOiLyURyhVDWfMCt74+Uth7vgfKa1H/fO1hITdE/nEExLoW0EWWdKH9ZDCwFnmoznQPBQfS/FQNsVRonymXeeEFc2pKQ5fOqMHJcnKOu+lNWGKXanYhgJRN3Wq8+n8T6jh8Eh6iOXeQ1vtUOfEL7qfBdTzQbunlHfVbO2pj8= 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=UyJcw//5; arc=none smtp.client-ip=74.125.228.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UyJcw//5" Received: by mail-pz2-f9.google.com with SMTP id 41be03b00d2f7-cc1cb48c030so2963568a12.1 for ; Tue, 01 Sep 2026 08:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788274990; x=1788879790; 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=e9xJVngvtWMPsYo6GT7V438AMLRJOB6s6OqkinSBh70=; b=UyJcw//5e+1DvNrfHwPjVgSdMp3Gx7I1QIFT/V7kpIfTs4CIfTIFLITJgLMNeKHU00 9qo/1+3fHNE3FTL0CyuYCRc4OK1AjWYgEms6UX9Riovk6xIVhm5imxRuR0JjeM9DvvQA SKkHhA2pcvox9zoZbJ1ZZrZB5S+VWvFupOeFGttSuWSMWVfYp8sSRwKi0RRkO9O/9Ym4 PQU6CN5WbX7EKUbRYpUrD50BoaHU0kQOoxW8Uo0A2vk8GDshXZQgEq2ZVYyp+1u/9YHO 9Bbrv3SIQ9EnnVGUgOkdm6/lEcrmYTjbIDVQ1Oapoau9QjTzcoMF0+k4Jxa621dzhr0l Vfvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788274990; x=1788879790; 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=e9xJVngvtWMPsYo6GT7V438AMLRJOB6s6OqkinSBh70=; b=BQzmJIJMJ0mlH1WxKBikabCAFsJrt81938w63d6CKwRV6Iwyd5Ugy6o4liI1wAcFLF X6Aw5kSGi/Gr0tE9F6r4J8mXjqw54stzR79gsFyR9clS14UYYkChii6bxzyeq9hdE8aD +a0bvAogp0c0pQWFn2xHS9msOMdxwljJnsn2hnWkdMqZ4AGxJvrl/j+EvUhxLQTi2SXt XlKzCaroOTg/D4i2VlZoaCXjzVwj80IDaMVtrd1bh45nj/iB3ql4lxjUIJkmp83uPbCV nb9exXG5sxBWKNecc79EPngOB891Xg5v4nJG2CgEmK56jsZMTs+Sm+GmkPFjN2F6Y3aH T5mg== X-Forwarded-Encrypted: i=1; AHgh+RrPD9hPo4beMQJ6Ig+JK3m5G88VEV+gLeEw5+/gVTLWpP9EmLfHZ/7oTiw6br7F/dvt3Xy0PC0gZPrWzMI=@vger.kernel.org X-Gm-Message-State: AFuF++nyZRxUuj4I6ZWUl4rSduGn41ie/29sgxey5QeqEvF76geP4452 U5I/RXAat64NWtfx4bJLtAnQypkSwi1vhWxtHxFA4EwtV7os+mXZUQkH X-Gm-Gg: AR+sD13UKI4K1ykBoXy341cTMqeTJYFJ6XXbMwwJw9ppEevG47rFjeUjAiqSDKuet5+ ZR5m0r7cptfTEGD0ytPeYXZAbH0f70iGhtXpUutcpod72p2ixWmGB4x/pArTqgpiMRbwHGCaRj8 M65LCHI8yS45Ro15gZfjCo4+ZQeEYmbOKpr/8nnRLpmjMnVJF+F61ZGBalwdvc3zfNJohlIfLuC eux+oILqcAWCa6rBVVb0tXWguLKYP2HieoP1TrZw5KxVttBKAoPF8SEvuh4M3xtf0lpAQkMRHSE k1SwgkAMS4Ma9z9/OiK5xcNURAmPNicTWsKHK+5FZFP6XTyr8QrZRmowehyKKA/eodvyDEs61K8 help2fNpbaIc5ckRVpKYziijq3z+NXXuaFoIMEUZMA7N2UuODd2RoynyJ1OBrTNveU/t7TVWstw hLd1H5T6ajYxNnMUrWBn1Nkjg/VK4qTbs9mIuyXuC67QNr19aMNUO/7KxEZ50= X-Received: by 2002:a05:6a00:b88:b0:846:bc60:5bf7 with SMTP id d2e1a72fcca58-85b59c6d12amr11909066b3a.6.1788274989442; Tue, 01 Sep 2026 08:03:09 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:03:08 -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 v3 07/10] net: pcs: xpcs: add Rockchip RK3568 platform glue driver Date: Tue, 1 Sep 2026 23:01:07 +0800 Message-ID: <20260901150111.141037-8-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RK3568 SoC integrates a Synopsys DesignWare XPCS that is accessed via APB3 memory-mapped registers. This driver provides the glue logic to make the XPCS accessible to the generic pcs-xpcs core. The XPCS block contains four MII ports (0..3), each of which can be routed to GMAC0 or GMAC1 via the pcs-handle property in the MAC node. The hardware maps these ports to different MMDs: - port 0: MMD 7 (ROCKCHIP_MMD_MII) - port 1: MMD 2 (ROCKCHIP_MMD_MII1) - port 2: MMD 3 (ROCKCHIP_MMD_MII2) - port 3: MMD 4 (ROCKCHIP_MMD_MII3) This driver creates a virtual MDIO bus that translates MDIO operations to APB3 register accesses, with proper address remapping for each port. The generic xpcs driver then creates a phylink_pcs instance on top of this bus, allowing the MAC to use the PCS via the standard phylink API. 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 | 7 +- drivers/net/pcs/pcs-xpcs-rk.c | 561 ++++++++++++++++++++++++++++++++ include/linux/pcs/pcs-xpcs-rk.h | 11 + 4 files changed, 598 insertions(+), 4 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..c809b7f942a51 100644 --- a/drivers/net/pcs/Makefile +++ b/drivers/net/pcs/Makefile @@ -1,10 +1,9 @@ # 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 - -obj-$(CONFIG_PCS_XPCS) +=3D pcs_xpcs.o +obj-$(CONFIG_PCS_XPCS) +=3D pcs-xpcs.o pcs-xpcs-nxp.o pcs-xpcs-wx.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..4ef20b093dada --- /dev/null +++ b/drivers/net/pcs/pcs-xpcs-rk.c @@ -0,0 +1,561 @@ +// 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; + + clk_disable_unprepare(pxpcs->eee_clk); +} + +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"); + + pm_runtime_set_suspended(dev); + ret =3D devm_pm_runtime_enable(dev); + if (ret) { + dev_err(dev, "Failed to enable runtime-PM\n"); + return ret; + } + + 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; + } + + 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 void xpcs_rk_remove(struct platform_device *pdev) +{ + /* + * Force the device into suspend state to gate the CSR clock. This + * prevents clock leakage after devm resources are released. + * + * This is safe because: + * 1. The device link (DL_FLAG_AUTOREMOVE_CONSUMER) prevents unbind + * while any consumer (MAC) is still attached. + * 2. No MDIO access will occur after this point, as the MAC driver + * has already been unbound (or we are being removed because no + * consumer exists). + */ + pm_runtime_force_suspend(&pdev->dev); +} + +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, + .remove =3D xpcs_rk_remove, + .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 Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f10.google.com (mail-pz2-f10.google.com [74.125.228.10]) (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 6A58C418371 for ; Tue, 1 Sep 2026 15:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.10 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275002; cv=none; b=kgm5/ZwOCDu3ZgZLDtzRLUbP9/LKRQzHlbSDCan9XP0r4iHi1xtTLXlqC6BhhGjrAeD5KubdB02wv0VvzaqI1kmj7ucyJBaa9Y++475e0ZUtRNf+KLoRx1pOCYPrgAh90bNy7U0PQZSfRfqEpMFsrhT+FWQjVjGUhYi1IDebqCE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275002; c=relaxed/simple; bh=tkQRbBQ/mU9vTatTgnLxBOyhRF8eVCc3keyF2sUn5vQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=joRkTx17BeLFBSctoKs5bF0RuO8Q3E9SG9rCg5ab68v5OOytpNOWUHvKH+TdAt1W2ESYs2Yx0dI/qHewy3st2cfyzhMRC04+Opvb1szh4wfxRm3tNbMXGkD6IESTCNBLZ2Kg/SxrwTuecuhbYPDpunoOg/oLliSi272MSlIVQBA= 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=KfHBaNuk; arc=none smtp.client-ip=74.125.228.10 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="KfHBaNuk" Received: by mail-pz2-f10.google.com with SMTP id 41be03b00d2f7-cc1c753b1bbso1221117a12.1 for ; Tue, 01 Sep 2026 08:03:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788274999; x=1788879799; 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=dWUPidv7BgL0nZPbTuClJD4vkQYV9rJlaf7Xm4RdOPo=; b=KfHBaNuk8x8ZikGkO1/LwMyA1ESKA7/EkD39XVeV3zpoD+oL48OT57Imoa2KkyAVTB GjiqQDtZcaZgA+nfJT3xDwCroYdiaTzqtbK7nY2t6SxG31lXSoLm3v7U/7K8cHsFOQqQ U4z0bgMt0z6+DGC3iA11Cj5jVMjch9lz24KVHbvhq1h0IURRSmLqV8Ac+XVi9kF6wlO9 vA9Fo7N+sUGo+nIGuAIbY0fIFHYLg2krJYvH+IZoH2WnN/eCbL0ORAgurq1QrvjVc+O0 4aCQAL/sZjTnS4YcdrLuqxoR5skpo/VNwBe17D8TQ6MQfF8MdlL7msWczVpgQ8RqEnS4 /90Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788274999; x=1788879799; 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=dWUPidv7BgL0nZPbTuClJD4vkQYV9rJlaf7Xm4RdOPo=; b=jdxFG2SMXZ02p9Cpvnf2G3O40kk+E5dkZREeQ7StB9cfb2MfYA7DOoPee7vKlLQidt uyywAM9OZwk9dYMNYX54YTxlUYaKIIbyik8O5kPobpK3jVOwYho4kETCpfK+P9zme87j sxu5ribcU9DufehwWLg2TANojN18FaDanUe/rAC1lAbmIxf5rXYHC8nxleuR4dcibDbj cZKIQuy4oCEbz415Fw49H6KdbJY1GxbBpphrQV0oBKiNZg0vT9Qr1073T+qw8/gvGdY1 lGmRzVUpooIXz7QwAlBmJ7PNuksS2kjLx1EejuIaC3gqHa+zlFrEXD5A2sTnzPbdw1z0 Pm1Q== X-Forwarded-Encrypted: i=1; AHgh+RrFlrk0ZNk5/Z3vfz9O9aJKIMYk8ayRVea1q8WA9gp6kGl7NJFy+ya/96I4Zb8Rjnpji3BleD2ZLB1cvjI=@vger.kernel.org X-Gm-Message-State: AFuF++n61fSWXT5inFcAmN0T33jBu/ZgEbQZOqoIjtkygLkCuao/ry74 OTG/Zr90lFlgZX0VQxGg+HRxcHyFUduAFEESzH92TClYZZV5Uq9qNjfU X-Gm-Gg: AR+sD12Z0Kt+SZkBTQxgaO451uMQD0QuMyWiKom2yPCGwGaAMIeReg59qqJ9s2dDVQ7 EaPK1D/yyzOWked64dundPGsBlpFRquwtsi2Vi5+tGtL/BDiYuB99oA8+A7Y/HsenwMBebkqfYR 79yssjGS5VhPlmz/TjZztLMA/nuzOccW43HbB09x5qbXweyBYkwLAOv9c5ozOzgm0891xJdLN03 FuxsFlrH53TJLQeB4ysmIa7d/ZJH0Y243fqIBH3A8R88zLI8MdQVlxS1CIcklow3+ppOk3qSH+f n4FJwUHYu6sBSY3pkCYuwsIBRnhIAAeQy+0WSsJVL8dY8RgZh8lObF+18YNmh96rxIrWqG+RFq4 8LtikVekRtkRtClWdwmXCgTAhen8q0eiJz/XEzP3zNHuwMYzxNtpIoFCV4uqpVzHfU7Xnd4z7vj 4BMIKNogYQfJZ9PqG1QRUYJBdYZpaUMO7aPgzIFB0o7r6AxJwLULXX1mujf4WA X-Received: by 2002:a05:6a00:451b:b0:847:7f3c:b5f5 with SMTP id d2e1a72fcca58-85b5a63ff40mr13371271b3a.11.1788274999377; Tue, 01 Sep 2026 08:03:19 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:03:18 -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 v3 08/10] net: stmmac: dwmac-rk: add SGMII support for RK3568 Date: Tue, 1 Sep 2026 23:01:08 +0800 Message-ID: <20260901150111.141037-9-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RK3568 SoC integrates a Synopsys DesignWare XPCS that can be connected to GMAC0 or GMAC1 in SGMII mode. Add the necessary glue logic to support this configuration. The current dwmac-rk driver does not support SGMII mode. SGMII requires a PCS to handle auto-negotiation and link state reporting, but the existing driver only supports RGMII and RMII. Add a set_to_sgmii() callback to configure the GMAC GRF register for SGMII mode (bit 7 set, interface selection bits 4:6 cleared). 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) Signed-off-by: Coia Prant Reviewed-by: Maxime Chevallier --- 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 Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f9.google.com (mail-pz2-f9.google.com [74.125.228.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7517420E89 for ; Tue, 1 Sep 2026 15:03:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275011; cv=none; b=JO34Sa3L1YxgILFv9IntH8kcv1UJMOtLhsIm3x12BiVfVq9Im+vj2RUIqTw55QdFnsVwqSLSf3jqndWtyV6LWWAkqMsTBaD6mvJZlM3p/g7DT680UVXsGnMgx0Mt1tea8WeuedRkvv2zZNnzdxaieRnNfwcfNCrGfuMrUOxlb4s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275011; c=relaxed/simple; bh=Pbqc17ixdKV04mbPvez2/xb4avNWEBnmgCndr6ae4z0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=l5aIarTaRI7tGPVi7vox5Glezpe9jAiXpz1gXCnIiS4Je4E8XskyTuedDV2rZnAl2kDiuohP9rMNFpVWHzsPsxSamE7Hk01Gzibel5/7kaGkQbLgqlFRR4MVVkho66tS2YyiEunwLT6nIcQrPQ/Rr/dWQvqPx91i2+g8Et2JmRc= 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=p+RXE0bp; arc=none smtp.client-ip=74.125.228.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="p+RXE0bp" Received: by mail-pz2-f9.google.com with SMTP id 41be03b00d2f7-cc150711112so775673a12.0 for ; Tue, 01 Sep 2026 08:03:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788275009; x=1788879809; 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=p+RXE0bpL3+o4Lw3WrP7+HU4iGx0qwT/vSMITaGgptxH3XfAdpuWVov0LoVrFj1vD3 sSroPXV9z+hO8tJ4gJ2zG113VLfY3Ovc/Wm2A7g0xYd6YrOPq0nhtdcuxPtNBgfvvNLd gT9FViRjd6y8Zj3BCVFbYrOMzXwCS+08wRJbY7Y0J/dXQxBqnxjdimPyCANXva+t7M0J fx7FcBrZiBWw0nC9Z2w/EqTo3KC0INrIUX8C2QHnC6ArY9/2aa67BmRqHnYlBDOU9aAl CbiJFvTkRJTLb03QVDMPNmd7awBTI2vcqZKTHhbujzrUKAoap7xJfFxFKZCr1TNnb81m 1o6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788275009; x=1788879809; 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=AD3E47/kU7O69R72M2+oFGyq4Q3yh17GD4F8+J1BYduozWeUBzFN0hiHZcqZo7+60+ SFSsMVyPy4CHnaGme1NLaBG5qdo5l/Dr+aHJPkWaF41+fmZWdTxSBU26nJcxypn6jDR4 gP3a4//dmdH3x7p2Nh5WHZ0vnidK2TjPvHRHihbCwhPyKiSx33idxbxooUlj7SNV1P2P GDQwMBb8kGSVUi2GuHCHvHyWnfBchDTIKsoPbNnFZJsePu036NQ6aAAU1p3W6LMyiP3B EiU2S/e2PYe9wYuswdb/itlUP/dRpxiOqz5KkQeTjZsrzQtHQM7lFwICPoipPNdsaRzI pM3w== X-Forwarded-Encrypted: i=1; AHgh+Rr0XihLWDG2f3UhwGWFU/9lEio+eq1lxJ8HSMnu3eSLa8ZvRZzEspZ0wsUuaCnv/FTG/HHGq7tnTrn9u6E=@vger.kernel.org X-Gm-Message-State: AFuF++kqdJJG0Jh25ihv+0GymhKWnRB9B+kdtWD7OYB8pUE1d/YOdIG+ EEzitl81pStZhmV2C6ArTS6+ERo7z0w2oXs/YzuVTcVbjBAd9VXH4Bw3 X-Gm-Gg: AR+sD11dwl0/I8H7yJ1TtdxAKAC8S88IpZ+ZV6qDMZJ4kJTYsZhy4ZmdtuAoF8YaXT0 ZfbBgiqQgK25TW9KHJ/zGGmlEvmyzYXB+PqJWFzr+yKHQ9PR+IX8e/bdIHxDFXpVXDnkwvfKd6u nadwgY4nSQbSNPTl2Wn20z3mk+Vuo94tbopW4d5yuvrq3CfeEfTcyreIKIqjBG6M/pH26t9vV6B RBl5w+NOoM70U7crEJx4YBvTEZ0gJRA2HHV3Z2CbYEiuovwbGWgKXGaRWIcztRgl8pqZZfiCJjH gVk9siGJLv0afpHrVPG+8ryTW/Sjymz6ptWZ/ZAugkE0wqaor06gusEMfXPkAo48uqb1FukMNiG A1Amg9XyeHSaXldNbOQfj02yOxAUk4njMAchEt/iQN+rt/Ka4IihNm+A3GR32LNict4/Ka9j+c9 QOiKnC38MzmL0w3lzFwRna6w0dZDTkysg1H0gS5SV3Vl1S54t4blR6lBQGPRY= X-Received: by 2002:a05:6a00:a213:b0:848:2ab3:ddeb with SMTP id d2e1a72fcca58-85b5b324108mr11831442b3a.14.1788275008779; Tue, 01 Sep 2026 08:03:28 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.03.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:03:28 -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 v3 09/10] arm64: dts: rockchip: rk3568-photonicat: enable SGMII LAN port Date: Tue, 1 Sep 2026 23:01:09 +0800 Message-ID: <20260901150111.141037-10-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The Ariaboard Photonicat has a Motorcomm YT8521SC Gigabit Ethernet PHY connected to GMAC0 via XPCS SGMII. Enable the necessary nodes to make this port functional. 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 Sat Sep 26 12:26:50 2026 Received: from mail-pz2-f7.google.com (mail-pz2-f7.google.com [74.125.228.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B12C83D6663 for ; Tue, 1 Sep 2026 15:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.228.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275050; cv=none; b=KfjPIqBruV6WL+M556Zn6dCB1nSXpCOhsKHW91Tl/YGxU91cXRRTb9Z7RaTFP1lLxjnGDLEeJzUwPS184DHpKAjcbksFPGoLT5DAdUCQ1mFDidF4gIpr6+k/jf1qEBeEec4i9NveOxCi1sMlEHChYCPxeYvTkCY0nmBRFE+lg9Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788275050; c=relaxed/simple; bh=VMBfELsDgdw4LHnXCPqjLHfbD46aI9SXxvEcWut9ryc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ulF2o2OAxKeNk4lgyz7MHuayqOHTZuLnpFoyef9GcGOIB2IeNSDaDQtuGgCHrsj2VgBOe9k/f+AXhpBRlY49lWEzr4Xq/vfRL82IzFVPcCDZM2ROzU4Z4TE6hTCJmV6ayhfGq5X7cjPNHNW3PerijIs7yFzaUoj/RjmwI6Lq6po= 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=brmu9yGT; arc=none smtp.client-ip=74.125.228.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="brmu9yGT" Received: by mail-pz2-f7.google.com with SMTP id 41be03b00d2f7-cc1ddb3ba3eso3187657a12.1 for ; Tue, 01 Sep 2026 08:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788275048; x=1788879848; 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=jFOAryefyj3E8LprwQb6zM23kP14ZZpWJUCwFcY71vI=; b=brmu9yGTEA2F4WzPCq6ADcgF7oOZy++TTvE+0A4rE30xUoEOT6hWOz5XtZPRBGh7NI VdA7uNEsUkaBJIjyaNdrV/WEW218oPPbEwXuLXTYwpTbeAU5fPhJFRMuQN27pKY0JQgr 9p5yXkCKY/anvFDdiOPEs0dbGhGAjhtSTbUXZVWjdsobeRL0nXh27qXK74EPuhhyZj/j 4p+4gERbxqoZFE+vq5LvdyDZHAiyBqfEWeC/0YQbeIhFVoDq39Yg/l80Tlx8mpnsSSnP iInc1Fs/c//Zlt7ga4B3V+AMNVG2n7IdHs3tOWXqqMo+r9VH1l+RsJvnbePrEGWOC+mG 460g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788275048; x=1788879848; 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=jFOAryefyj3E8LprwQb6zM23kP14ZZpWJUCwFcY71vI=; b=inDoojIKEdCVuKetSi+4PMAg3cF4tJWvHPTrv20v3wS/vVKdH68s8G+VMNzAnYmRZA q1kw3mZAMmdv0V4FmlVspPjEprlY5rfX/nDiuNR5v1i0o5yMl7iD8us+XeS6ay0X1kM9 VzfV7ciCAt6fU7zi2GGvn3vmoxaq57ukdJ8rwDym+//HmghdJp/R0BcKTC+el+Kk0WH6 oNjqfGPFqx0Tf7n2OaOqBcDj3zdeS5vdiAQS4Bt2dAyb/niBCVGOZj2r5gsk9AJePmF8 tGGqsJAHElWVGZ5rWsp96tI+mbFUQZy/sq84BN3FuUeOWoh3LjZTHEz9HMEpSs42HyT/ VRFA== X-Forwarded-Encrypted: i=1; AHgh+RqaMBDpdpIGuHnfH5hM6RVuy43aUkoQli0/KR4H9wtNduWJc2ISoszgvMgJez45lFnYS1RL0055CSOSsiA=@vger.kernel.org X-Gm-Message-State: AFuF++kH5Yw9QFSeEw7mA00y93mL0136vo+/qdfO4S+kFtLddEwHt6LV d5lH7sWWyUCFYGFFbqkB0NBZi/z4gB5Wmp+nU4xvxhyILxNEpU8cJ4y2 X-Gm-Gg: AR+sD11qjDdlCAOxefFEn5OXNcDF4zY1E72t/OkK780B9hM8SLlZJREqkY88ZopdnO/ j9GZ5aN7o6ADUvVJhr9ckHfiV1RafrGW8xwRfJTBNFjlrqCT4Zm95a85b2rH2Md7O1lNJX/mUVy aTQuJaZV+0jJ7q2vqkN4FbnLH7DG69UtCq2cp5Y9g4KOZrleFwOwqXTqW+SpPeMA338Yb7yupFv 1t/CROzQAPizxjMJjCJoGg9vDR2p9VSlqE0UApKRBkqp3la8686Fpt8NmK/itDfJh/jRA4E4q4m 7309VRlACYgjbo6jgkEtOZXA2DdyUxMsNpjuTw9U03PnqmWiCnfI6kF3tKq95nzoR/4c9qX254r EPHh/mFouAz99deFXrT+kNiu0vk3AbDXsKxcKzrDNOqIdcHDobeN5gtVCunO4xXR7XNvMJ+hpWw 21yz5QPw9ruQWSvvvWc6KbjYy63OD37uC+rH0FI2LrP661wmjDnGR5R2Bddsk= X-Received: by 2002:a05:6a00:4501:b0:857:72f8:dc91 with SMTP id d2e1a72fcca58-85772f8de55mr39669660b3a.18.1788275020723; Tue, 01 Sep 2026 08:03:40 -0700 (PDT) Received: from server.lan ([150.230.217.250]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-85dc0716846sm27914b3a.45.2026.09.01.08.03.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2026 08:03:39 -0700 (PDT) From: Coia Prant To: Andrew Lunn , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Vinod Koul , Maxime Chevallier , Maxime Coquelin , Alexandre Torgue , Lad Prabhakar , Romain Gantois , Heiner Kallweit , Coia Prant Cc: Neil Armstrong , Russell King , Shawn Lin , David Heidelberg , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v3 10/10] MAINTAINERS: add entry for Rockchip XPCS driver Date: Tue, 1 Sep 2026 23:01:10 +0800 Message-ID: <20260901150111.141037-11-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260901150111.141037-1-coiaprant@gmail.com> References: <20260901150111.141037-1-coiaprant@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a MAINTAINERS entry for the Rockchip RK3568 XPCS platform driver and its device tree binding. Include the relevant mailing lists (netdev and linux-rockchip) so that future patches are properly distributed. Signed-off-by: Coia Prant --- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 3a19da74d00c9..c3b17752cc817 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23744,6 +23744,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