From nobody Mon Feb 9 12:24:33 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51FB5326D76 for ; Wed, 14 Jan 2026 22:58:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768431483; cv=none; b=JYvPEXmunC2kpd3nzpD6ZVuTalThV2Cr4zaPlt+/hou8tmY/Vbn9JJaCeUINU7JGNAKKDNQr7zpUSOXVbtps/CNzvHuLVMOcVy1wjN5C7SQLgAE1qdSi3muoNEj8z86QEiU/9UQqUTAvCXqDcqlzsZJhFEjG5Tscc4G5z6p+UGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768431483; c=relaxed/simple; bh=cEX56O7lFKginQnkeWC5k3VQ5cnyMT/ZHcHCaKr+ehw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WqhafCqrjLCNPOtcQb5TJDCSr2q0JITFDR7ik+rhLrEtuvAKk+CEg6vXYvpDMPT2b4W9OrdxliCdfVBwaWM5j0L3AIWiUPmYMGbaITTeXsQSoEMwbk1vdddWO1JcIRX835NGfOy8WDFuh4TUXRmiY/LMAdlUvbANPkTikLpI/0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=x5Yl7BWn; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="x5Yl7BWn" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 920D81A286E; Wed, 14 Jan 2026 22:57:53 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 65C746074A; Wed, 14 Jan 2026 22:57:53 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id F0EBC10B68410; Wed, 14 Jan 2026 23:57:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768431472; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=+/6GTR/lJRvxq7OYqByep9cN9DNBMPgL+lC49ZimkbA=; b=x5Yl7BWnN863GrXNmtdIwijhs2RcnvC2ZsHGN5T74+4fSVbGFJ+mTS0wUaeycV0VkN+QM0 bss2jf72KyQgkIl47EuuyXz/f1TytJLNj9SA9DRbiQjnYcwqP9XWmyT4j5COecGM0iVCiI Tz0reOEDhjJQTmgJYAI7UMmkNMAAxpc+jOda6QO/JeI7BDh+dy+2N3LrDRl/pCAAg2R6Xi St+zukWadf2dninDaNmEztOZbjg21SEeiSbxIDXTs3NrzY4Kd//7dIymNQcZ48ZxXa78xp iBlqe29faCIoRV07nLwB0RObrltffkQ3JW856OyY2aIDh+El9XW0HOFdMkTpoQ== From: Maxime Chevallier To: davem@davemloft.net, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , Jonas Jelonek , Florian Fainelli , Heiner Kallweit Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Simon Horman , Romain Gantois , =?UTF-8?q?Marek=20Beh=C3=BAn?= , bcm-kernel-feedback-list@broadcom.com Subject: [PATCH net-next 3/6] net: phy: Store module caps for PHYs embedded in SFP Date: Wed, 14 Jan 2026 23:57:25 +0100 Message-ID: <20260114225731.811993-4-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20260114225731.811993-1-maxime.chevallier@bootlin.com> References: <20260114225731.811993-1-maxime.chevallier@bootlin.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 X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" When a PHY device is embedded in an SFP module, the PHY driver doesn't have any information about the module. Most of the SGMII to 100BaseFX modules seem to contain a Broadcom BCM5461 PHY. This device seems to support a wide range of possible configurations, with RGMII or SGMII inputs, and BaseT, 100BaseFX and possibly 1000BaseX output. However, there doesn't seem to be a capability register that returns reliable-enough values to detect from the PHY driver what configuration we are in. On the Prolabs or FS SGMII to 100FX modules for example, the PHY returns 10/100/1000BaseT capabilities. We can know the exact configuration by looking at the SFP eeprom, and the list of linkmodes built by parsing it and applying the quirks and fixups. Let's make that information available to PHY drivers, so that they may use that in their .get_features() and configuration process. Signed-off-by: Maxime Chevallier --- drivers/net/phy/sfp.c | 5 +++++ include/linux/phy.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 5b42af1cf6aa..1f9112efef62 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -1895,6 +1895,11 @@ static int sfp_sm_probe_phy(struct sfp *sfp, int add= r, bool is_c45) /* Mark this PHY as being on a SFP module */ phy->is_on_sfp_module =3D true; =20 + /* We need to populate the parent_sfp_caps now, as it may be used during + * the phy registering process, such as in phydrv->get_features() + */ + phy->parent_sfp_caps =3D sfp_get_module_caps(sfp->sfp_bus); + err =3D phy_device_register(phy); if (err) { phy_device_free(phy); diff --git a/include/linux/phy.h b/include/linux/phy.h index 3beb5dbba791..a515c014679e 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -649,6 +649,8 @@ struct phy_oatc14_sqi_capability { * @ports: List of PHY ports structures * @n_ports: Number of ports currently attached to the PHY * @max_n_ports: Max number of ports this PHY can expose + * @parent_sfp_caps: Capabilities of the SFP module that embeds this PHY. = Only + * valid when is_on_sfp_module is true. * @lock: Mutex for serialization access to PHY * @state_queue: Work queue for state machine * @link_down_events: Number of times link was lost @@ -791,6 +793,8 @@ struct phy_device { int n_ports; int max_n_ports; =20 + const struct sfp_module_caps *parent_sfp_caps; + u8 mdix; u8 mdix_ctrl; =20 --=20 2.49.0