From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82CE7606A332 for ; Tue, 10 Nov 2026 16:06:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Q8cajn/r; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=sSPS03a4 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=rKxoMWZkYoBD0Hpn9Lz9Mz9UatUSXWePYqLDBHk2bmQ=; b=Q8cajn/rfYBnvtFLR78MxH7sGB Gf8JR/7n/s1O1XMBX5FufdmrBZmSHPPsXWAOUILbmsxTGRa+ZOTErFgWDXzq8b4cBI7YFEA5gYzOi 8uIr0ps+hSq9sJ4bgkEtPq9/vUDAwDzyzzXsiklqEXv3zNAg5Q11tkNl2/iqXn03gKAazNoyy0sIX Jdfbmvao9net7dxEcbCouBNLvSvV41K0JE1u7BEcPT9Ux94EoQWkAyl/+KrK5rx6LqDMCK0lCbqNG 68KXu0FWA4ElprdLIhjQe067wF7AFWqV6WJxNr3ceH98jOc+L38Zvq01c6WXDAl7qZ2GVRWYZMt9A 8UhmIzRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xQoMx-00000004TuV-2sd4; Tue, 10 Nov 2026 16:06:47 +0000 Received: from mail-dl2-x06.google.com ([2607:f8b0:4864:38::6]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xQoMu-00000004Ts6-3fXL for linux-rockchip@lists.infradead.org; Tue, 10 Nov 2026 16:06:45 +0000 Received: by mail-dl2-x06.google.com with SMTP id a92af1059eb24-1b3a6a69818so586857c88.1 for ; Tue, 10 Nov 2026 08:06:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1794326804; x=1794931604; darn=lists.infradead.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=sVnxZNWX6ViUZL7bQPqGM+4jUAh9aQEpBFmSldUmrlQ=; b=sSPS03a4JaSrcJekQR6iI+HNVFCSuatvi0LKd5j90wWvc99/HKB6xDClrlKUzWBL/O NslD+0vs5O0npD4tyG4up8M2EFwFfzhnp2epDwenYdQPaeZvHiwQx2/MWmwGjolmiSvj S66TMC33lUbKUPuOiLaqpPIK8tvCu+VbjFxVfioKskD1LuewyOGH7gRB4kT7ovBOIjTe ulePWyw4wqVCt5LR1Rv6plaheY1s7wkhc4HBGIBcfvRDKf+n2eUMYXB5L00saNC5q4BS wOZupXa99YN7rWjvr5JsccY+p6rXh8Fc6nMwGyOchPhwSi39NSZMdkbk/EZxFhI5b6Vp bKBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794326804; x=1794931604; 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=sVnxZNWX6ViUZL7bQPqGM+4jUAh9aQ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UDz8dgrp8LqptdG095OO71rETyi6wJP5uaBSE7rXM92LW8mTauJFDWA X/CrHqyQ1B3+BkguKOk7JNzftwBD6bE984g3q/ewb2Oa/3W+QabHy56cSqOg0NdTwPPEE7ss9qC aocHZmhtdptd4/ifzd735a3/gQAAdx6CYY8QwNtc5iTRbjJw X-Received: by 2002:a05:7022:1505:b0:1b3:ac53:da84 with SMTP id a92af1059eb24-1b3b603ea3cmr4271960c88.32.1794326803608; Tue, 10 Nov 2026 08:06:43 -0800 (PST) Received: from server.lan ([168.138.199.194]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3751fe306e3sm8453403eec.7.2026.11.10.08.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Nov 2026 08:06:42 -0800 (PST) From: Coia Prant To: Jakub Kicinski , Paolo Abeni Cc: Jiawen Wu , Mengyuan Lou , Andrew Lunn , "David S . Miller" , Eric Dumazet , Heiner Kallweit , Russell King , Heiko Stuebner , Aleksandr Loktionov , Fabio Baltieri , netdev@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Coia Prant Subject: [PATCH net-next v4 2/2] net: pcs: xpcs: make supported_interfaces authoritative Date: Wed, 11 Nov 2026 00:05:54 +0800 Message-ID: <20261110160554.918652-3-coiaprant@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261110160554.918652-1-coiaprant@gmail.com> References: <20261110160554.918652-1-coiaprant@gmail.com> X-Archived-By: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261110_080644_925304_8E690900 X-CRM114-Status: GOOD ( 19.83 ) X-Spam-Score: -2.1 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-rockchip" X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 pcs.supported_interfaces is the mask of interfaces a given xpcs instance actually supports. The compat table describes what the Synopsys IP can do in general, but a specific integration may support a different subset. For example, the RK3568 XPCS supports 1000BASE-X, SGMII and QSGMII in hardware, but does not implement the C73, 10GBASE-R or 2500BASE-X modes that the Synopsys compat table advertises. However, xpcs_find_compat() only walks desc->compat[] and does not look at pcs.supported_interfaces. If a caller ever passes an interface outside the mask, the core would still find and configure a compat entry for it, contradicting the mask the glue already set. This was a known gap: the mask was written but never consulted by the core. Fix both sides: - In xpcs_find_compat(), return NULL when the interface is not in pcs.supported_interfaces, so the mask is authoritative for what the core will configure. - In the Rockchip glue, build a platform mask with the three modes supported by RK3568 (1000BASE-X, SGMII, QSGMII) and intersect it with the core's supported_interfaces using phy_interface_and(). This narrows the mask inherited from the generic compat table so it reflects the actual SoC capabilities. Note that QSGMII is currently filtered out (a no-op) because the core's compat table does not support it yet, which demonstrates the intended filtering behavior of this intersection. If the core adds QSGMII support in the future, the glue will automatically pick it up. This is a logical inconsistency rather than a user-visible bug in a released kernel: the affected Rockchip platform is not present in any released version, and the MAC side forces the phy mode, so phylink does not normally pass an interface outside the mask. The patch makes the mask the single source of truth for both the core and the glue. Signed-off-by: Coia Prant --- drivers/net/pcs/pcs-xpcs-rk.c | 10 ++++++++++ drivers/net/pcs/pcs-xpcs.c | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/net/pcs/pcs-xpcs-rk.c b/drivers/net/pcs/pcs-xpcs-rk.c index ad187fba4e9d..e29f473776b2 100644 --- a/drivers/net/pcs/pcs-xpcs-rk.c +++ b/drivers/net/pcs/pcs-xpcs-rk.c @@ -480,6 +480,7 @@ MODULE_DEVICE_TABLE(of, xpcs_rk_of_ids); struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *pcs, int port) { + DECLARE_PHY_INTERFACE_MASK_ZERO(supported_interfaces); struct platform_device *pdev; struct dw_xpcs_rk *pxpcs; struct dw_xpcs *xpcs; @@ -536,6 +537,15 @@ struct dw_xpcs *xpcs_rk_create(struct device *dev, struct device_node *pcs, int return xpcs; } + /* + * The RK3568 XPCS supports 1000BASE-X, SGMII and QSGMII. + */ + __set_bit(PHY_INTERFACE_MODE_1000BASEX, supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_SGMII, supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_QSGMII, supported_interfaces); + phy_interface_and(xpcs->pcs.supported_interfaces, xpcs->pcs.supported_interfaces, + supported_interfaces); + xpcs_config_eee_mult_fact(xpcs, pxpcs->eee_mult_fact); put_device(&pdev->dev); return xpcs; diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 6466e0ff2a98..46878a66064e 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -169,6 +169,9 @@ xpcs_find_compat(struct dw_xpcs *xpcs, phy_interface_t interface) { const struct dw_xpcs_compat *compat; + if (!test_bit(interface, xpcs->pcs.supported_interfaces)) + return NULL; + for (compat = xpcs->desc->compat; compat->supported; compat++) if (compat->interface == interface) return compat; -- 2.47.3 _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip