[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200723115507.26194-6-andre.edich@microchip.com>
Date: Thu, 23 Jul 2020 13:55:06 +0200
From: Andre Edich <andre.edich@...rochip.com>
To: <netdev@...r.kernel.org>, <UNGLinuxDriver@...rochip.com>,
<steve.glendinning@...well.net>
CC: <Parthiban.Veerasooran@...rochip.com>,
Andre Edich <andre.edich@...rochip.com>
Subject: [PATCH net-next v2 5/6] smsc95xx: use PAL framework read/write functions
Use functions phy_read and phy_write instead of smsc95xx_mdio_read and
smsc95xx_mdio_write respectively.
Signed-off-by: Andre Edich <andre.edich@...rochip.com>
---
drivers/net/usb/smsc95xx.c | 43 +++++++++++++++-----------------------
1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 8731724bf2c5..8add7109e661 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -582,22 +582,20 @@ static int smsc95xx_link_reset(struct usbnet *dev)
if (pdata->internal_phy) {
/* clear interrupt status */
- ret = smsc95xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
+ ret = phy_read(pdata->phydev, PHY_INT_SRC);
if (ret < 0)
return ret;
- smsc95xx_mdio_write(dev->net, mii->phy_id, PHY_INT_MASK,
- PHY_INT_MASK_DEFAULT_);
+ ret = phy_write(pdata->phydev, PHY_INT_MASK,
+ PHY_INT_MASK_DEFAULT_);
+ if (ret < 0)
+ return ret;
}
mii_check_media(mii, 1, 1);
mii_ethtool_gset(&dev->mii, &ecmd);
- lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
- rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA);
-
- netif_dbg(dev, link, dev->net,
- "speed: %u duplex: %d lcladv: %04x rmtadv: %04x\n",
- ethtool_cmd_speed(&ecmd), ecmd.duplex, lcladv, rmtadv);
+ lcladv = phy_read(pdata->phydev, MII_ADVERTISE);
+ rmtadv = phy_read(pdata->phydev, MII_LPA);
spin_lock_irqsave(&pdata->mac_cr_lock, flags);
if (ecmd.duplex != DUPLEX_FULL) {
@@ -761,10 +759,11 @@ static int smsc95xx_ethtool_set_wol(struct net_device *net,
static int get_mdix_status(struct net_device *net)
{
struct usbnet *dev = netdev_priv(net);
+ struct smsc95xx_priv *pdata = dev->driver_priv;
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;
@@ -790,39 +789,31 @@ 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,
- PHY_EDPD_CONFIG);
+ buf = phy_read(pdata->phydev, PHY_EDPD_CONFIG);
buf |= PHY_EDPD_CONFIG_EXT_CROSSOVER_;
- smsc95xx_mdio_write(dev->net, dev->mii.phy_id,
- PHY_EDPD_CONFIG, buf);
+ phy_write(pdata->phydev, PHY_EDPD_CONFIG, buf);
}
if (mdix_ctrl == ETH_TP_MDI) {
- buf = smsc95xx_mdio_read(dev->net, dev->mii.phy_id,
- SPECIAL_CTRL_STS);
+ buf = phy_read(pdata->phydev, SPECIAL_CTRL_STS);
buf |= SPECIAL_CTRL_STS_OVRRD_AMDIX_;
buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ |
SPECIAL_CTRL_STS_AMDIX_STATE_);
- smsc95xx_mdio_write(dev->net, dev->mii.phy_id,
- SPECIAL_CTRL_STS, buf);
+ phy_write(pdata->phydev, SPECIAL_CTRL_STS, buf);
} else if (mdix_ctrl == ETH_TP_MDI_X) {
- buf = smsc95xx_mdio_read(dev->net, dev->mii.phy_id,
- SPECIAL_CTRL_STS);
+ buf = phy_read(pdata->phydev, SPECIAL_CTRL_STS);
buf |= SPECIAL_CTRL_STS_OVRRD_AMDIX_;
buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ |
SPECIAL_CTRL_STS_AMDIX_STATE_);
buf |= SPECIAL_CTRL_STS_AMDIX_STATE_;
- smsc95xx_mdio_write(dev->net, dev->mii.phy_id,
- SPECIAL_CTRL_STS, buf);
+ phy_write(pdata->phydev, SPECIAL_CTRL_STS, buf);
} else if (mdix_ctrl == ETH_TP_MDI_AUTO) {
- buf = smsc95xx_mdio_read(dev->net, dev->mii.phy_id,
- SPECIAL_CTRL_STS);
+ buf = phy_read(pdata->phydev, SPECIAL_CTRL_STS);
buf &= ~SPECIAL_CTRL_STS_OVRRD_AMDIX_;
buf &= ~(SPECIAL_CTRL_STS_AMDIX_ENABLE_ |
SPECIAL_CTRL_STS_AMDIX_STATE_);
buf |= SPECIAL_CTRL_STS_AMDIX_ENABLE_;
- smsc95xx_mdio_write(dev->net, dev->mii.phy_id,
- SPECIAL_CTRL_STS, buf);
+ phy_write(pdata->phydev, SPECIAL_CTRL_STS, buf);
}
pdata->mdix_ctrl = mdix_ctrl;
}
--
2.27.0
Powered by blists - more mailing lists