lkml.org 
[lkml]   [2021]   [Dec]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] net: ethernet: mtk_eth_soc: implement Clause 45 MDIO access
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

\
 
 \ /
  Last update: 2021-12-26 23:27    [W:0.051 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site