Re: [PATCH] net: usb: lan78xx: add weak dependency with micrel phy module

Andrew Lunn
2024-07-27T23:29:34Z

> Before going into explaining my viewpoint, could someone, please, clarify
> which LAN78xx USB-to-Ethernet bridge does this apply to? I already had
> a look at a few LAN78xx datasheets, and I'm not sure how the external PHY
> becomes exposed over the USB interface, so it needs a driver.

https://elixir.bootlin.com/linux/v6.10/source/drivers/net/usb/lan78xx.c#L2049

This is creating an MDIO bus device. The MDIO bus will be scanned and
PHYs on the bus found. There are then a few calls to phy_find_first()
which will get the PHY.

The code itself looks pretty broken, it is directly accessing PHY
registers, which a MAC driver should not do. That is a layering
violation.

Andrew