[PATCH net-next v10 04/15] net: phy: Introduce PHY ports representation
Maxime Chevallier
maxime.chevallier at bootlin.com
Mon Aug 4 06:41:57 PDT 2025
On Sat, 26 Jul 2025 22:38:32 +0200
Andrew Lunn <andrew at lunn.ch> wrote:
> > +static int phy_default_setup_single_port(struct phy_device *phydev)
> > +{
> > + struct phy_port *port = phy_port_alloc();
> > +
> > + if (!port)
> > + return -ENOMEM;
> > +
> > + port->parent_type = PHY_PORT_PHY;
> > + port->phy = phydev;
> > +
> > + /* Let the PHY driver know that this port was never described anywhere.
> > + * This is the usual case, where we assume single-port PHY devices with
> > + * no SFP. In that case, the port supports exactly the same thing as
> > + * the PHY itself.
>
> I wounder if you should hook into __set_phy_supported() so that DT
> max-speed, and the MAC driver calling phy_set_max_speed() are covered?
This code runs after of_set_phy_supported(), so any speed limitation
enforced through the max-speed DT property will also apply to the
ports's supported field. Hopefully, now that we have a port
representation in DT we can get rid of some of the max-speed use-cases,
such as a 1G PHY connected to a Fast Ethernet port :)
For phy_set_max_speed(), the phy device's supported field will be
update, but not the port's. So indeed, I think we should update the
port's supported upon calling phy_set_max_speed(), I'll add and test
that for the next iteration.
Thanks,
Maxime
More information about the linux-arm-kernel
mailing list