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

Andrew Lunn andrew at lunn.ch
Mon Nov 10 19:53:52 PST 2025


> +/**
> + * 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?

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

lanes -> pairs?

> +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.

> +	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.

	Andrew



More information about the linux-arm-kernel mailing list