[PATCH net-next v15 03/15] net: phy: Introduce PHY ports representation

Maxime Chevallier maxime.chevallier at bootlin.com
Wed Nov 12 00:23:21 PST 2025



On 11/11/2025 04:53, Andrew Lunn wrote:
>> +/**
>> + * phy_caps_medium_get_supported() - Returns linkmodes supported on a given medium
>> + * @supported: After this call, contains all possible linkmodes on a given medium,
>> + *	       and with the given number of lanes, or less.
> 
> lanes -> pairs?

indeed :(

> 
>> +	/* The PHY driver might have added, removed or set medium/lanes info,
>> +	 * so update the port supported accordingly.
> 
> lanes -> pairs?

yes true :(
> 
>> +struct phy_port *phy_of_parse_port(struct device_node *dn)
>> +{
>> +	struct fwnode_handle *fwnode = of_fwnode_handle(dn);
>> +	enum ethtool_link_medium medium;
>> +	struct phy_port *port;
>> +	const char *med_str;
>> +	u32 pairs = 0, mediums = 0;
>> +	int ret;
>> +
>> +	ret = fwnode_property_read_u32(fwnode, "pairs", &pairs);
>> +	if (ret)
>> +		return ERR_PTR(ret);
>> +
> 
> I think this needs to come later. It is not critical now, but when we
> come to add other medium, it will need moving. If we add say -K, and
> need lanes, we don't want to error out here because pairs is missing.

Ack, I'll relax the check

> 
>> +	ret = fwnode_property_read_string(fwnode, "media", &med_str);
>> +	if (ret)
>> +		return ERR_PTR(ret);
>> +
>> +	medium = ethtool_str_to_medium(med_str);
>> +	if (medium == ETHTOOL_LINK_MEDIUM_NONE)
>> +		return ERR_PTR(-EINVAL);
> 
>> +	if (pairs && medium != ETHTOOL_LINK_MEDIUM_BASET) {
>> +		pr_err("pairs property is only compatible with BaseT medium\n");
>> +		return ERR_PTR(-EINVAL);
>> +	}
> 
> This i think needs changing, if medium == ETHTOOL_LINK_MEDIUM_BASET
> then get pairs, and validate it. I would probably also test it is 1,
> 2, or 4.

That's fine by me :) I'll update the binding as well then, as having 3
pairs will never be correct.

Thanks a lot for looking at this !

Maxime

> 
> 	Andrew




More information about the linux-arm-kernel mailing list