lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190103011040.25974-13-marex@denx.de>
Date:   Thu,  3 Jan 2019 02:10:33 +0100
From:   Marek Vasut <marex@...x.de>
To:     netdev@...r.kernel.org
Cc:     Marek Vasut <marex@...x.de>,
        "David S . Miller" <davem@...emloft.net>,
        Nisar Sayed <Nisar.Sayed@...rochip.com>,
        Woojung Huh <Woojung.Huh@...rochip.com>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        linux-usb@...r.kernel.org
Subject: [PATCH 12/19] usbnet: smsc95xx: Replace ad-hoc PHY functions with generic ones

Replace the ad-hoc reimplementation of genphy_soft_reset() and
genphy_config_aneg() with the generic functions.

Signed-off-by: Marek Vasut <marex@...x.de>
Cc: David S. Miller <davem@...emloft.net>
Cc: Nisar Sayed <Nisar.Sayed@...rochip.com>
Cc: Woojung Huh <Woojung.Huh@...rochip.com>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: Florian Fainelli <f.fainelli@...il.com>
Cc: linux-usb@...r.kernel.org
To: netdev@...r.kernel.org
---
 drivers/net/usb/smsc95xx.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index c1e59813c1fc..fa33eda61275 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -970,25 +970,16 @@ static void smsc95xx_adjust_link(struct net_device *netdev)
 static int smsc95xx_phy_initialize(struct usbnet *dev)
 {
 	struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
-	int bmcr, ret, timeout = 0;
+	int ret;
 
 	/* reset phy and wait for reset to complete */
-	phy_write(pdata->phydev, MII_BMCR, BMCR_RESET);
-
-	do {
-		msleep(10);
-		bmcr = phy_read(pdata->phydev, MII_BMCR);
-		timeout++;
-	} while ((bmcr & BMCR_RESET) && (timeout < 100));
-
-	if (timeout >= 100) {
-		netdev_warn(dev->net, "timeout on PHY Reset");
-		return -EIO;
-	}
+	ret = genphy_soft_reset(pdata->phydev);
+	if (ret)
+		return ret;
 
-	phy_write(pdata->phydev, MII_ADVERTISE,
-		ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP |
-		ADVERTISE_PAUSE_ASYM);
+	ret = genphy_config_aneg(pdata->phydev);
+	if (ret)
+		return ret;
 
 	/* read to clear */
 	ret = phy_read(pdata->phydev, PHY_INT_SRC);
-- 
2.19.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ