[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d338d9e1-3f3e-c6a1-3eea-4614e9c2437e@gmail.com>
Date: Tue, 26 May 2020 09:55:00 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Russell King <rmk+kernel@...linux.org.uk>,
Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
Jeremy Linton <jeremy.linton@....com>
Subject: Re: [PATCH net-next] net: mdiobus: add clause 45 mdiobus accessors
On 5/26/2020 8:29 AM, Russell King wrote:
> There is a recurring pattern throughout some of the PHY code converting
> a devad and regnum to our packed clause 45 representation. Rather than
> having this scattered around the code, let's put a common translation
> function in mdio.h, and provide some register accessors.
>
> Convert the phylib core, phylink, bcm87xx and cortina to use these.
>
> Signed-off-by: Russell King <rmk+kernel@...linux.org.uk>
> ---
[snip]
> --- a/drivers/net/phy/phy-core.c
> +++ b/drivers/net/phy/phy-core.c
> @@ -428,9 +428,8 @@ int __phy_read_mmd(struct phy_device *phydev, int devad, u32 regnum)
This should probably be changed to use u16 regnum in a separate patch.
> if (phydev->drv && phydev->drv->read_mmd) {
> val = phydev->drv->read_mmd(phydev, devad, regnum);
> } else if (phydev->is_c45) {
> - u32 addr = MII_ADDR_C45 | (devad << 16) | (regnum & 0xffff);
> -
> - val = __mdiobus_read(phydev->mdio.bus, phydev->mdio.addr, addr);
> + val = __mdiobus_c45_read(phydev->mdio.bus, phydev->mdio.addr,
> + devad, regnum);
> } else {
> struct mii_bus *bus = phydev->mdio.bus;
> int phy_addr = phydev->mdio.addr;
> @@ -485,10 +484,8 @@ int __phy_write_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val)
and likewise.
Reviewed-by: Florian Fainelli <f.fainelli@...il.com>
--
Florian
Powered by blists - more mailing lists