Message ID | 26c4eee749db5a5430fa9df9c12651dd34bdbaa6.camel@microchip.com |
---|---|
State | Changes Requested |
Delegated to: | David Miller |
Headers | show |
Series | [net-next,1/8] smsc95xx: check return value of smsc95xx_reset | expand |
> +static int smsc95xx_start_phy(struct usbnet *dev) > +{ > + struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev- > >data[0]); > + struct net_device *net = dev->net; > + int ret; > + > + ret = smsc95xx_reset(dev); > + if (ret < 0) > + return ret; > + > + /* attach the mac to the phy */ > + ret = phy_connect_direct(net, pdata->phydev, > + &smsc95xx_handle_link_change, > + PHY_INTERFACE_MODE_MII); > + if (ret) { > + netdev_err(net, "can't attach PHY to %s\n", pdata- > >mdiobus->id); > + return ret; > + } > + > + phy_attached_info(net->phydev); > + phy_start(net->phydev); > + mii_nway_restart(&dev->mii); Is mii_nway_restart() needed? phy_start will start auto-neg if needed. It looks like after this patch you have a mixture of old MII and new phylib. Does that work? If somebody doing a git bisect was to land on one of these intermediary patches, so they have working Ethernet? Andrew
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index bb4ccbda031a..fbb80a7aef32 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -18,6 +18,8 @@ #include <linux/usb/usbnet.h> #include <linux/slab.h> #include <linux/of_net.h> +#include <linux/mdio.h> +#include <linux/phy.h> #include "smsc95xx.h" #define SMSC_CHIPNAME "smsc95xx" @@ -64,6 +66,8 @@ struct smsc95xx_priv { bool link_ok; struct delayed_work carrier_check; struct usbnet *dev; + struct mii_bus *mdiobus; + struct phy_device *phydev; }; static bool turbo_mode = true; @@ -284,6 +288,22 @@ static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx, __smsc95xx_mdio_write(netdev, phy_id, idx, regval, 0); } +static int smsc95xx_mdiobus_read(struct mii_bus *bus, int phy_id, int idx) +{ + struct usbnet *dev = bus->priv; + + return __smsc95xx_mdio_read(dev->net, phy_id, idx, 0); +} + +static int smsc95xx_mdiobus_write(struct mii_bus *bus, int phy_id, int idx, + u16 regval) +{ + struct usbnet *dev = bus->priv; + + __smsc95xx_mdio_write(dev->net, phy_id, idx, regval, 0); + return 0; +} +