Lines Matching refs:dev
32 struct usbnet *dev = netdev_priv(netdev); in ax88172a_adjust_link() local
33 struct ax88172a_private *priv = dev->driver_priv; in ax88172a_adjust_link()
47 asix_write_medium_mode(dev, mode, 0); in ax88172a_adjust_link()
55 static void ax88172a_status(struct usbnet *dev, struct urb *urb) in ax88172a_status() argument
61 static int ax88172a_init_mdio(struct usbnet *dev) in ax88172a_init_mdio() argument
63 struct ax88172a_private *priv = dev->driver_priv; in ax88172a_init_mdio()
68 netdev_err(dev->net, "Could not allocate MDIO bus\n"); in ax88172a_init_mdio()
72 priv->mdio->priv = (void *)dev; in ax88172a_init_mdio()
78 dev->udev->bus->busnum, dev->udev->devnum); in ax88172a_init_mdio()
82 netdev_err(dev->net, "Could not register MDIO bus\n"); in ax88172a_init_mdio()
86 netdev_info(dev->net, "registered mdio bus %s\n", priv->mdio->id); in ax88172a_init_mdio()
94 static void ax88172a_remove_mdio(struct usbnet *dev) in ax88172a_remove_mdio() argument
96 struct ax88172a_private *priv = dev->driver_priv; in ax88172a_remove_mdio()
98 netdev_info(dev->net, "deregistering mdio bus %s\n", priv->mdio->id); in ax88172a_remove_mdio()
131 static int ax88172a_reset_phy(struct usbnet *dev, int embd_phy) in ax88172a_reset_phy() argument
135 ret = asix_sw_reset(dev, AX_SWRESET_IPPD, 0); in ax88172a_reset_phy()
140 ret = asix_sw_reset(dev, AX_SWRESET_CLEAR, 0); in ax88172a_reset_phy()
146 ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_IPPD, in ax88172a_reset_phy()
158 static int ax88172a_bind(struct usbnet *dev, struct usb_interface *intf) in ax88172a_bind() argument
164 ret = usbnet_get_endpoints(dev, intf); in ax88172a_bind()
172 dev->driver_priv = priv; in ax88172a_bind()
175 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf, 0); in ax88172a_bind()
177 netdev_err(dev->net, "Failed to read MAC address: %d\n", ret); in ax88172a_bind()
181 eth_hw_addr_set(dev->net, buf); in ax88172a_bind()
183 dev->net->netdev_ops = &ax88172a_netdev_ops; in ax88172a_bind()
184 dev->net->ethtool_ops = &ax88172a_ethtool_ops; in ax88172a_bind()
187 ret = asix_read_cmd(dev, AX_CMD_SW_PHY_STATUS, 0, 0, 1, buf, 0); in ax88172a_bind()
189 netdev_err(dev->net, "Failed to read software interface selection register: %d\n", in ax88172a_bind()
194 netdev_dbg(dev->net, "AX_CMD_SW_PHY_STATUS = 0x%02x\n", buf[0]); in ax88172a_bind()
197 netdev_dbg(dev->net, "use internal phy\n"); in ax88172a_bind()
201 netdev_dbg(dev->net, "use external phy\n"); in ax88172a_bind()
205 netdev_err(dev->net, "Interface mode not supported by driver\n"); in ax88172a_bind()
210 ret = asix_read_phy_addr(dev, priv->use_embdphy); in ax88172a_bind()
216 ax88172a_reset_phy(dev, priv->use_embdphy); in ax88172a_bind()
219 if (dev->driver_info->flags & FLAG_FRAMING_AX) { in ax88172a_bind()
222 dev->rx_urb_size = 2048; in ax88172a_bind()
226 ret = ax88172a_init_mdio(dev); in ax88172a_bind()
237 static int ax88172a_stop(struct usbnet *dev) in ax88172a_stop() argument
239 struct ax88172a_private *priv = dev->driver_priv; in ax88172a_stop()
241 netdev_dbg(dev->net, "Stopping interface\n"); in ax88172a_stop()
244 netdev_info(dev->net, "Disconnecting from phy %s\n", in ax88172a_stop()
253 static void ax88172a_unbind(struct usbnet *dev, struct usb_interface *intf) in ax88172a_unbind() argument
255 struct ax88172a_private *priv = dev->driver_priv; in ax88172a_unbind()
257 ax88172a_remove_mdio(dev); in ax88172a_unbind()
261 static int ax88172a_reset(struct usbnet *dev) in ax88172a_reset() argument
263 struct asix_data *data = (struct asix_data *)&dev->data; in ax88172a_reset()
264 struct ax88172a_private *priv = dev->driver_priv; in ax88172a_reset()
268 ax88172a_reset_phy(dev, priv->use_embdphy); in ax88172a_reset()
271 rx_ctl = asix_read_rx_ctl(dev, 0); in ax88172a_reset()
272 netdev_dbg(dev->net, "RX_CTL is 0x%04x after software reset\n", rx_ctl); in ax88172a_reset()
273 ret = asix_write_rx_ctl(dev, 0x0000, 0); in ax88172a_reset()
277 rx_ctl = asix_read_rx_ctl(dev, 0); in ax88172a_reset()
278 netdev_dbg(dev->net, "RX_CTL is 0x%04x setting to 0x0000\n", rx_ctl); in ax88172a_reset()
282 ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, in ax88172a_reset()
286 netdev_err(dev->net, "Write IPG,IPG1,IPG2 failed: %d\n", ret); in ax88172a_reset()
291 memcpy(data->mac_addr, dev->net->dev_addr, ETH_ALEN); in ax88172a_reset()
292 ret = asix_write_cmd(dev, AX_CMD_WRITE_NODE_ID, 0, 0, ETH_ALEN, in ax88172a_reset()
298 ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL, 0); in ax88172a_reset()
302 rx_ctl = asix_read_rx_ctl(dev, 0); in ax88172a_reset()
303 netdev_dbg(dev->net, "RX_CTL is 0x%04x after all initializations\n", in ax88172a_reset()
306 rx_ctl = asix_read_medium_status(dev, 0); in ax88172a_reset()
307 netdev_dbg(dev->net, "Medium Status is 0x%04x after all initializations\n", in ax88172a_reset()
314 priv->phydev = phy_connect(dev->net, priv->phy_name, in ax88172a_reset()
318 netdev_err(dev->net, "Could not connect to PHY device %s\n", in ax88172a_reset()
324 netdev_info(dev->net, "Connected to phy %s\n", priv->phy_name); in ax88172a_reset()
339 static int ax88172a_rx_fixup(struct usbnet *dev, struct sk_buff *skb) in ax88172a_rx_fixup() argument
341 struct ax88172a_private *dp = dev->driver_priv; in ax88172a_rx_fixup()
344 return asix_rx_fixup_internal(dev, skb, rx); in ax88172a_rx_fixup()