[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <158876019421.468345.17020929384276599315@kwain>
Date: Wed, 06 May 2020 12:16:35 +0200
From: Antoine Tenart <antoine.tenart@...tlin.com>
To: Michael Walle <michael@...le.cc>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S . Miller" <davem@...emloft.net>,
Vladimir Oltean <vladimir.oltean@....com>,
Michael Walle <michael@...le.cc>
Subject: Re: [PATCH net-next v2 3/3] net: phy: mscc: use phy_package_shared
Hello Michael,
Quoting Michael Walle (2020-05-04 23:31:36)
>
> diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_main.c
> index 5391acdece05..a505286b2195 100644
> --- a/drivers/net/phy/mscc/mscc_main.c
> +++ b/drivers/net/phy/mscc/mscc_main.c
> -static bool vsc8584_is_pkg_init(struct phy_device *phydev, bool reversed)
> +static void vsc8584_get_base_addr(struct phy_device *phydev)
> {
> - struct mii_bus *bus = phydev->mdio.bus;
> - struct vsc8531_private *vsc8531;
> - struct phy_device *phy;
> - int i, addr;
> -
> - /* VSC8584 is a Quad PHY */
> - for (i = 0; i < 4; i++) {
> - vsc8531 = phydev->priv;
> -
> - if (reversed)
> - addr = vsc8531->base_addr - i;
> - else
> - addr = vsc8531->base_addr + i;
> -
> - phy = mdiobus_get_phy(bus, addr);
> - if (!phy)
> - continue;
> + struct vsc8531_private *vsc8531 = phydev->priv;
> + u16 val, addr;
>
> - if ((phy->phy_id & phydev->drv->phy_id_mask) !=
> - (phydev->drv->phy_id & phydev->drv->phy_id_mask))
> - continue;
> + mutex_lock(&phydev->mdio.bus->mdio_lock);
> + __phy_write(phydev, MSCC_EXT_PAGE_ACCESS, MSCC_PHY_PAGE_EXTENDED);
>
> - vsc8531 = phy->priv;
> + addr = __phy_read(phydev, MSCC_PHY_EXT_PHY_CNTL_4);
> + addr >>= PHY_CNTL_4_ADDR_POS;
>
> - if (vsc8531 && vsc8531->pkg_init)
> - return true;
> - }
> + val = __phy_read(phydev, MSCC_PHY_ACTIPHY_CNTL);
You should restore the page to MSCC_PHY_PAGE_STANDARD here.
> + mutex_unlock(&phydev->mdio.bus->mdio_lock);
>
> - return false;
> + if (val & PHY_ADDR_REVERSED)
> + vsc8531->base_addr = phydev->mdio.addr + addr;
> + else
> + vsc8531->base_addr = phydev->mdio.addr - addr;
> }
Thanks for the series!
Antoine
--
Antoine Ténart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists