Linux 2.6.33-rc8
[linux-2.6/lguest.git] / drivers / net / usb / smsc95xx.c
blob0c3c738d741912339e35489c03184cba53c27ace
1 /***************************************************************************
3 * Copyright (C) 2007-2008 SMSC
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *****************************************************************************/
21 #include <linux/module.h>
22 #include <linux/kmod.h>
23 #include <linux/init.h>
24 #include <linux/netdevice.h>
25 #include <linux/etherdevice.h>
26 #include <linux/ethtool.h>
27 #include <linux/mii.h>
28 #include <linux/usb.h>
29 #include <linux/crc32.h>
30 #include <linux/usb/usbnet.h>
31 #include "smsc95xx.h"
33 #define SMSC_CHIPNAME "smsc95xx"
34 #define SMSC_DRIVER_VERSION "1.0.4"
35 #define HS_USB_PKT_SIZE (512)
36 #define FS_USB_PKT_SIZE (64)
37 #define DEFAULT_HS_BURST_CAP_SIZE (16 * 1024 + 5 * HS_USB_PKT_SIZE)
38 #define DEFAULT_FS_BURST_CAP_SIZE (6 * 1024 + 33 * FS_USB_PKT_SIZE)
39 #define DEFAULT_BULK_IN_DELAY (0x00002000)
40 #define MAX_SINGLE_PACKET_SIZE (2048)
41 #define LAN95XX_EEPROM_MAGIC (0x9500)
42 #define EEPROM_MAC_OFFSET (0x01)
43 #define DEFAULT_TX_CSUM_ENABLE (true)
44 #define DEFAULT_RX_CSUM_ENABLE (true)
45 #define SMSC95XX_INTERNAL_PHY_ID (1)
46 #define SMSC95XX_TX_OVERHEAD (8)
47 #define SMSC95XX_TX_OVERHEAD_CSUM (12)
49 struct smsc95xx_priv {
50 u32 mac_cr;
51 spinlock_t mac_cr_lock;
52 bool use_tx_csum;
53 bool use_rx_csum;
56 struct usb_context {
57 struct usb_ctrlrequest req;
58 struct usbnet *dev;
61 static int turbo_mode = true;
62 module_param(turbo_mode, bool, 0644);
63 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
65 static int smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data)
67 u32 *buf = kmalloc(4, GFP_KERNEL);
68 int ret;
70 BUG_ON(!dev);
72 if (!buf)
73 return -ENOMEM;
75 ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
76 USB_VENDOR_REQUEST_READ_REGISTER,
77 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
78 00, index, buf, 4, USB_CTRL_GET_TIMEOUT);
80 if (unlikely(ret < 0))
81 devwarn(dev, "Failed to read register index 0x%08x", index);
83 le32_to_cpus(buf);
84 *data = *buf;
85 kfree(buf);
87 return ret;
90 static int smsc95xx_write_reg(struct usbnet *dev, u32 index, u32 data)
92 u32 *buf = kmalloc(4, GFP_KERNEL);
93 int ret;
95 BUG_ON(!dev);
97 if (!buf)
98 return -ENOMEM;
100 *buf = data;
101 cpu_to_le32s(buf);
103 ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
104 USB_VENDOR_REQUEST_WRITE_REGISTER,
105 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
106 00, index, buf, 4, USB_CTRL_SET_TIMEOUT);
108 if (unlikely(ret < 0))
109 devwarn(dev, "Failed to write register index 0x%08x", index);
111 kfree(buf);
113 return ret;
116 /* Loop until the read is completed with timeout
117 * called with phy_mutex held */
118 static int smsc95xx_phy_wait_not_busy(struct usbnet *dev)
120 unsigned long start_time = jiffies;
121 u32 val;
123 do {
124 smsc95xx_read_reg(dev, MII_ADDR, &val);
125 if (!(val & MII_BUSY_))
126 return 0;
127 } while (!time_after(jiffies, start_time + HZ));
129 return -EIO;
132 static int smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx)
134 struct usbnet *dev = netdev_priv(netdev);
135 u32 val, addr;
137 mutex_lock(&dev->phy_mutex);
139 /* confirm MII not busy */
140 if (smsc95xx_phy_wait_not_busy(dev)) {
141 devwarn(dev, "MII is busy in smsc95xx_mdio_read");
142 mutex_unlock(&dev->phy_mutex);
143 return -EIO;
146 /* set the address, index & direction (read from PHY) */
147 phy_id &= dev->mii.phy_id_mask;
148 idx &= dev->mii.reg_num_mask;
149 addr = (phy_id << 11) | (idx << 6) | MII_READ_;
150 smsc95xx_write_reg(dev, MII_ADDR, addr);
152 if (smsc95xx_phy_wait_not_busy(dev)) {
153 devwarn(dev, "Timed out reading MII reg %02X", idx);
154 mutex_unlock(&dev->phy_mutex);
155 return -EIO;
158 smsc95xx_read_reg(dev, MII_DATA, &val);
160 mutex_unlock(&dev->phy_mutex);
162 return (u16)(val & 0xFFFF);
165 static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx,
166 int regval)
168 struct usbnet *dev = netdev_priv(netdev);
169 u32 val, addr;
171 mutex_lock(&dev->phy_mutex);
173 /* confirm MII not busy */
174 if (smsc95xx_phy_wait_not_busy(dev)) {
175 devwarn(dev, "MII is busy in smsc95xx_mdio_write");
176 mutex_unlock(&dev->phy_mutex);
177 return;
180 val = regval;
181 smsc95xx_write_reg(dev, MII_DATA, val);
183 /* set the address, index & direction (write to PHY) */
184 phy_id &= dev->mii.phy_id_mask;
185 idx &= dev->mii.reg_num_mask;
186 addr = (phy_id << 11) | (idx << 6) | MII_WRITE_;
187 smsc95xx_write_reg(dev, MII_ADDR, addr);
189 if (smsc95xx_phy_wait_not_busy(dev))
190 devwarn(dev, "Timed out writing MII reg %02X", idx);
192 mutex_unlock(&dev->phy_mutex);
195 static int smsc95xx_wait_eeprom(struct usbnet *dev)
197 unsigned long start_time = jiffies;
198 u32 val;
200 do {
201 smsc95xx_read_reg(dev, E2P_CMD, &val);
202 if (!(val & E2P_CMD_BUSY_) || (val & E2P_CMD_TIMEOUT_))
203 break;
204 udelay(40);
205 } while (!time_after(jiffies, start_time + HZ));
207 if (val & (E2P_CMD_TIMEOUT_ | E2P_CMD_BUSY_)) {
208 devwarn(dev, "EEPROM read operation timeout");
209 return -EIO;
212 return 0;
215 static int smsc95xx_eeprom_confirm_not_busy(struct usbnet *dev)
217 unsigned long start_time = jiffies;
218 u32 val;
220 do {
221 smsc95xx_read_reg(dev, E2P_CMD, &val);
223 if (!(val & E2P_CMD_BUSY_))
224 return 0;
226 udelay(40);
227 } while (!time_after(jiffies, start_time + HZ));
229 devwarn(dev, "EEPROM is busy");
230 return -EIO;
233 static int smsc95xx_read_eeprom(struct usbnet *dev, u32 offset, u32 length,
234 u8 *data)
236 u32 val;
237 int i, ret;
239 BUG_ON(!dev);
240 BUG_ON(!data);
242 ret = smsc95xx_eeprom_confirm_not_busy(dev);
243 if (ret)
244 return ret;
246 for (i = 0; i < length; i++) {
247 val = E2P_CMD_BUSY_ | E2P_CMD_READ_ | (offset & E2P_CMD_ADDR_);
248 smsc95xx_write_reg(dev, E2P_CMD, val);
250 ret = smsc95xx_wait_eeprom(dev);
251 if (ret < 0)
252 return ret;
254 smsc95xx_read_reg(dev, E2P_DATA, &val);
256 data[i] = val & 0xFF;
257 offset++;
260 return 0;
263 static int smsc95xx_write_eeprom(struct usbnet *dev, u32 offset, u32 length,
264 u8 *data)
266 u32 val;
267 int i, ret;
269 BUG_ON(!dev);
270 BUG_ON(!data);
272 ret = smsc95xx_eeprom_confirm_not_busy(dev);
273 if (ret)
274 return ret;
276 /* Issue write/erase enable command */
277 val = E2P_CMD_BUSY_ | E2P_CMD_EWEN_;
278 smsc95xx_write_reg(dev, E2P_CMD, val);
280 ret = smsc95xx_wait_eeprom(dev);
281 if (ret < 0)
282 return ret;
284 for (i = 0; i < length; i++) {
286 /* Fill data register */
287 val = data[i];
288 smsc95xx_write_reg(dev, E2P_DATA, val);
290 /* Send "write" command */
291 val = E2P_CMD_BUSY_ | E2P_CMD_WRITE_ | (offset & E2P_CMD_ADDR_);
292 smsc95xx_write_reg(dev, E2P_CMD, val);
294 ret = smsc95xx_wait_eeprom(dev);
295 if (ret < 0)
296 return ret;
298 offset++;
301 return 0;
304 static void smsc95xx_async_cmd_callback(struct urb *urb)
306 struct usb_context *usb_context = urb->context;
307 struct usbnet *dev = usb_context->dev;
308 int status = urb->status;
310 if (status < 0)
311 devwarn(dev, "async callback failed with %d", status);
313 kfree(usb_context);
314 usb_free_urb(urb);
317 static int smsc95xx_write_reg_async(struct usbnet *dev, u16 index, u32 *data)
319 struct usb_context *usb_context;
320 int status;
321 struct urb *urb;
322 const u16 size = 4;
324 urb = usb_alloc_urb(0, GFP_ATOMIC);
325 if (!urb) {
326 devwarn(dev, "Error allocating URB");
327 return -ENOMEM;
330 usb_context = kmalloc(sizeof(struct usb_context), GFP_ATOMIC);
331 if (usb_context == NULL) {
332 devwarn(dev, "Error allocating control msg");
333 usb_free_urb(urb);
334 return -ENOMEM;
337 usb_context->req.bRequestType =
338 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE;
339 usb_context->req.bRequest = USB_VENDOR_REQUEST_WRITE_REGISTER;
340 usb_context->req.wValue = 00;
341 usb_context->req.wIndex = cpu_to_le16(index);
342 usb_context->req.wLength = cpu_to_le16(size);
344 usb_fill_control_urb(urb, dev->udev, usb_sndctrlpipe(dev->udev, 0),
345 (void *)&usb_context->req, data, size,
346 smsc95xx_async_cmd_callback,
347 (void *)usb_context);
349 status = usb_submit_urb(urb, GFP_ATOMIC);
350 if (status < 0) {
351 devwarn(dev, "Error submitting control msg, sts=%d", status);
352 kfree(usb_context);
353 usb_free_urb(urb);
356 return status;
359 /* returns hash bit number for given MAC address
360 * example:
361 * 01 00 5E 00 00 01 -> returns bit number 31 */
362 static unsigned int smsc95xx_hash(char addr[ETH_ALEN])
364 return (ether_crc(ETH_ALEN, addr) >> 26) & 0x3f;
367 static void smsc95xx_set_multicast(struct net_device *netdev)
369 struct usbnet *dev = netdev_priv(netdev);
370 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
371 u32 hash_hi = 0;
372 u32 hash_lo = 0;
373 unsigned long flags;
375 spin_lock_irqsave(&pdata->mac_cr_lock, flags);
377 if (dev->net->flags & IFF_PROMISC) {
378 if (netif_msg_drv(dev))
379 devdbg(dev, "promiscuous mode enabled");
380 pdata->mac_cr |= MAC_CR_PRMS_;
381 pdata->mac_cr &= ~(MAC_CR_MCPAS_ | MAC_CR_HPFILT_);
382 } else if (dev->net->flags & IFF_ALLMULTI) {
383 if (netif_msg_drv(dev))
384 devdbg(dev, "receive all multicast enabled");
385 pdata->mac_cr |= MAC_CR_MCPAS_;
386 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_);
387 } else if (dev->net->mc_count > 0) {
388 struct dev_mc_list *mc_list = dev->net->mc_list;
389 int count = 0;
391 pdata->mac_cr |= MAC_CR_HPFILT_;
392 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_);
394 while (mc_list) {
395 count++;
396 if (mc_list->dmi_addrlen == ETH_ALEN) {
397 u32 bitnum = smsc95xx_hash(mc_list->dmi_addr);
398 u32 mask = 0x01 << (bitnum & 0x1F);
399 if (bitnum & 0x20)
400 hash_hi |= mask;
401 else
402 hash_lo |= mask;
403 } else {
404 devwarn(dev, "dmi_addrlen != 6");
406 mc_list = mc_list->next;
409 if (count != ((u32)dev->net->mc_count))
410 devwarn(dev, "mc_count != dev->mc_count");
412 if (netif_msg_drv(dev))
413 devdbg(dev, "HASHH=0x%08X, HASHL=0x%08X", hash_hi,
414 hash_lo);
415 } else {
416 if (netif_msg_drv(dev))
417 devdbg(dev, "receive own packets only");
418 pdata->mac_cr &=
419 ~(MAC_CR_PRMS_ | MAC_CR_MCPAS_ | MAC_CR_HPFILT_);
422 spin_unlock_irqrestore(&pdata->mac_cr_lock, flags);
424 /* Initiate async writes, as we can't wait for completion here */
425 smsc95xx_write_reg_async(dev, HASHH, &hash_hi);
426 smsc95xx_write_reg_async(dev, HASHL, &hash_lo);
427 smsc95xx_write_reg_async(dev, MAC_CR, &pdata->mac_cr);
430 static void smsc95xx_phy_update_flowcontrol(struct usbnet *dev, u8 duplex,
431 u16 lcladv, u16 rmtadv)
433 u32 flow, afc_cfg = 0;
435 int ret = smsc95xx_read_reg(dev, AFC_CFG, &afc_cfg);
436 if (ret < 0) {
437 devwarn(dev, "error reading AFC_CFG");
438 return;
441 if (duplex == DUPLEX_FULL) {
442 u8 cap = mii_resolve_flowctrl_fdx(lcladv, rmtadv);
444 if (cap & FLOW_CTRL_RX)
445 flow = 0xFFFF0002;
446 else
447 flow = 0;
449 if (cap & FLOW_CTRL_TX)
450 afc_cfg |= 0xF;
451 else
452 afc_cfg &= ~0xF;
454 if (netif_msg_link(dev))
455 devdbg(dev, "rx pause %s, tx pause %s",
456 (cap & FLOW_CTRL_RX ? "enabled" : "disabled"),
457 (cap & FLOW_CTRL_TX ? "enabled" : "disabled"));
458 } else {
459 if (netif_msg_link(dev))
460 devdbg(dev, "half duplex");
461 flow = 0;
462 afc_cfg |= 0xF;
465 smsc95xx_write_reg(dev, FLOW, flow);
466 smsc95xx_write_reg(dev, AFC_CFG, afc_cfg);
469 static int smsc95xx_link_reset(struct usbnet *dev)
471 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
472 struct mii_if_info *mii = &dev->mii;
473 struct ethtool_cmd ecmd;
474 unsigned long flags;
475 u16 lcladv, rmtadv;
476 u32 intdata;
478 /* clear interrupt status */
479 smsc95xx_mdio_read(dev->net, mii->phy_id, PHY_INT_SRC);
480 intdata = 0xFFFFFFFF;
481 smsc95xx_write_reg(dev, INT_STS, intdata);
483 mii_check_media(mii, 1, 1);
484 mii_ethtool_gset(&dev->mii, &ecmd);
485 lcladv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_ADVERTISE);
486 rmtadv = smsc95xx_mdio_read(dev->net, mii->phy_id, MII_LPA);
488 if (netif_msg_link(dev))
489 devdbg(dev, "speed: %d duplex: %d lcladv: %04x rmtadv: %04x",
490 ecmd.speed, ecmd.duplex, lcladv, rmtadv);
492 spin_lock_irqsave(&pdata->mac_cr_lock, flags);
493 if (ecmd.duplex != DUPLEX_FULL) {
494 pdata->mac_cr &= ~MAC_CR_FDPX_;
495 pdata->mac_cr |= MAC_CR_RCVOWN_;
496 } else {
497 pdata->mac_cr &= ~MAC_CR_RCVOWN_;
498 pdata->mac_cr |= MAC_CR_FDPX_;
500 spin_unlock_irqrestore(&pdata->mac_cr_lock, flags);
502 smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr);
504 smsc95xx_phy_update_flowcontrol(dev, ecmd.duplex, lcladv, rmtadv);
506 return 0;
509 static void smsc95xx_status(struct usbnet *dev, struct urb *urb)
511 u32 intdata;
513 if (urb->actual_length != 4) {
514 devwarn(dev, "unexpected urb length %d", urb->actual_length);
515 return;
518 memcpy(&intdata, urb->transfer_buffer, 4);
519 le32_to_cpus(&intdata);
521 if (netif_msg_link(dev))
522 devdbg(dev, "intdata: 0x%08X", intdata);
524 if (intdata & INT_ENP_PHY_INT_)
525 usbnet_defer_kevent(dev, EVENT_LINK_RESET);
526 else
527 devwarn(dev, "unexpected interrupt, intdata=0x%08X", intdata);
530 /* Enable or disable Tx & Rx checksum offload engines */
531 static int smsc95xx_set_csums(struct usbnet *dev)
533 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
534 u32 read_buf;
535 int ret = smsc95xx_read_reg(dev, COE_CR, &read_buf);
536 if (ret < 0) {
537 devwarn(dev, "Failed to read COE_CR: %d", ret);
538 return ret;
541 if (pdata->use_tx_csum)
542 read_buf |= Tx_COE_EN_;
543 else
544 read_buf &= ~Tx_COE_EN_;
546 if (pdata->use_rx_csum)
547 read_buf |= Rx_COE_EN_;
548 else
549 read_buf &= ~Rx_COE_EN_;
551 ret = smsc95xx_write_reg(dev, COE_CR, read_buf);
552 if (ret < 0) {
553 devwarn(dev, "Failed to write COE_CR: %d", ret);
554 return ret;
557 if (netif_msg_hw(dev))
558 devdbg(dev, "COE_CR = 0x%08x", read_buf);
559 return 0;
562 static int smsc95xx_ethtool_get_eeprom_len(struct net_device *net)
564 return MAX_EEPROM_SIZE;
567 static int smsc95xx_ethtool_get_eeprom(struct net_device *netdev,
568 struct ethtool_eeprom *ee, u8 *data)
570 struct usbnet *dev = netdev_priv(netdev);
572 ee->magic = LAN95XX_EEPROM_MAGIC;
574 return smsc95xx_read_eeprom(dev, ee->offset, ee->len, data);
577 static int smsc95xx_ethtool_set_eeprom(struct net_device *netdev,
578 struct ethtool_eeprom *ee, u8 *data)
580 struct usbnet *dev = netdev_priv(netdev);
582 if (ee->magic != LAN95XX_EEPROM_MAGIC) {
583 devwarn(dev, "EEPROM: magic value mismatch, magic = 0x%x",
584 ee->magic);
585 return -EINVAL;
588 return smsc95xx_write_eeprom(dev, ee->offset, ee->len, data);
591 static u32 smsc95xx_ethtool_get_rx_csum(struct net_device *netdev)
593 struct usbnet *dev = netdev_priv(netdev);
594 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
596 return pdata->use_rx_csum;
599 static int smsc95xx_ethtool_set_rx_csum(struct net_device *netdev, u32 val)
601 struct usbnet *dev = netdev_priv(netdev);
602 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
604 pdata->use_rx_csum = !!val;
606 return smsc95xx_set_csums(dev);
609 static u32 smsc95xx_ethtool_get_tx_csum(struct net_device *netdev)
611 struct usbnet *dev = netdev_priv(netdev);
612 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
614 return pdata->use_tx_csum;
617 static int smsc95xx_ethtool_set_tx_csum(struct net_device *netdev, u32 val)
619 struct usbnet *dev = netdev_priv(netdev);
620 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
622 pdata->use_tx_csum = !!val;
624 ethtool_op_set_tx_hw_csum(netdev, pdata->use_tx_csum);
625 return smsc95xx_set_csums(dev);
628 static const struct ethtool_ops smsc95xx_ethtool_ops = {
629 .get_link = usbnet_get_link,
630 .nway_reset = usbnet_nway_reset,
631 .get_drvinfo = usbnet_get_drvinfo,
632 .get_msglevel = usbnet_get_msglevel,
633 .set_msglevel = usbnet_set_msglevel,
634 .get_settings = usbnet_get_settings,
635 .set_settings = usbnet_set_settings,
636 .get_eeprom_len = smsc95xx_ethtool_get_eeprom_len,
637 .get_eeprom = smsc95xx_ethtool_get_eeprom,
638 .set_eeprom = smsc95xx_ethtool_set_eeprom,
639 .get_tx_csum = smsc95xx_ethtool_get_tx_csum,
640 .set_tx_csum = smsc95xx_ethtool_set_tx_csum,
641 .get_rx_csum = smsc95xx_ethtool_get_rx_csum,
642 .set_rx_csum = smsc95xx_ethtool_set_rx_csum,
645 static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
647 struct usbnet *dev = netdev_priv(netdev);
649 if (!netif_running(netdev))
650 return -EINVAL;
652 return generic_mii_ioctl(&dev->mii, if_mii(rq), cmd, NULL);
655 static void smsc95xx_init_mac_address(struct usbnet *dev)
657 /* try reading mac address from EEPROM */
658 if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
659 dev->net->dev_addr) == 0) {
660 if (is_valid_ether_addr(dev->net->dev_addr)) {
661 /* eeprom values are valid so use them */
662 if (netif_msg_ifup(dev))
663 devdbg(dev, "MAC address read from EEPROM");
664 return;
668 /* no eeprom, or eeprom values are invalid. generate random MAC */
669 random_ether_addr(dev->net->dev_addr);
670 if (netif_msg_ifup(dev))
671 devdbg(dev, "MAC address set to random_ether_addr");
674 static int smsc95xx_set_mac_address(struct usbnet *dev)
676 u32 addr_lo = dev->net->dev_addr[0] | dev->net->dev_addr[1] << 8 |
677 dev->net->dev_addr[2] << 16 | dev->net->dev_addr[3] << 24;
678 u32 addr_hi = dev->net->dev_addr[4] | dev->net->dev_addr[5] << 8;
679 int ret;
681 ret = smsc95xx_write_reg(dev, ADDRL, addr_lo);
682 if (ret < 0) {
683 devwarn(dev, "Failed to write ADDRL: %d", ret);
684 return ret;
687 ret = smsc95xx_write_reg(dev, ADDRH, addr_hi);
688 if (ret < 0) {
689 devwarn(dev, "Failed to write ADDRH: %d", ret);
690 return ret;
693 return 0;
696 /* starts the TX path */
697 static void smsc95xx_start_tx_path(struct usbnet *dev)
699 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
700 unsigned long flags;
701 u32 reg_val;
703 /* Enable Tx at MAC */
704 spin_lock_irqsave(&pdata->mac_cr_lock, flags);
705 pdata->mac_cr |= MAC_CR_TXEN_;
706 spin_unlock_irqrestore(&pdata->mac_cr_lock, flags);
708 smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr);
710 /* Enable Tx at SCSRs */
711 reg_val = TX_CFG_ON_;
712 smsc95xx_write_reg(dev, TX_CFG, reg_val);
715 /* Starts the Receive path */
716 static void smsc95xx_start_rx_path(struct usbnet *dev)
718 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
719 unsigned long flags;
721 spin_lock_irqsave(&pdata->mac_cr_lock, flags);
722 pdata->mac_cr |= MAC_CR_RXEN_;
723 spin_unlock_irqrestore(&pdata->mac_cr_lock, flags);
725 smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr);
728 static int smsc95xx_phy_initialize(struct usbnet *dev)
730 /* Initialize MII structure */
731 dev->mii.dev = dev->net;
732 dev->mii.mdio_read = smsc95xx_mdio_read;
733 dev->mii.mdio_write = smsc95xx_mdio_write;
734 dev->mii.phy_id_mask = 0x1f;
735 dev->mii.reg_num_mask = 0x1f;
736 dev->mii.phy_id = SMSC95XX_INTERNAL_PHY_ID;
738 smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
739 smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
740 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP |
741 ADVERTISE_PAUSE_ASYM);
743 /* read to clear */
744 smsc95xx_mdio_read(dev->net, dev->mii.phy_id, PHY_INT_SRC);
746 smsc95xx_mdio_write(dev->net, dev->mii.phy_id, PHY_INT_MASK,
747 PHY_INT_MASK_DEFAULT_);
748 mii_nway_restart(&dev->mii);
750 if (netif_msg_ifup(dev))
751 devdbg(dev, "phy initialised successfully");
752 return 0;
755 static int smsc95xx_reset(struct usbnet *dev)
757 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
758 struct net_device *netdev = dev->net;
759 u32 read_buf, write_buf, burst_cap;
760 int ret = 0, timeout;
762 if (netif_msg_ifup(dev))
763 devdbg(dev, "entering smsc95xx_reset");
765 write_buf = HW_CFG_LRST_;
766 ret = smsc95xx_write_reg(dev, HW_CFG, write_buf);
767 if (ret < 0) {
768 devwarn(dev, "Failed to write HW_CFG_LRST_ bit in HW_CFG "
769 "register, ret = %d", ret);
770 return ret;
773 timeout = 0;
774 do {
775 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
776 if (ret < 0) {
777 devwarn(dev, "Failed to read HW_CFG: %d", ret);
778 return ret;
780 msleep(10);
781 timeout++;
782 } while ((read_buf & HW_CFG_LRST_) && (timeout < 100));
784 if (timeout >= 100) {
785 devwarn(dev, "timeout waiting for completion of Lite Reset");
786 return ret;
789 write_buf = PM_CTL_PHY_RST_;
790 ret = smsc95xx_write_reg(dev, PM_CTRL, write_buf);
791 if (ret < 0) {
792 devwarn(dev, "Failed to write PM_CTRL: %d", ret);
793 return ret;
796 timeout = 0;
797 do {
798 ret = smsc95xx_read_reg(dev, PM_CTRL, &read_buf);
799 if (ret < 0) {
800 devwarn(dev, "Failed to read PM_CTRL: %d", ret);
801 return ret;
803 msleep(10);
804 timeout++;
805 } while ((read_buf & PM_CTL_PHY_RST_) && (timeout < 100));
807 if (timeout >= 100) {
808 devwarn(dev, "timeout waiting for PHY Reset");
809 return ret;
812 smsc95xx_init_mac_address(dev);
814 ret = smsc95xx_set_mac_address(dev);
815 if (ret < 0)
816 return ret;
818 if (netif_msg_ifup(dev))
819 devdbg(dev, "MAC Address: %pM", dev->net->dev_addr);
821 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
822 if (ret < 0) {
823 devwarn(dev, "Failed to read HW_CFG: %d", ret);
824 return ret;
827 if (netif_msg_ifup(dev))
828 devdbg(dev, "Read Value from HW_CFG : 0x%08x", read_buf);
830 read_buf |= HW_CFG_BIR_;
832 ret = smsc95xx_write_reg(dev, HW_CFG, read_buf);
833 if (ret < 0) {
834 devwarn(dev, "Failed to write HW_CFG_BIR_ bit in HW_CFG "
835 "register, ret = %d", ret);
836 return ret;
839 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
840 if (ret < 0) {
841 devwarn(dev, "Failed to read HW_CFG: %d", ret);
842 return ret;
844 if (netif_msg_ifup(dev))
845 devdbg(dev, "Read Value from HW_CFG after writing "
846 "HW_CFG_BIR_: 0x%08x", read_buf);
848 if (!turbo_mode) {
849 burst_cap = 0;
850 dev->rx_urb_size = MAX_SINGLE_PACKET_SIZE;
851 } else if (dev->udev->speed == USB_SPEED_HIGH) {
852 burst_cap = DEFAULT_HS_BURST_CAP_SIZE / HS_USB_PKT_SIZE;
853 dev->rx_urb_size = DEFAULT_HS_BURST_CAP_SIZE;
854 } else {
855 burst_cap = DEFAULT_FS_BURST_CAP_SIZE / FS_USB_PKT_SIZE;
856 dev->rx_urb_size = DEFAULT_FS_BURST_CAP_SIZE;
859 if (netif_msg_ifup(dev))
860 devdbg(dev, "rx_urb_size=%ld", (ulong)dev->rx_urb_size);
862 ret = smsc95xx_write_reg(dev, BURST_CAP, burst_cap);
863 if (ret < 0) {
864 devwarn(dev, "Failed to write BURST_CAP: %d", ret);
865 return ret;
868 ret = smsc95xx_read_reg(dev, BURST_CAP, &read_buf);
869 if (ret < 0) {
870 devwarn(dev, "Failed to read BURST_CAP: %d", ret);
871 return ret;
873 if (netif_msg_ifup(dev))
874 devdbg(dev, "Read Value from BURST_CAP after writing: 0x%08x",
875 read_buf);
877 read_buf = DEFAULT_BULK_IN_DELAY;
878 ret = smsc95xx_write_reg(dev, BULK_IN_DLY, read_buf);
879 if (ret < 0) {
880 devwarn(dev, "ret = %d", ret);
881 return ret;
884 ret = smsc95xx_read_reg(dev, BULK_IN_DLY, &read_buf);
885 if (ret < 0) {
886 devwarn(dev, "Failed to read BULK_IN_DLY: %d", ret);
887 return ret;
889 if (netif_msg_ifup(dev))
890 devdbg(dev, "Read Value from BULK_IN_DLY after writing: "
891 "0x%08x", read_buf);
893 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
894 if (ret < 0) {
895 devwarn(dev, "Failed to read HW_CFG: %d", ret);
896 return ret;
898 if (netif_msg_ifup(dev))
899 devdbg(dev, "Read Value from HW_CFG: 0x%08x", read_buf);
901 if (turbo_mode)
902 read_buf |= (HW_CFG_MEF_ | HW_CFG_BCE_);
904 read_buf &= ~HW_CFG_RXDOFF_;
906 /* set Rx data offset=2, Make IP header aligns on word boundary. */
907 read_buf |= NET_IP_ALIGN << 9;
909 ret = smsc95xx_write_reg(dev, HW_CFG, read_buf);
910 if (ret < 0) {
911 devwarn(dev, "Failed to write HW_CFG register, ret=%d", ret);
912 return ret;
915 ret = smsc95xx_read_reg(dev, HW_CFG, &read_buf);
916 if (ret < 0) {
917 devwarn(dev, "Failed to read HW_CFG: %d", ret);
918 return ret;
920 if (netif_msg_ifup(dev))
921 devdbg(dev, "Read Value from HW_CFG after writing: 0x%08x",
922 read_buf);
924 write_buf = 0xFFFFFFFF;
925 ret = smsc95xx_write_reg(dev, INT_STS, write_buf);
926 if (ret < 0) {
927 devwarn(dev, "Failed to write INT_STS register, ret=%d", ret);
928 return ret;
931 ret = smsc95xx_read_reg(dev, ID_REV, &read_buf);
932 if (ret < 0) {
933 devwarn(dev, "Failed to read ID_REV: %d", ret);
934 return ret;
936 if (netif_msg_ifup(dev))
937 devdbg(dev, "ID_REV = 0x%08x", read_buf);
939 /* Configure GPIO pins as LED outputs */
940 write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
941 LED_GPIO_CFG_FDX_LED;
942 ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf);
943 if (ret < 0) {
944 devwarn(dev, "Failed to write LED_GPIO_CFG register, ret=%d",
945 ret);
946 return ret;
949 /* Init Tx */
950 write_buf = 0;
951 ret = smsc95xx_write_reg(dev, FLOW, write_buf);
952 if (ret < 0) {
953 devwarn(dev, "Failed to write FLOW: %d", ret);
954 return ret;
957 read_buf = AFC_CFG_DEFAULT;
958 ret = smsc95xx_write_reg(dev, AFC_CFG, read_buf);
959 if (ret < 0) {
960 devwarn(dev, "Failed to write AFC_CFG: %d", ret);
961 return ret;
964 /* Don't need mac_cr_lock during initialisation */
965 ret = smsc95xx_read_reg(dev, MAC_CR, &pdata->mac_cr);
966 if (ret < 0) {
967 devwarn(dev, "Failed to read MAC_CR: %d", ret);
968 return ret;
971 /* Init Rx */
972 /* Set Vlan */
973 write_buf = (u32)ETH_P_8021Q;
974 ret = smsc95xx_write_reg(dev, VLAN1, write_buf);
975 if (ret < 0) {
976 devwarn(dev, "Failed to write VAN1: %d", ret);
977 return ret;
980 /* Enable or disable checksum offload engines */
981 ethtool_op_set_tx_hw_csum(netdev, pdata->use_tx_csum);
982 ret = smsc95xx_set_csums(dev);
983 if (ret < 0) {
984 devwarn(dev, "Failed to set csum offload: %d", ret);
985 return ret;
988 smsc95xx_set_multicast(dev->net);
990 if (smsc95xx_phy_initialize(dev) < 0)
991 return -EIO;
993 ret = smsc95xx_read_reg(dev, INT_EP_CTL, &read_buf);
994 if (ret < 0) {
995 devwarn(dev, "Failed to read INT_EP_CTL: %d", ret);
996 return ret;
999 /* enable PHY interrupts */
1000 read_buf |= INT_EP_CTL_PHY_INT_;
1002 ret = smsc95xx_write_reg(dev, INT_EP_CTL, read_buf);
1003 if (ret < 0) {
1004 devwarn(dev, "Failed to write INT_EP_CTL: %d", ret);
1005 return ret;
1008 smsc95xx_start_tx_path(dev);
1009 smsc95xx_start_rx_path(dev);
1011 if (netif_msg_ifup(dev))
1012 devdbg(dev, "smsc95xx_reset, return 0");
1013 return 0;
1016 static const struct net_device_ops smsc95xx_netdev_ops = {
1017 .ndo_open = usbnet_open,
1018 .ndo_stop = usbnet_stop,
1019 .ndo_start_xmit = usbnet_start_xmit,
1020 .ndo_tx_timeout = usbnet_tx_timeout,
1021 .ndo_change_mtu = usbnet_change_mtu,
1022 .ndo_set_mac_address = eth_mac_addr,
1023 .ndo_validate_addr = eth_validate_addr,
1024 .ndo_do_ioctl = smsc95xx_ioctl,
1025 .ndo_set_multicast_list = smsc95xx_set_multicast,
1028 static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf)
1030 struct smsc95xx_priv *pdata = NULL;
1031 int ret;
1033 printk(KERN_INFO SMSC_CHIPNAME " v" SMSC_DRIVER_VERSION "\n");
1035 ret = usbnet_get_endpoints(dev, intf);
1036 if (ret < 0) {
1037 devwarn(dev, "usbnet_get_endpoints failed: %d", ret);
1038 return ret;
1041 dev->data[0] = (unsigned long)kzalloc(sizeof(struct smsc95xx_priv),
1042 GFP_KERNEL);
1044 pdata = (struct smsc95xx_priv *)(dev->data[0]);
1045 if (!pdata) {
1046 devwarn(dev, "Unable to allocate struct smsc95xx_priv");
1047 return -ENOMEM;
1050 spin_lock_init(&pdata->mac_cr_lock);
1052 pdata->use_tx_csum = DEFAULT_TX_CSUM_ENABLE;
1053 pdata->use_rx_csum = DEFAULT_RX_CSUM_ENABLE;
1055 /* Init all registers */
1056 ret = smsc95xx_reset(dev);
1058 dev->net->netdev_ops = &smsc95xx_netdev_ops;
1059 dev->net->ethtool_ops = &smsc95xx_ethtool_ops;
1060 dev->net->flags |= IFF_MULTICAST;
1061 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD;
1062 return 0;
1065 static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
1067 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
1068 if (pdata) {
1069 if (netif_msg_ifdown(dev))
1070 devdbg(dev, "free pdata");
1071 kfree(pdata);
1072 pdata = NULL;
1073 dev->data[0] = 0;
1077 static void smsc95xx_rx_csum_offload(struct sk_buff *skb)
1079 skb->csum = *(u16 *)(skb_tail_pointer(skb) - 2);
1080 skb->ip_summed = CHECKSUM_COMPLETE;
1081 skb_trim(skb, skb->len - 2);
1084 static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1086 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
1088 while (skb->len > 0) {
1089 u32 header, align_count;
1090 struct sk_buff *ax_skb;
1091 unsigned char *packet;
1092 u16 size;
1094 memcpy(&header, skb->data, sizeof(header));
1095 le32_to_cpus(&header);
1096 skb_pull(skb, 4 + NET_IP_ALIGN);
1097 packet = skb->data;
1099 /* get the packet length */
1100 size = (u16)((header & RX_STS_FL_) >> 16);
1101 align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4;
1103 if (unlikely(header & RX_STS_ES_)) {
1104 if (netif_msg_rx_err(dev))
1105 devdbg(dev, "Error header=0x%08x", header);
1106 dev->net->stats.rx_errors++;
1107 dev->net->stats.rx_dropped++;
1109 if (header & RX_STS_CRC_) {
1110 dev->net->stats.rx_crc_errors++;
1111 } else {
1112 if (header & (RX_STS_TL_ | RX_STS_RF_))
1113 dev->net->stats.rx_frame_errors++;
1115 if ((header & RX_STS_LE_) &&
1116 (!(header & RX_STS_FT_)))
1117 dev->net->stats.rx_length_errors++;
1119 } else {
1120 /* ETH_FRAME_LEN + 4(CRC) + 2(COE) + 4(Vlan) */
1121 if (unlikely(size > (ETH_FRAME_LEN + 12))) {
1122 if (netif_msg_rx_err(dev))
1123 devdbg(dev, "size err header=0x%08x",
1124 header);
1125 return 0;
1128 /* last frame in this batch */
1129 if (skb->len == size) {
1130 if (pdata->use_rx_csum)
1131 smsc95xx_rx_csum_offload(skb);
1132 skb_trim(skb, skb->len - 4); /* remove fcs */
1133 skb->truesize = size + sizeof(struct sk_buff);
1135 return 1;
1138 ax_skb = skb_clone(skb, GFP_ATOMIC);
1139 if (unlikely(!ax_skb)) {
1140 devwarn(dev, "Error allocating skb");
1141 return 0;
1144 ax_skb->len = size;
1145 ax_skb->data = packet;
1146 skb_set_tail_pointer(ax_skb, size);
1148 if (pdata->use_rx_csum)
1149 smsc95xx_rx_csum_offload(ax_skb);
1150 skb_trim(ax_skb, ax_skb->len - 4); /* remove fcs */
1151 ax_skb->truesize = size + sizeof(struct sk_buff);
1153 usbnet_skb_return(dev, ax_skb);
1156 skb_pull(skb, size);
1158 /* padding bytes before the next frame starts */
1159 if (skb->len)
1160 skb_pull(skb, align_count);
1163 if (unlikely(skb->len < 0)) {
1164 devwarn(dev, "invalid rx length<0 %d", skb->len);
1165 return 0;
1168 return 1;
1171 static u32 smsc95xx_calc_csum_preamble(struct sk_buff *skb)
1173 int len = skb->data - skb->head;
1174 u16 high_16 = (u16)(skb->csum_offset + skb->csum_start - len);
1175 u16 low_16 = (u16)(skb->csum_start - len);
1176 return (high_16 << 16) | low_16;
1179 static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev,
1180 struct sk_buff *skb, gfp_t flags)
1182 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]);
1183 bool csum = pdata->use_tx_csum && (skb->ip_summed == CHECKSUM_PARTIAL);
1184 int overhead = csum ? SMSC95XX_TX_OVERHEAD_CSUM : SMSC95XX_TX_OVERHEAD;
1185 u32 tx_cmd_a, tx_cmd_b;
1187 /* We do not advertise SG, so skbs should be already linearized */
1188 BUG_ON(skb_shinfo(skb)->nr_frags);
1190 if (skb_headroom(skb) < overhead) {
1191 struct sk_buff *skb2 = skb_copy_expand(skb,
1192 overhead, 0, flags);
1193 dev_kfree_skb_any(skb);
1194 skb = skb2;
1195 if (!skb)
1196 return NULL;
1199 if (csum) {
1200 u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
1201 skb_push(skb, 4);
1202 memcpy(skb->data, &csum_preamble, 4);
1205 skb_push(skb, 4);
1206 tx_cmd_b = (u32)(skb->len - 4);
1207 if (csum)
1208 tx_cmd_b |= TX_CMD_B_CSUM_ENABLE;
1209 cpu_to_le32s(&tx_cmd_b);
1210 memcpy(skb->data, &tx_cmd_b, 4);
1212 skb_push(skb, 4);
1213 tx_cmd_a = (u32)(skb->len - 8) | TX_CMD_A_FIRST_SEG_ |
1214 TX_CMD_A_LAST_SEG_;
1215 cpu_to_le32s(&tx_cmd_a);
1216 memcpy(skb->data, &tx_cmd_a, 4);
1218 return skb;
1221 static const struct driver_info smsc95xx_info = {
1222 .description = "smsc95xx USB 2.0 Ethernet",
1223 .bind = smsc95xx_bind,
1224 .unbind = smsc95xx_unbind,
1225 .link_reset = smsc95xx_link_reset,
1226 .reset = smsc95xx_reset,
1227 .rx_fixup = smsc95xx_rx_fixup,
1228 .tx_fixup = smsc95xx_tx_fixup,
1229 .status = smsc95xx_status,
1230 .flags = FLAG_ETHER | FLAG_SEND_ZLP,
1233 static const struct usb_device_id products[] = {
1235 /* SMSC9500 USB Ethernet Device */
1236 USB_DEVICE(0x0424, 0x9500),
1237 .driver_info = (unsigned long) &smsc95xx_info,
1240 /* SMSC9505 USB Ethernet Device */
1241 USB_DEVICE(0x0424, 0x9505),
1242 .driver_info = (unsigned long) &smsc95xx_info,
1245 /* SMSC9500A USB Ethernet Device */
1246 USB_DEVICE(0x0424, 0x9E00),
1247 .driver_info = (unsigned long) &smsc95xx_info,
1250 /* SMSC9505A USB Ethernet Device */
1251 USB_DEVICE(0x0424, 0x9E01),
1252 .driver_info = (unsigned long) &smsc95xx_info,
1255 /* SMSC9512/9514 USB Hub & Ethernet Device */
1256 USB_DEVICE(0x0424, 0xec00),
1257 .driver_info = (unsigned long) &smsc95xx_info,
1260 /* SMSC9500 USB Ethernet Device (SAL10) */
1261 USB_DEVICE(0x0424, 0x9900),
1262 .driver_info = (unsigned long) &smsc95xx_info,
1265 /* SMSC9505 USB Ethernet Device (SAL10) */
1266 USB_DEVICE(0x0424, 0x9901),
1267 .driver_info = (unsigned long) &smsc95xx_info,
1270 /* SMSC9500A USB Ethernet Device (SAL10) */
1271 USB_DEVICE(0x0424, 0x9902),
1272 .driver_info = (unsigned long) &smsc95xx_info,
1275 /* SMSC9505A USB Ethernet Device (SAL10) */
1276 USB_DEVICE(0x0424, 0x9903),
1277 .driver_info = (unsigned long) &smsc95xx_info,
1280 /* SMSC9512/9514 USB Hub & Ethernet Device (SAL10) */
1281 USB_DEVICE(0x0424, 0x9904),
1282 .driver_info = (unsigned long) &smsc95xx_info,
1285 /* SMSC9500A USB Ethernet Device (HAL) */
1286 USB_DEVICE(0x0424, 0x9905),
1287 .driver_info = (unsigned long) &smsc95xx_info,
1290 /* SMSC9505A USB Ethernet Device (HAL) */
1291 USB_DEVICE(0x0424, 0x9906),
1292 .driver_info = (unsigned long) &smsc95xx_info,
1295 /* SMSC9500 USB Ethernet Device (Alternate ID) */
1296 USB_DEVICE(0x0424, 0x9907),
1297 .driver_info = (unsigned long) &smsc95xx_info,
1300 /* SMSC9500A USB Ethernet Device (Alternate ID) */
1301 USB_DEVICE(0x0424, 0x9908),
1302 .driver_info = (unsigned long) &smsc95xx_info,
1305 /* SMSC9512/9514 USB Hub & Ethernet Device (Alternate ID) */
1306 USB_DEVICE(0x0424, 0x9909),
1307 .driver_info = (unsigned long) &smsc95xx_info,
1309 { }, /* END */
1311 MODULE_DEVICE_TABLE(usb, products);
1313 static struct usb_driver smsc95xx_driver = {
1314 .name = "smsc95xx",
1315 .id_table = products,
1316 .probe = usbnet_probe,
1317 .suspend = usbnet_suspend,
1318 .resume = usbnet_resume,
1319 .disconnect = usbnet_disconnect,
1322 static int __init smsc95xx_init(void)
1324 return usb_register(&smsc95xx_driver);
1326 module_init(smsc95xx_init);
1328 static void __exit smsc95xx_exit(void)
1330 usb_deregister(&smsc95xx_driver);
1332 module_exit(smsc95xx_exit);
1334 MODULE_AUTHOR("Nancy Lin");
1335 MODULE_AUTHOR("Steve Glendinning <steve.glendinning@smsc.com>");
1336 MODULE_DESCRIPTION("SMSC95XX USB 2.0 Ethernet Devices");
1337 MODULE_LICENSE("GPL");