netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Romain Gantois <romain.gantois@bootlin.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 3/3] net: phy: dp83869: Support 1000Base-X SFP
Date: Tue, 4 Nov 2025 09:01:36 +0000	[thread overview]
Message-ID: <aQnA8HZjKKgibOz-@shell.armlinux.org.uk> (raw)
In-Reply-To: <20251104-sfp-1000basex-v1-3-f461f170c74e@bootlin.com>

On Tue, Nov 04, 2025 at 09:50:36AM +0100, Romain Gantois wrote:
> +static void dp83869_module_remove(void *upstream)
> +{
> +	struct phy_device *phydev = upstream;
> +
> +	phydev_info(phydev, "SFP module removed\n");
> +
> +	/* Set speed and duplex to unknown to avoid downshifting warning. */
> +	phydev->speed = SPEED_UNKNOWN;
> +	phydev->duplex = DUPLEX_UNKNOWN;

Should this be done by core phylib code?

> +}
> +
> +static int dp83869_module_insert(void *upstream, const struct sfp_eeprom_id *id)
> +{
> +	__ETHTOOL_DECLARE_LINK_MODE_MASK(phy_support);
> +	__ETHTOOL_DECLARE_LINK_MODE_MASK(sfp_support);
> +	struct phy_device *phydev = upstream;
> +	const struct sfp_module_caps *caps;
> +	struct dp83869_private *dp83869;
> +	phy_interface_t interface;
> +	int ret;
> +
> +	linkmode_zero(phy_support);
> +	linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT, phy_support);
> +
> +	caps = sfp_get_module_caps(phydev->sfp_bus);
> +
> +	linkmode_and(sfp_support, phy_support, caps->link_modes);
> +
> +	if (linkmode_empty(sfp_support)) {
> +		phydev_err(phydev, "incompatible SFP module inserted\n");
> +		return -EINVAL;
> +	}
> +
> +	interface = sfp_select_interface(phydev->sfp_bus, sfp_support);
> +
> +	phydev_info(phydev, "%s SFP compatible link mode: %s\n", __func__,
> +		    phy_modes(interface));
> +
> +	dp83869 = phydev->priv;
> +
> +	switch (interface) {
> +	case PHY_INTERFACE_MODE_1000BASEX:
> +		dp83869->mode = DP83869_RGMII_1000_BASE;
> +		phydev->port = PORT_FIBRE;
> +		break;
> +	default:
> +		phydev_err(phydev, "incompatible PHY-to-SFP module link mode %s!\n",
> +			   phy_modes(interface));
> +		return -EINVAL;
> +	}

If you only support 1000BASE-X, please test that in the interface mode
mask (caps->interfaces) rather than going round this long winded
method.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2025-11-04  9:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04  8:50 [PATCH net-next 0/3] net: phy: dp83869: Support 1000Base-X SFP Romain Gantois
2025-11-04  8:50 ` [PATCH net-next 1/3] net: phy: dp83869: Restart PHY when configuring mode Romain Gantois
2025-11-04  8:57   ` Russell King (Oracle)
2025-11-04  9:01     ` Romain Gantois
2025-11-04  8:50 ` [PATCH net-next 2/3] net: phy: dp83869: ensure FORCE_LINK_GOOD is cleared Romain Gantois
2025-11-04  8:50 ` [PATCH net-next 3/3] net: phy: dp83869: Support 1000Base-X SFP Romain Gantois
2025-11-04  9:01   ` Russell King (Oracle) [this message]
2025-11-04  9:10     ` Romain Gantois
2025-11-04  9:15       ` Maxime Chevallier
2025-11-04  9:17         ` Romain Gantois

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aQnA8HZjKKgibOz-@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=romain.gantois@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).