[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190103133912.GC21849@lunn.ch>
Date: Thu, 3 Jan 2019 14:39:12 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Marek Vasut <marex@...x.de>
Cc: netdev@...r.kernel.org, "David S . Miller" <davem@...emloft.net>,
Nisar Sayed <Nisar.Sayed@...rochip.com>,
Woojung Huh <Woojung.Huh@...rochip.com>,
Florian Fainelli <f.fainelli@...il.com>,
linux-usb@...r.kernel.org
Subject: Re: [PATCH 10/19] usbnet: smsc95xx: Replace smsc95xx_mdio_read()
with phy_read()
> static int get_mdix_status(struct net_device *net)
> {
> struct usbnet *dev = netdev_priv(net);
> + struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
> u32 val;
> int buf;
>
> - buf = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, SPECIAL_CTRL_STS);
> + buf = phy_read(pdata->phydev, SPECIAL_CTRL_STS);
> if (buf & SPECIAL_CTRL_STS_OVRRD_AMDIX_) {
> if (buf & SPECIAL_CTRL_STS_AMDIX_ENABLE_)
> return ETH_TP_MDI_AUTO;
> @@ -793,7 +794,7 @@ static void set_mdix_status(struct net_device *net, __u8 mdix_ctrl)
> (pdata->chip_id == ID_REV_CHIP_ID_89530_) ||
> (pdata->chip_id == ID_REV_CHIP_ID_9730_)) {
> /* Extend Manual AutoMDIX timer for 9500A/9500Ai */
> - buf = smsc95xx_mdio_read(dev->net, dev->mii.phy_id,
> + buf = phy_read(pdata->phydev,
> PHY_EDPD_CONFIG);
> buf |= PHY_EDPD_CONFIG_EXT_CROSSOVER_;
> smsc95xx_mdio_write(dev->net, dev->mii.phy_id,
> @@ -801,7 +802,7 @@ static void set_mdix_status(struct net_device *net, __u8 mdix_ctrl)
> }
>
> if (mdix_ctrl == ETH_TP_MDI) {
> - buf = smsc95xx_mdio_read(dev->net, dev->mii.phy_id,
> + buf = phy_read(pdata->phydev,
> SPECIAL_CTRL_STS);
> buf |= SPECIAL_CTRL_STS_OVRRD_AMDIX_;
> buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ |
> @@ -809,7 +810,7 @@ static void set_mdix_status(struct net_device *net, __u8 mdix_ctrl)
> smsc95xx_mdio_write(dev->net, dev->mii.phy_id,
> SPECIAL_CTRL_STS, buf);
> } else if (mdix_ctrl == ETH_TP_MDI_X) {
> - buf = smsc95xx_mdio_read(dev->net, dev->mii.phy_id,
> + buf = phy_read(pdata->phydev,
> SPECIAL_CTRL_STS);
> buf |= SPECIAL_CTRL_STS_OVRRD_AMDIX_;
> buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ |
> @@ -818,7 +819,7 @@ static void set_mdix_status(struct net_device *net, __u8 mdix_ctrl)
> smsc95xx_mdio_write(dev->net, dev->mii.phy_id,
> SPECIAL_CTRL_STS, buf);
> } else if (mdix_ctrl == ETH_TP_MDI_AUTO) {
> - buf = smsc95xx_mdio_read(dev->net, dev->mii.phy_id,
> + buf = phy_read(pdata->phydev,
> SPECIAL_CTRL_STS);
> buf &= ~SPECIAL_CTRL_STS_OVRRD_AMDIX_;
> buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ |
> @@ -968,6 +969,7 @@ static void smsc95xx_adjust_link(struct net_device *netdev)
All this crossover code should be moved into the PHY driver.
Andrew
Powered by blists - more mailing lists