Re: [PATCH net-next v2 1/2] net: dsa: mt7530-mdio: read PHY address of switch from device tree

From: Arınç ÜNAL
Date: Wed Apr 17 2024 - 03:02:53 EST


On 17/04/2024 06:09, Florian Fainelli wrote:


On 4/16/2024 1:32 AM, Arınç ÜNAL wrote:
On 15/04/2024 18:30, Florian Fainelli wrote:
I would go a step further and name phy_addr switch_mdio_addr, or something along those lines to clearly denote this is not a per-port PHY address neither a proper PHY device, but we've already had a similar discussion before about spelling this out clearly as a "pseudo PHY"....

I am fine with calling the switch operating on an MDIO bus a psuedo-PHY.
But I don't believe this grants making up names on our own instead of using
the name described in IEEE Std 802.3-2022. The switch listens on a PHY
address on the MDIO bus.

The switch listens at a particular address on the MDIO bus, that is the key thing. Whether the addressable device happens to be an Ethernet/SATA/PCIe/USB PHY, an accelerometer, a light switch or an Ethernet switch does not matter as long as it is addressable over clause 22 and/or 45. For all that matters the switch's MDIO interface is not a PHY, otherwise its registers 0-15 would be abiding by the IEEE 802.3-2022 standard, and that is not the case.

I don't deny anything you've said here. I just don't see how this
constitutes making up a different name. The field which the address is
stored is called "PHYAD (PHY Address)". The PHY Address field of the
management frame structure the switch implements is still Clause 22
conformant, as far as I understand.


The description for the phy_addr member of the
mt753x_info structure clearly explains that so I don't see a reason to
change the variable name.

IMHO it is clearer to use mdiodev->addr through and through, the shorthand is not necessary and does not save that many characters to type in the first place. Saving a mdiodev pointer into mt7530_priv and accessing priv->mdiodev->addr would be 18 characters to type versus 14 with priv->phy_addr.

Fine by me, I can do that.

Arınç