[PATCH] net: ethernet: mtk_eth_soc: implement Clause 45 MDIO access
Andrew Lunn
andrew at lunn.ch
Sun Dec 26 14:26:30 PST 2021
On Sun, Dec 26, 2021 at 09:57:04PM +0000, Russell King (Oracle) wrote:
> On Sun, Dec 26, 2021 at 10:51:08PM +0100, Andrew Lunn wrote:
> > > + if (phy_register & MII_ADDR_C45) {
> > > + u8 dev_num = (phy_register >> 16) & 0x1f;
> > > + u16 reg = (u16)(phy_register & 0xffff);
> >
> > Hi Daniel
> >
> > You can use the helpers
> >
> > mdio_phy_id_is_c45()
> > mdio_phy_id_prtad()
> > mdio_phy_id_devad()
>
> Before someone makes a mistake with this... no, don't use these. These
> are for the userspace MII ioctl API, not for drivers.
Ah, Sorry.
Thanks Russell, i got this wrong. I though there was some helpers for
this, and happened to land on bnxt_hwrm_port_phy_read(), without
checking what it was actually used for.
> The C45 register address can be extracted by masking with
> MII_REGADDR_C45_MASK. The C45 devad can be extracted by shifting right
> by MII_DEVADDR_C45_SHIFT and masking 5 bits. We don't have helpers for
> this.
Maybe we should have helpers.
Andrew
More information about the linux-arm-kernel
mailing list