aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/usb')
-rw-r--r--drivers/net/usb/Kconfig3
-rw-r--r--drivers/net/usb/asix.c458
-rw-r--r--drivers/net/usb/catc.c2
-rw-r--r--drivers/net/usb/cdc_ether.c2
-rw-r--r--drivers/net/usb/dm9601.c2
-rw-r--r--drivers/net/usb/int51x1.c2
-rw-r--r--drivers/net/usb/ipheth.c5
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/usb/lg-vl600.c27
-rw-r--r--drivers/net/usb/mcs7830.c2
-rw-r--r--drivers/net/usb/pegasus.c2
-rw-r--r--drivers/net/usb/rtl8150.c113
-rw-r--r--drivers/net/usb/smsc75xx.c9
-rw-r--r--drivers/net/usb/smsc95xx.c2
-rw-r--r--drivers/net/usb/usbnet.c9
15 files changed, 379 insertions, 261 deletions
diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig
index 84d4608153c9..233576127934 100644
--- a/drivers/net/usb/Kconfig
+++ b/drivers/net/usb/Kconfig
@@ -68,6 +68,7 @@ config USB_KAWETH
68 68
69config USB_PEGASUS 69config USB_PEGASUS
70 tristate "USB Pegasus/Pegasus-II based ethernet device support" 70 tristate "USB Pegasus/Pegasus-II based ethernet device support"
71 select NET_CORE
71 select MII 72 select MII
72 ---help--- 73 ---help---
73 Say Y here if you know you have Pegasus or Pegasus-II based adapter. 74 Say Y here if you know you have Pegasus or Pegasus-II based adapter.
@@ -84,6 +85,7 @@ config USB_PEGASUS
84config USB_RTL8150 85config USB_RTL8150
85 tristate "USB RTL8150 based ethernet device support (EXPERIMENTAL)" 86 tristate "USB RTL8150 based ethernet device support (EXPERIMENTAL)"
86 depends on EXPERIMENTAL 87 depends on EXPERIMENTAL
88 select NET_CORE
87 select MII 89 select MII
88 help 90 help
89 Say Y here if you have RTL8150 based usb-ethernet adapter. 91 Say Y here if you have RTL8150 based usb-ethernet adapter.
@@ -95,6 +97,7 @@ config USB_RTL8150
95 97
96config USB_USBNET 98config USB_USBNET
97 tristate "Multi-purpose USB Networking Framework" 99 tristate "Multi-purpose USB Networking Framework"
100 select NET_CORE
98 select MII 101 select MII
99 ---help--- 102 ---help---
100 This driver supports several kinds of network links over USB, 103 This driver supports several kinds of network links over USB,
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index c5c4b4def7fb..e6fed4d4cb77 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -36,8 +36,8 @@
36#include <linux/usb/usbnet.h> 36#include <linux/usb/usbnet.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38 38
39#define DRIVER_VERSION "14-Jun-2006" 39#define DRIVER_VERSION "08-Nov-2011"
40static const char driver_name [] = "asix"; 40#define DRIVER_NAME "asix"
41 41
42/* ASIX AX8817X based USB 2.0 Ethernet Devices */ 42/* ASIX AX8817X based USB 2.0 Ethernet Devices */
43 43
@@ -115,28 +115,27 @@ static const char driver_name [] = "asix";
115#define AX88178_MEDIUM_DEFAULT \ 115#define AX88178_MEDIUM_DEFAULT \
116 (AX_MEDIUM_PS | AX_MEDIUM_FD | AX_MEDIUM_AC | \ 116 (AX_MEDIUM_PS | AX_MEDIUM_FD | AX_MEDIUM_AC | \
117 AX_MEDIUM_RFC | AX_MEDIUM_TFC | AX_MEDIUM_JFE | \ 117 AX_MEDIUM_RFC | AX_MEDIUM_TFC | AX_MEDIUM_JFE | \
118 AX_MEDIUM_RE ) 118 AX_MEDIUM_RE)
119 119
120#define AX88772_MEDIUM_DEFAULT \ 120#define AX88772_MEDIUM_DEFAULT \
121 (AX_MEDIUM_FD | AX_MEDIUM_RFC | \ 121 (AX_MEDIUM_FD | AX_MEDIUM_RFC | \
122 AX_MEDIUM_TFC | AX_MEDIUM_PS | \ 122 AX_MEDIUM_TFC | AX_MEDIUM_PS | \
123 AX_MEDIUM_AC | AX_MEDIUM_RE ) 123 AX_MEDIUM_AC | AX_MEDIUM_RE)
124 124
125/* AX88772 & AX88178 RX_CTL values */ 125/* AX88772 & AX88178 RX_CTL values */
126#define AX_RX_CTL_SO 0x0080 126#define AX_RX_CTL_SO 0x0080
127#define AX_RX_CTL_AP 0x0020 127#define AX_RX_CTL_AP 0x0020
128#define AX_RX_CTL_AM 0x0010 128#define AX_RX_CTL_AM 0x0010
129#define AX_RX_CTL_AB 0x0008 129#define AX_RX_CTL_AB 0x0008
130#define AX_RX_CTL_SEP 0x0004 130#define AX_RX_CTL_SEP 0x0004
131#define AX_RX_CTL_AMALL 0x0002 131#define AX_RX_CTL_AMALL 0x0002
132#define AX_RX_CTL_PRO 0x0001 132#define AX_RX_CTL_PRO 0x0001
133#define AX_RX_CTL_MFB_2048 0x0000 133#define AX_RX_CTL_MFB_2048 0x0000
134#define AX_RX_CTL_MFB_4096 0x0100 134#define AX_RX_CTL_MFB_4096 0x0100
135#define AX_RX_CTL_MFB_8192 0x0200 135#define AX_RX_CTL_MFB_8192 0x0200
136#define AX_RX_CTL_MFB_16384 0x0300 136#define AX_RX_CTL_MFB_16384 0x0300
137 137
138#define AX_DEFAULT_RX_CTL \ 138#define AX_DEFAULT_RX_CTL (AX_RX_CTL_SO | AX_RX_CTL_AB)
139 (AX_RX_CTL_SO | AX_RX_CTL_AB )
140 139
141/* GPIO 0 .. 2 toggles */ 140/* GPIO 0 .. 2 toggles */
142#define AX_GPIO_GPO0EN 0x01 /* GPIO0 Output enable */ 141#define AX_GPIO_GPO0EN 0x01 /* GPIO0 Output enable */
@@ -164,6 +163,8 @@ static const char driver_name [] = "asix";
164#define MARVELL_CTRL_TXDELAY 0x0002 163#define MARVELL_CTRL_TXDELAY 0x0002
165#define MARVELL_CTRL_RXDELAY 0x0080 164#define MARVELL_CTRL_RXDELAY 0x0080
166 165
166#define PHY_MODE_RTL8211CL 0x000C
167
167/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ 168/* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */
168struct asix_data { 169struct asix_data {
169 u8 multi_filter[AX_MCAST_FILTER_SIZE]; 170 u8 multi_filter[AX_MCAST_FILTER_SIZE];
@@ -268,12 +269,15 @@ asix_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
268 269
269 netdev_dbg(dev->net, "asix_write_cmd_async() cmd=0x%02x value=0x%04x index=0x%04x size=%d\n", 270 netdev_dbg(dev->net, "asix_write_cmd_async() cmd=0x%02x value=0x%04x index=0x%04x size=%d\n",
270 cmd, value, index, size); 271 cmd, value, index, size);
271 if ((urb = usb_alloc_urb(0, GFP_ATOMIC)) == NULL) { 272
273 urb = usb_alloc_urb(0, GFP_ATOMIC);
274 if (!urb) {
272 netdev_err(dev->net, "Error allocating URB in write_cmd_async!\n"); 275 netdev_err(dev->net, "Error allocating URB in write_cmd_async!\n");
273 return; 276 return;
274 } 277 }
275 278
276 if ((req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC)) == NULL) { 279 req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC);
280 if (!req) {
277 netdev_err(dev->net, "Failed to allocate memory for control request\n"); 281 netdev_err(dev->net, "Failed to allocate memory for control request\n");
278 usb_free_urb(urb); 282 usb_free_urb(urb);
279 return; 283 return;
@@ -290,7 +294,8 @@ asix_write_cmd_async(struct usbnet *dev, u8 cmd, u16 value, u16 index,
290 (void *)req, data, size, 294 (void *)req, data, size,
291 asix_async_cmd_callback, req); 295 asix_async_cmd_callback, req);
292 296
293 if((status = usb_submit_urb(urb, GFP_ATOMIC)) < 0) { 297 status = usb_submit_urb(urb, GFP_ATOMIC);
298 if (status < 0) {
294 netdev_err(dev->net, "Error submitting the control message: status=%d\n", 299 netdev_err(dev->net, "Error submitting the control message: status=%d\n",
295 status); 300 status);
296 kfree(req); 301 kfree(req);
@@ -531,11 +536,11 @@ static u16 asix_read_medium_status(struct usbnet *dev)
531 if (ret < 0) { 536 if (ret < 0) {
532 netdev_err(dev->net, "Error reading Medium Status register: %02x\n", 537 netdev_err(dev->net, "Error reading Medium Status register: %02x\n",
533 ret); 538 ret);
534 goto out; 539 return ret; /* TODO: callers not checking for error ret */
535 } 540 }
536 ret = le16_to_cpu(v); 541
537out: 542 return le16_to_cpu(v);
538 return ret; 543
539} 544}
540 545
541static int asix_write_medium_mode(struct usbnet *dev, u16 mode) 546static int asix_write_medium_mode(struct usbnet *dev, u16 mode)
@@ -647,9 +652,17 @@ static u32 asix_get_phyid(struct usbnet *dev)
647{ 652{
648 int phy_reg; 653 int phy_reg;
649 u32 phy_id; 654 u32 phy_id;
655 int i;
650 656
651 phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1); 657 /* Poll for the rare case the FW or phy isn't ready yet. */
652 if (phy_reg < 0) 658 for (i = 0; i < 100; i++) {
659 phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1);
660 if (phy_reg != 0 && phy_reg != 0xFFFF)
661 break;
662 mdelay(1);
663 }
664
665 if (phy_reg <= 0 || phy_reg == 0xFFFF)
653 return 0; 666 return 0;
654 667
655 phy_id = (phy_reg & 0xffff) << 16; 668 phy_id = (phy_reg & 0xffff) << 16;
@@ -676,12 +689,6 @@ asix_get_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
676 } 689 }
677 wolinfo->supported = WAKE_PHY | WAKE_MAGIC; 690 wolinfo->supported = WAKE_PHY | WAKE_MAGIC;
678 wolinfo->wolopts = 0; 691 wolinfo->wolopts = 0;
679 if (opt & AX_MONITOR_MODE) {
680 if (opt & AX_MONITOR_LINK)
681 wolinfo->wolopts |= WAKE_PHY;
682 if (opt & AX_MONITOR_MAGIC)
683 wolinfo->wolopts |= WAKE_MAGIC;
684 }
685} 692}
686 693
687static int 694static int
@@ -694,8 +701,6 @@ asix_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
694 opt |= AX_MONITOR_LINK; 701 opt |= AX_MONITOR_LINK;
695 if (wolinfo->wolopts & WAKE_MAGIC) 702 if (wolinfo->wolopts & WAKE_MAGIC)
696 opt |= AX_MONITOR_MAGIC; 703 opt |= AX_MONITOR_MAGIC;
697 if (opt != 0)
698 opt |= AX_MONITOR_MODE;
699 704
700 if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE, 705 if (asix_write_cmd(dev, AX_CMD_WRITE_MONITOR_MODE,
701 opt, 0, 0, NULL) < 0) 706 opt, 0, 0, NULL) < 0)
@@ -744,7 +749,7 @@ static void asix_get_drvinfo (struct net_device *net,
744 749
745 /* Inherit standard device info */ 750 /* Inherit standard device info */
746 usbnet_get_drvinfo(net, info); 751 usbnet_get_drvinfo(net, info);
747 strncpy (info->driver, driver_name, sizeof info->driver); 752 strncpy (info->driver, DRIVER_NAME, sizeof info->driver);
748 strncpy (info->version, DRIVER_VERSION, sizeof info->version); 753 strncpy (info->version, DRIVER_VERSION, sizeof info->version);
749 info->eedump_len = data->eeprom_len; 754 info->eedump_len = data->eeprom_len;
750} 755}
@@ -872,7 +877,7 @@ static const struct net_device_ops ax88172_netdev_ops = {
872 .ndo_set_mac_address = eth_mac_addr, 877 .ndo_set_mac_address = eth_mac_addr,
873 .ndo_validate_addr = eth_validate_addr, 878 .ndo_validate_addr = eth_validate_addr,
874 .ndo_do_ioctl = asix_ioctl, 879 .ndo_do_ioctl = asix_ioctl,
875 .ndo_set_multicast_list = ax88172_set_multicast, 880 .ndo_set_rx_mode = ax88172_set_multicast,
876}; 881};
877 882
878static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf) 883static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
@@ -889,19 +894,20 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
889 894
890 /* Toggle the GPIOs in a manufacturer/model specific way */ 895 /* Toggle the GPIOs in a manufacturer/model specific way */
891 for (i = 2; i >= 0; i--) { 896 for (i = 2; i >= 0; i--) {
892 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS, 897 ret = asix_write_cmd(dev, AX_CMD_WRITE_GPIOS,
893 (gpio_bits >> (i * 8)) & 0xff, 0, 0, 898 (gpio_bits >> (i * 8)) & 0xff, 0, 0, NULL);
894 NULL)) < 0) 899 if (ret < 0)
895 goto out; 900 goto out;
896 msleep(5); 901 msleep(5);
897 } 902 }
898 903
899 if ((ret = asix_write_rx_ctl(dev, 0x80)) < 0) 904 ret = asix_write_rx_ctl(dev, 0x80);
905 if (ret < 0)
900 goto out; 906 goto out;
901 907
902 /* Get the MAC address */ 908 /* Get the MAC address */
903 if ((ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, 909 ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
904 0, 0, ETH_ALEN, buf)) < 0) { 910 if (ret < 0) {
905 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); 911 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret);
906 goto out; 912 goto out;
907 } 913 }
@@ -966,117 +972,88 @@ static int ax88772_link_reset(struct usbnet *dev)
966 return 0; 972 return 0;
967} 973}
968 974
969static const struct net_device_ops ax88772_netdev_ops = { 975static int ax88772_reset(struct usbnet *dev)
970 .ndo_open = usbnet_open,
971 .ndo_stop = usbnet_stop,
972 .ndo_start_xmit = usbnet_start_xmit,
973 .ndo_tx_timeout = usbnet_tx_timeout,
974 .ndo_change_mtu = usbnet_change_mtu,
975 .ndo_set_mac_address = asix_set_mac_address,
976 .ndo_validate_addr = eth_validate_addr,
977 .ndo_do_ioctl = asix_ioctl,
978 .ndo_set_multicast_list = asix_set_multicast,
979};
980
981static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
982{ 976{
983 int ret, embd_phy; 977 int ret, embd_phy;
984 u16 rx_ctl; 978 u16 rx_ctl;
985 struct asix_data *data = (struct asix_data *)&dev->data;
986 u8 buf[ETH_ALEN];
987 u32 phyid;
988
989 data->eeprom_len = AX88772_EEPROM_LEN;
990 979
991 usbnet_get_endpoints(dev,intf); 980 ret = asix_write_gpio(dev,
992 981 AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5);
993 if ((ret = asix_write_gpio(dev, 982 if (ret < 0)
994 AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0)
995 goto out; 983 goto out;
996 984
997 /* 0x10 is the phy id of the embedded 10/100 ethernet phy */
998 embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0); 985 embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0);
999 if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 986
1000 embd_phy, 0, 0, NULL)) < 0) { 987 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
988 if (ret < 0) {
1001 dbg("Select PHY #1 failed: %d", ret); 989 dbg("Select PHY #1 failed: %d", ret);
1002 goto out; 990 goto out;
1003 } 991 }
1004 992
1005 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0) 993 ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL);
994 if (ret < 0)
1006 goto out; 995 goto out;
1007 996
1008 msleep(150); 997 msleep(150);
1009 if ((ret = asix_sw_reset(dev, AX_SWRESET_CLEAR)) < 0) 998
999 ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
1000 if (ret < 0)
1010 goto out; 1001 goto out;
1011 1002
1012 msleep(150); 1003 msleep(150);
1004
1013 if (embd_phy) { 1005 if (embd_phy) {
1014 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0) 1006 ret = asix_sw_reset(dev, AX_SWRESET_IPRL);
1007 if (ret < 0)
1015 goto out; 1008 goto out;
1016 } 1009 } else {
1017 else { 1010 ret = asix_sw_reset(dev, AX_SWRESET_PRTE);
1018 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0) 1011 if (ret < 0)
1019 goto out; 1012 goto out;
1020 } 1013 }
1021 1014
1022 msleep(150); 1015 msleep(150);
1023 rx_ctl = asix_read_rx_ctl(dev); 1016 rx_ctl = asix_read_rx_ctl(dev);
1024 dbg("RX_CTL is 0x%04x after software reset", rx_ctl); 1017 dbg("RX_CTL is 0x%04x after software reset", rx_ctl);
1025 if ((ret = asix_write_rx_ctl(dev, 0x0000)) < 0) 1018 ret = asix_write_rx_ctl(dev, 0x0000);
1019 if (ret < 0)
1026 goto out; 1020 goto out;
1027 1021
1028 rx_ctl = asix_read_rx_ctl(dev); 1022 rx_ctl = asix_read_rx_ctl(dev);
1029 dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); 1023 dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl);
1030 1024
1031 /* Get the MAC address */ 1025 ret = asix_sw_reset(dev, AX_SWRESET_PRL);
1032 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 1026 if (ret < 0)
1033 0, 0, ETH_ALEN, buf)) < 0) {
1034 dbg("Failed to read MAC address: %d", ret);
1035 goto out;
1036 }
1037 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
1038
1039 /* Initialize MII structure */
1040 dev->mii.dev = dev->net;
1041 dev->mii.mdio_read = asix_mdio_read;
1042 dev->mii.mdio_write = asix_mdio_write;
1043 dev->mii.phy_id_mask = 0x1f;
1044 dev->mii.reg_num_mask = 0x1f;
1045 dev->mii.phy_id = asix_get_phy_addr(dev);
1046
1047 phyid = asix_get_phyid(dev);
1048 dbg("PHYID=0x%08x", phyid);
1049
1050 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0)
1051 goto out; 1027 goto out;
1052 1028
1053 msleep(150); 1029 msleep(150);
1054 1030
1055 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) 1031 ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL);
1032 if (ret < 0)
1056 goto out; 1033 goto out;
1057 1034
1058 msleep(150); 1035 msleep(150);
1059 1036
1060 dev->net->netdev_ops = &ax88772_netdev_ops;
1061 dev->net->ethtool_ops = &ax88772_ethtool_ops;
1062
1063 asix_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); 1037 asix_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET);
1064 asix_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, 1038 asix_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
1065 ADVERTISE_ALL | ADVERTISE_CSMA); 1039 ADVERTISE_ALL | ADVERTISE_CSMA);
1066 mii_nway_restart(&dev->mii); 1040 mii_nway_restart(&dev->mii);
1067 1041
1068 if ((ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT)) < 0) 1042 ret = asix_write_medium_mode(dev, AX88772_MEDIUM_DEFAULT);
1043 if (ret < 0)
1069 goto out; 1044 goto out;
1070 1045
1071 if ((ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0, 1046 ret = asix_write_cmd(dev, AX_CMD_WRITE_IPG0,
1072 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, 1047 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
1073 AX88772_IPG2_DEFAULT, 0, NULL)) < 0) { 1048 AX88772_IPG2_DEFAULT, 0, NULL);
1049 if (ret < 0) {
1074 dbg("Write IPG,IPG1,IPG2 failed: %d", ret); 1050 dbg("Write IPG,IPG1,IPG2 failed: %d", ret);
1075 goto out; 1051 goto out;
1076 } 1052 }
1077 1053
1078 /* Set RX_CTL to default values with 2k buffer, and enable cactus */ 1054 /* Set RX_CTL to default values with 2k buffer, and enable cactus */
1079 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) 1055 ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL);
1056 if (ret < 0)
1080 goto out; 1057 goto out;
1081 1058
1082 rx_ctl = asix_read_rx_ctl(dev); 1059 rx_ctl = asix_read_rx_ctl(dev);
@@ -1085,16 +1062,90 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1085 rx_ctl = asix_read_medium_status(dev); 1062 rx_ctl = asix_read_medium_status(dev);
1086 dbg("Medium Status is 0x%04x after all initializations", rx_ctl); 1063 dbg("Medium Status is 0x%04x after all initializations", rx_ctl);
1087 1064
1065 return 0;
1066
1067out:
1068 return ret;
1069
1070}
1071
1072static const struct net_device_ops ax88772_netdev_ops = {
1073 .ndo_open = usbnet_open,
1074 .ndo_stop = usbnet_stop,
1075 .ndo_start_xmit = usbnet_start_xmit,
1076 .ndo_tx_timeout = usbnet_tx_timeout,
1077 .ndo_change_mtu = usbnet_change_mtu,
1078 .ndo_set_mac_address = asix_set_mac_address,
1079 .ndo_validate_addr = eth_validate_addr,
1080 .ndo_do_ioctl = asix_ioctl,
1081 .ndo_set_rx_mode = asix_set_multicast,
1082};
1083
1084static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
1085{
1086 int ret, embd_phy;
1087 struct asix_data *data = (struct asix_data *)&dev->data;
1088 u8 buf[ETH_ALEN];
1089 u32 phyid;
1090
1091 data->eeprom_len = AX88772_EEPROM_LEN;
1092
1093 usbnet_get_endpoints(dev,intf);
1094
1095 /* Get the MAC address */
1096 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
1097 if (ret < 0) {
1098 dbg("Failed to read MAC address: %d", ret);
1099 return ret;
1100 }
1101 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
1102
1103 /* Initialize MII structure */
1104 dev->mii.dev = dev->net;
1105 dev->mii.mdio_read = asix_mdio_read;
1106 dev->mii.mdio_write = asix_mdio_write;
1107 dev->mii.phy_id_mask = 0x1f;
1108 dev->mii.reg_num_mask = 0x1f;
1109 dev->mii.phy_id = asix_get_phy_addr(dev);
1110
1111 dev->net->netdev_ops = &ax88772_netdev_ops;
1112 dev->net->ethtool_ops = &ax88772_ethtool_ops;
1113
1114 embd_phy = ((dev->mii.phy_id & 0x1f) == 0x10 ? 1 : 0);
1115
1116 /* Reset the PHY to normal operation mode */
1117 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
1118 if (ret < 0) {
1119 dbg("Select PHY #1 failed: %d", ret);
1120 return ret;
1121 }
1122
1123 ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL);
1124 if (ret < 0)
1125 return ret;
1126
1127 msleep(150);
1128
1129 ret = asix_sw_reset(dev, AX_SWRESET_CLEAR);
1130 if (ret < 0)
1131 return ret;
1132
1133 msleep(150);
1134
1135 ret = asix_sw_reset(dev, embd_phy ? AX_SWRESET_IPRL : AX_SWRESET_PRTE);
1136
1137 /* Read PHYID register *AFTER* the PHY was reset properly */
1138 phyid = asix_get_phyid(dev);
1139 dbg("PHYID=0x%08x", phyid);
1140
1088 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 1141 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
1089 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 1142 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
1090 /* hard_mtu is still the default - the device does not support 1143 /* hard_mtu is still the default - the device does not support
1091 jumbo eth frames */ 1144 jumbo eth frames */
1092 dev->rx_urb_size = 2048; 1145 dev->rx_urb_size = 2048;
1093 } 1146 }
1094 return 0;
1095 1147
1096out: 1148 return 0;
1097 return ret;
1098} 1149}
1099 1150
1100static struct ethtool_ops ax88178_ethtool_ops = { 1151static struct ethtool_ops ax88178_ethtool_ops = {
@@ -1143,6 +1194,27 @@ static int marvell_phy_init(struct usbnet *dev)
1143 return 0; 1194 return 0;
1144} 1195}
1145 1196
1197static int rtl8211cl_phy_init(struct usbnet *dev)
1198{
1199 struct asix_data *data = (struct asix_data *)&dev->data;
1200
1201 netdev_dbg(dev->net, "rtl8211cl_phy_init()\n");
1202
1203 asix_mdio_write (dev->net, dev->mii.phy_id, 0x1f, 0x0005);
1204 asix_mdio_write (dev->net, dev->mii.phy_id, 0x0c, 0);
1205 asix_mdio_write (dev->net, dev->mii.phy_id, 0x01,
1206 asix_mdio_read (dev->net, dev->mii.phy_id, 0x01) | 0x0080);
1207 asix_mdio_write (dev->net, dev->mii.phy_id, 0x1f, 0);
1208
1209 if (data->ledmode == 12) {
1210 asix_mdio_write (dev->net, dev->mii.phy_id, 0x1f, 0x0002);
1211 asix_mdio_write (dev->net, dev->mii.phy_id, 0x1a, 0x00cb);
1212 asix_mdio_write (dev->net, dev->mii.phy_id, 0x1f, 0);
1213 }
1214
1215 return 0;
1216}
1217
1146static int marvell_led_status(struct usbnet *dev, u16 speed) 1218static int marvell_led_status(struct usbnet *dev, u16 speed)
1147{ 1219{
1148 u16 reg = asix_mdio_read(dev->net, dev->mii.phy_id, MARVELL_LED_MANUAL); 1220 u16 reg = asix_mdio_read(dev->net, dev->mii.phy_id, MARVELL_LED_MANUAL);
@@ -1169,6 +1241,88 @@ static int marvell_led_status(struct usbnet *dev, u16 speed)
1169 return 0; 1241 return 0;
1170} 1242}
1171 1243
1244static int ax88178_reset(struct usbnet *dev)
1245{
1246 struct asix_data *data = (struct asix_data *)&dev->data;
1247 int ret;
1248 __le16 eeprom;
1249 u8 status;
1250 int gpio0 = 0;
1251 u32 phyid;
1252
1253 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
1254 dbg("GPIO Status: 0x%04x", status);
1255
1256 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL);
1257 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom);
1258 asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL);
1259
1260 dbg("EEPROM index 0x17 is 0x%04x", eeprom);
1261
1262 if (eeprom == cpu_to_le16(0xffff)) {
1263 data->phymode = PHY_MODE_MARVELL;
1264 data->ledmode = 0;
1265 gpio0 = 1;
1266 } else {
1267 data->phymode = le16_to_cpu(eeprom) & 0x7F;
1268 data->ledmode = le16_to_cpu(eeprom) >> 8;
1269 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
1270 }
1271 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode);
1272
1273 /* Power up external GigaPHY through AX88178 GPIO pin */
1274 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
1275 if ((le16_to_cpu(eeprom) >> 8) != 1) {
1276 asix_write_gpio(dev, 0x003c, 30);
1277 asix_write_gpio(dev, 0x001c, 300);
1278 asix_write_gpio(dev, 0x003c, 30);
1279 } else {
1280 dbg("gpio phymode == 1 path");
1281 asix_write_gpio(dev, AX_GPIO_GPO1EN, 30);
1282 asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30);
1283 }
1284
1285 /* Read PHYID register *AFTER* powering up PHY */
1286 phyid = asix_get_phyid(dev);
1287 dbg("PHYID=0x%08x", phyid);
1288
1289 /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */
1290 asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL);
1291
1292 asix_sw_reset(dev, 0);
1293 msleep(150);
1294
1295 asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD);
1296 msleep(150);
1297
1298 asix_write_rx_ctl(dev, 0);
1299
1300 if (data->phymode == PHY_MODE_MARVELL) {
1301 marvell_phy_init(dev);
1302 msleep(60);
1303 } else if (data->phymode == PHY_MODE_RTL8211CL)
1304 rtl8211cl_phy_init(dev);
1305
1306 asix_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR,
1307 BMCR_RESET | BMCR_ANENABLE);
1308 asix_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
1309 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
1310 asix_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000,
1311 ADVERTISE_1000FULL);
1312
1313 mii_nway_restart(&dev->mii);
1314
1315 ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT);
1316 if (ret < 0)
1317 return ret;
1318
1319 ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL);
1320 if (ret < 0)
1321 return ret;
1322
1323 return 0;
1324}
1325
1172static int ax88178_link_reset(struct usbnet *dev) 1326static int ax88178_link_reset(struct usbnet *dev)
1173{ 1327{
1174 u16 mode; 1328 u16 mode;
@@ -1270,67 +1424,26 @@ static const struct net_device_ops ax88178_netdev_ops = {
1270 .ndo_tx_timeout = usbnet_tx_timeout, 1424 .ndo_tx_timeout = usbnet_tx_timeout,
1271 .ndo_set_mac_address = asix_set_mac_address, 1425 .ndo_set_mac_address = asix_set_mac_address,
1272 .ndo_validate_addr = eth_validate_addr, 1426 .ndo_validate_addr = eth_validate_addr,
1273 .ndo_set_multicast_list = asix_set_multicast, 1427 .ndo_set_rx_mode = asix_set_multicast,
1274 .ndo_do_ioctl = asix_ioctl, 1428 .ndo_do_ioctl = asix_ioctl,
1275 .ndo_change_mtu = ax88178_change_mtu, 1429 .ndo_change_mtu = ax88178_change_mtu,
1276}; 1430};
1277 1431
1278static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) 1432static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1279{ 1433{
1280 struct asix_data *data = (struct asix_data *)&dev->data;
1281 int ret; 1434 int ret;
1282 u8 buf[ETH_ALEN]; 1435 u8 buf[ETH_ALEN];
1283 __le16 eeprom; 1436 struct asix_data *data = (struct asix_data *)&dev->data;
1284 u8 status;
1285 int gpio0 = 0;
1286 u32 phyid;
1287
1288 usbnet_get_endpoints(dev,intf);
1289
1290 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
1291 dbg("GPIO Status: 0x%04x", status);
1292
1293 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL);
1294 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom);
1295 asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL);
1296
1297 dbg("EEPROM index 0x17 is 0x%04x", eeprom);
1298
1299 if (eeprom == cpu_to_le16(0xffff)) {
1300 data->phymode = PHY_MODE_MARVELL;
1301 data->ledmode = 0;
1302 gpio0 = 1;
1303 } else {
1304 data->phymode = le16_to_cpu(eeprom) & 7;
1305 data->ledmode = le16_to_cpu(eeprom) >> 8;
1306 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
1307 }
1308 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode);
1309
1310 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
1311 if ((le16_to_cpu(eeprom) >> 8) != 1) {
1312 asix_write_gpio(dev, 0x003c, 30);
1313 asix_write_gpio(dev, 0x001c, 300);
1314 asix_write_gpio(dev, 0x003c, 30);
1315 } else {
1316 dbg("gpio phymode == 1 path");
1317 asix_write_gpio(dev, AX_GPIO_GPO1EN, 30);
1318 asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30);
1319 }
1320
1321 asix_sw_reset(dev, 0);
1322 msleep(150);
1323 1437
1324 asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD); 1438 data->eeprom_len = AX88772_EEPROM_LEN;
1325 msleep(150);
1326 1439
1327 asix_write_rx_ctl(dev, 0); 1440 usbnet_get_endpoints(dev,intf);
1328 1441
1329 /* Get the MAC address */ 1442 /* Get the MAC address */
1330 if ((ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 1443 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
1331 0, 0, ETH_ALEN, buf)) < 0) { 1444 if (ret < 0) {
1332 dbg("Failed to read MAC address: %d", ret); 1445 dbg("Failed to read MAC address: %d", ret);
1333 goto out; 1446 return ret;
1334 } 1447 }
1335 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 1448 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
1336 1449
@@ -1346,28 +1459,12 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1346 dev->net->netdev_ops = &ax88178_netdev_ops; 1459 dev->net->netdev_ops = &ax88178_netdev_ops;
1347 dev->net->ethtool_ops = &ax88178_ethtool_ops; 1460 dev->net->ethtool_ops = &ax88178_ethtool_ops;
1348 1461
1349 phyid = asix_get_phyid(dev); 1462 /* Blink LEDS so users know driver saw dongle */
1350 dbg("PHYID=0x%08x", phyid); 1463 asix_sw_reset(dev, 0);
1351 1464 msleep(150);
1352 if (data->phymode == PHY_MODE_MARVELL) {
1353 marvell_phy_init(dev);
1354 msleep(60);
1355 }
1356
1357 asix_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR,
1358 BMCR_RESET | BMCR_ANENABLE);
1359 asix_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE,
1360 ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP);
1361 asix_mdio_write(dev->net, dev->mii.phy_id, MII_CTRL1000,
1362 ADVERTISE_1000FULL);
1363
1364 mii_nway_restart(&dev->mii);
1365
1366 if ((ret = asix_write_medium_mode(dev, AX88178_MEDIUM_DEFAULT)) < 0)
1367 goto out;
1368 1465
1369 if ((ret = asix_write_rx_ctl(dev, AX_DEFAULT_RX_CTL)) < 0) 1466 asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD);
1370 goto out; 1467 msleep(150);
1371 1468
1372 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 1469 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
1373 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 1470 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
@@ -1375,10 +1472,8 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
1375 jumbo eth frames */ 1472 jumbo eth frames */
1376 dev->rx_urb_size = 2048; 1473 dev->rx_urb_size = 2048;
1377 } 1474 }
1378 return 0;
1379 1475
1380out: 1476 return 0;
1381 return ret;
1382} 1477}
1383 1478
1384static const struct driver_info ax8817x_info = { 1479static const struct driver_info ax8817x_info = {
@@ -1426,7 +1521,7 @@ static const struct driver_info ax88772_info = {
1426 .bind = ax88772_bind, 1521 .bind = ax88772_bind,
1427 .status = asix_status, 1522 .status = asix_status,
1428 .link_reset = ax88772_link_reset, 1523 .link_reset = ax88772_link_reset,
1429 .reset = ax88772_link_reset, 1524 .reset = ax88772_reset,
1430 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR, 1525 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR,
1431 .rx_fixup = asix_rx_fixup, 1526 .rx_fixup = asix_rx_fixup,
1432 .tx_fixup = asix_tx_fixup, 1527 .tx_fixup = asix_tx_fixup,
@@ -1437,7 +1532,7 @@ static const struct driver_info ax88178_info = {
1437 .bind = ax88178_bind, 1532 .bind = ax88178_bind,
1438 .status = asix_status, 1533 .status = asix_status,
1439 .link_reset = ax88178_link_reset, 1534 .link_reset = ax88178_link_reset,
1440 .reset = ax88178_link_reset, 1535 .reset = ax88178_reset,
1441 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR, 1536 .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_LINK_INTR,
1442 .rx_fixup = asix_rx_fixup, 1537 .rx_fixup = asix_rx_fixup,
1443 .tx_fixup = asix_tx_fixup, 1538 .tx_fixup = asix_tx_fixup,
@@ -1566,7 +1661,7 @@ static const struct usb_device_id products [] = {
1566MODULE_DEVICE_TABLE(usb, products); 1661MODULE_DEVICE_TABLE(usb, products);
1567 1662
1568static struct usb_driver asix_driver = { 1663static struct usb_driver asix_driver = {
1569 .name = "asix", 1664 .name = DRIVER_NAME,
1570 .id_table = products, 1665 .id_table = products,
1571 .probe = usbnet_probe, 1666 .probe = usbnet_probe,
1572 .suspend = usbnet_suspend, 1667 .suspend = usbnet_suspend,
@@ -1588,6 +1683,7 @@ static void __exit asix_exit(void)
1588module_exit(asix_exit); 1683module_exit(asix_exit);
1589 1684
1590MODULE_AUTHOR("David Hollis"); 1685MODULE_AUTHOR("David Hollis");
1686MODULE_VERSION(DRIVER_VERSION);
1591MODULE_DESCRIPTION("ASIX AX8817X based USB 2.0 Ethernet Devices"); 1687MODULE_DESCRIPTION("ASIX AX8817X based USB 2.0 Ethernet Devices");
1592MODULE_LICENSE("GPL"); 1688MODULE_LICENSE("GPL");
1593 1689
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 8056f8a27c6a..a68272c93381 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -749,7 +749,7 @@ static const struct net_device_ops catc_netdev_ops = {
749 .ndo_start_xmit = catc_start_xmit, 749 .ndo_start_xmit = catc_start_xmit,
750 750
751 .ndo_tx_timeout = catc_tx_timeout, 751 .ndo_tx_timeout = catc_tx_timeout,
752 .ndo_set_multicast_list = catc_set_multicast_list, 752 .ndo_set_rx_mode = catc_set_multicast_list,
753 .ndo_change_mtu = eth_change_mtu, 753 .ndo_change_mtu = eth_change_mtu,
754 .ndo_set_mac_address = eth_mac_addr, 754 .ndo_set_mac_address = eth_mac_addr,
755 .ndo_validate_addr = eth_validate_addr, 755 .ndo_validate_addr = eth_validate_addr,
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index c924ea2bce07..99ed6eb4dfaf 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -567,7 +567,7 @@ static const struct usb_device_id products [] = {
567{ 567{
568 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, 568 USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM,
569 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), 569 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
570 .driver_info = (unsigned long)&wwan_info, 570 .driver_info = 0,
571}, 571},
572 572
573/* 573/*
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c
index 1d93133e9b74..fbc0e4def767 100644
--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -428,7 +428,7 @@ static const struct net_device_ops dm9601_netdev_ops = {
428 .ndo_change_mtu = usbnet_change_mtu, 428 .ndo_change_mtu = usbnet_change_mtu,
429 .ndo_validate_addr = eth_validate_addr, 429 .ndo_validate_addr = eth_validate_addr,
430 .ndo_do_ioctl = dm9601_ioctl, 430 .ndo_do_ioctl = dm9601_ioctl,
431 .ndo_set_multicast_list = dm9601_set_multicast, 431 .ndo_set_rx_mode = dm9601_set_multicast,
432 .ndo_set_mac_address = dm9601_set_mac_address, 432 .ndo_set_mac_address = dm9601_set_mac_address,
433}; 433};
434 434
diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c
index be02a25da71a..131ac6c172f6 100644
--- a/drivers/net/usb/int51x1.c
+++ b/drivers/net/usb/int51x1.c
@@ -193,7 +193,7 @@ static const struct net_device_ops int51x1_netdev_ops = {
193 .ndo_change_mtu = usbnet_change_mtu, 193 .ndo_change_mtu = usbnet_change_mtu,
194 .ndo_set_mac_address = eth_mac_addr, 194 .ndo_set_mac_address = eth_mac_addr,
195 .ndo_validate_addr = eth_validate_addr, 195 .ndo_validate_addr = eth_validate_addr,
196 .ndo_set_multicast_list = int51x1_set_multicast, 196 .ndo_set_rx_mode = int51x1_set_multicast,
197}; 197};
198 198
199static int int51x1_bind(struct usbnet *dev, struct usb_interface *intf) 199static int int51x1_bind(struct usbnet *dev, struct usb_interface *intf)
diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c
index 15772b1b6a91..13c1f044b40d 100644
--- a/drivers/net/usb/ipheth.c
+++ b/drivers/net/usb/ipheth.c
@@ -59,6 +59,7 @@
59#define USB_PRODUCT_IPHONE_3G 0x1292 59#define USB_PRODUCT_IPHONE_3G 0x1292
60#define USB_PRODUCT_IPHONE_3GS 0x1294 60#define USB_PRODUCT_IPHONE_3GS 0x1294
61#define USB_PRODUCT_IPHONE_4 0x1297 61#define USB_PRODUCT_IPHONE_4 0x1297
62#define USB_PRODUCT_IPHONE_4_VZW 0x129c
62 63
63#define IPHETH_USBINTF_CLASS 255 64#define IPHETH_USBINTF_CLASS 255
64#define IPHETH_USBINTF_SUBCLASS 253 65#define IPHETH_USBINTF_SUBCLASS 253
@@ -98,6 +99,10 @@ static struct usb_device_id ipheth_table[] = {
98 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4, 99 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4,
99 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS, 100 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
100 IPHETH_USBINTF_PROTO) }, 101 IPHETH_USBINTF_PROTO) },
102 { USB_DEVICE_AND_INTERFACE_INFO(
103 USB_VENDOR_APPLE, USB_PRODUCT_IPHONE_4_VZW,
104 IPHETH_USBINTF_CLASS, IPHETH_USBINTF_SUBCLASS,
105 IPHETH_USBINTF_PROTO) },
101 { } 106 { }
102}; 107};
103MODULE_DEVICE_TABLE(usb, ipheth_table); 108MODULE_DEVICE_TABLE(usb, ipheth_table);
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index ad0298f9b5f9..582ca2dfa5f9 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -985,7 +985,7 @@ static const struct net_device_ops kaweth_netdev_ops = {
985 .ndo_stop = kaweth_close, 985 .ndo_stop = kaweth_close,
986 .ndo_start_xmit = kaweth_start_xmit, 986 .ndo_start_xmit = kaweth_start_xmit,
987 .ndo_tx_timeout = kaweth_tx_timeout, 987 .ndo_tx_timeout = kaweth_tx_timeout,
988 .ndo_set_multicast_list = kaweth_set_rx_mode, 988 .ndo_set_rx_mode = kaweth_set_rx_mode,
989 .ndo_get_stats = kaweth_netdev_stats, 989 .ndo_get_stats = kaweth_netdev_stats,
990 .ndo_change_mtu = eth_change_mtu, 990 .ndo_change_mtu = eth_change_mtu,
991 .ndo_set_mac_address = eth_mac_addr, 991 .ndo_set_mac_address = eth_mac_addr,
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c
index 1d83ccfd7277..9c26c6390d69 100644
--- a/drivers/net/usb/lg-vl600.c
+++ b/drivers/net/usb/lg-vl600.c
@@ -27,6 +27,7 @@
27#include <linux/if_ether.h> 27#include <linux/if_ether.h>
28#include <linux/if_arp.h> 28#include <linux/if_arp.h>
29#include <linux/inetdevice.h> 29#include <linux/inetdevice.h>
30#include <linux/module.h>
30 31
31/* 32/*
32 * The device has a CDC ACM port for modem control (it claims to be 33 * The device has a CDC ACM port for modem control (it claims to be
@@ -89,6 +90,8 @@ static int vl600_bind(struct usbnet *dev, struct usb_interface *intf)
89 * addresses have no meaning, the destination and the source of every 90 * addresses have no meaning, the destination and the source of every
90 * packet depend only on whether it is on the IN or OUT endpoint. */ 91 * packet depend only on whether it is on the IN or OUT endpoint. */
91 dev->net->flags |= IFF_NOARP; 92 dev->net->flags |= IFF_NOARP;
93 /* IPv6 NDP relies on multicast. Enable it by default. */
94 dev->net->flags |= IFF_MULTICAST;
92 95
93 return ret; 96 return ret;
94} 97}
@@ -141,10 +144,11 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
141 } 144 }
142 145
143 frame = (struct vl600_frame_hdr *) buf->data; 146 frame = (struct vl600_frame_hdr *) buf->data;
144 /* NOTE: Should check that frame->magic == 0x53544448? 147 /* Yes, check that frame->magic == 0x53544448 (or 0x44544d48),
145 * Otherwise if we receive garbage at the beginning of the frame 148 * otherwise we may run out of memory w/a bad packet */
146 * we may end up allocating a huge buffer and saving all the 149 if (ntohl(frame->magic) != 0x53544448 &&
147 * future incoming data into it. */ 150 ntohl(frame->magic) != 0x44544d48)
151 goto error;
148 152
149 if (buf->len < sizeof(*frame) || 153 if (buf->len < sizeof(*frame) ||
150 buf->len != le32_to_cpup(&frame->len)) { 154 buf->len != le32_to_cpup(&frame->len)) {
@@ -200,6 +204,14 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
200 } else { 204 } else {
201 memset(ethhdr->h_source, 0, ETH_ALEN); 205 memset(ethhdr->h_source, 0, ETH_ALEN);
202 memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN); 206 memcpy(ethhdr->h_dest, dev->net->dev_addr, ETH_ALEN);
207
208 /* Inbound IPv6 packets have an IPv4 ethertype (0x800)
209 * for some reason. Peek at the L3 header to check
210 * for IPv6 packets, and set the ethertype to IPv6
211 * (0x86dd) so Linux can understand it.
212 */
213 if ((buf->data[sizeof(*ethhdr)] & 0xf0) == 0x60)
214 ethhdr->h_proto = __constant_htons(ETH_P_IPV6);
203 } 215 }
204 216
205 if (count) { 217 if (count) {
@@ -285,6 +297,11 @@ encapsulate:
285 * overwrite the remaining fields. 297 * overwrite the remaining fields.
286 */ 298 */
287 packet = (struct vl600_pkt_hdr *) skb->data; 299 packet = (struct vl600_pkt_hdr *) skb->data;
300 /* The VL600 wants IPv6 packets to have an IPv4 ethertype
301 * Since this modem only supports IPv4 and IPv6, just set all
302 * frames to 0x0800 (ETH_P_IP)
303 */
304 packet->h_proto = htons(ETH_P_IP);
288 memset(&packet->dummy, 0, sizeof(packet->dummy)); 305 memset(&packet->dummy, 0, sizeof(packet->dummy));
289 packet->len = cpu_to_le32(orig_len); 306 packet->len = cpu_to_le32(orig_len);
290 307
@@ -302,7 +319,7 @@ encapsulate:
302 319
303static const struct driver_info vl600_info = { 320static const struct driver_info vl600_info = {
304 .description = "LG VL600 modem", 321 .description = "LG VL600 modem",
305 .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE, 322 .flags = FLAG_RX_ASSEMBLE | FLAG_WWAN,
306 .bind = vl600_bind, 323 .bind = vl600_bind,
307 .unbind = vl600_unbind, 324 .unbind = vl600_unbind,
308 .status = usbnet_cdc_status, 325 .status = usbnet_cdc_status,
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 2b791392e788..db2cb74bf854 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -553,7 +553,7 @@ static const struct net_device_ops mcs7830_netdev_ops = {
553 .ndo_change_mtu = usbnet_change_mtu, 553 .ndo_change_mtu = usbnet_change_mtu,
554 .ndo_validate_addr = eth_validate_addr, 554 .ndo_validate_addr = eth_validate_addr,
555 .ndo_do_ioctl = mcs7830_ioctl, 555 .ndo_do_ioctl = mcs7830_ioctl,
556 .ndo_set_multicast_list = mcs7830_set_multicast, 556 .ndo_set_rx_mode = mcs7830_set_multicast,
557 .ndo_set_mac_address = mcs7830_set_mac_address, 557 .ndo_set_mac_address = mcs7830_set_mac_address,
558}; 558};
559 559
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index ef3667690b12..769f5090bda1 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1476,7 +1476,7 @@ static const struct net_device_ops pegasus_netdev_ops = {
1476 .ndo_stop = pegasus_close, 1476 .ndo_stop = pegasus_close,
1477 .ndo_do_ioctl = pegasus_ioctl, 1477 .ndo_do_ioctl = pegasus_ioctl,
1478 .ndo_start_xmit = pegasus_start_xmit, 1478 .ndo_start_xmit = pegasus_start_xmit,
1479 .ndo_set_multicast_list = pegasus_set_multicast, 1479 .ndo_set_rx_mode = pegasus_set_multicast,
1480 .ndo_get_stats = pegasus_netdev_stats, 1480 .ndo_get_stats = pegasus_netdev_stats,
1481 .ndo_tx_timeout = pegasus_tx_timeout, 1481 .ndo_tx_timeout = pegasus_tx_timeout,
1482 .ndo_change_mtu = eth_change_mtu, 1482 .ndo_change_mtu = eth_change_mtu,
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index ef3b236b5145..bf8c84d0adf2 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -169,26 +169,8 @@ struct rtl8150 {
169 169
170typedef struct rtl8150 rtl8150_t; 170typedef struct rtl8150 rtl8150_t;
171 171
172static void fill_skb_pool(rtl8150_t *);
173static void free_skb_pool(rtl8150_t *);
174static inline struct sk_buff *pull_skb(rtl8150_t *);
175static void rtl8150_disconnect(struct usb_interface *intf);
176static int rtl8150_probe(struct usb_interface *intf,
177 const struct usb_device_id *id);
178static int rtl8150_suspend(struct usb_interface *intf, pm_message_t message);
179static int rtl8150_resume(struct usb_interface *intf);
180
181static const char driver_name [] = "rtl8150"; 172static const char driver_name [] = "rtl8150";
182 173
183static struct usb_driver rtl8150_driver = {
184 .name = driver_name,
185 .probe = rtl8150_probe,
186 .disconnect = rtl8150_disconnect,
187 .id_table = rtl8150_table,
188 .suspend = rtl8150_suspend,
189 .resume = rtl8150_resume
190};
191
192/* 174/*
193** 175**
194** device related part of the code 176** device related part of the code
@@ -333,7 +315,7 @@ static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
333 /* Write the MAC address into eeprom. Eeprom writes must be word-sized, 315 /* Write the MAC address into eeprom. Eeprom writes must be word-sized,
334 so we need to split them up. */ 316 so we need to split them up. */
335 for (i = 0; i * 2 < netdev->addr_len; i++) { 317 for (i = 0; i * 2 < netdev->addr_len; i++) {
336 set_registers(dev, IDR_EEPROM + (i * 2), 2, 318 set_registers(dev, IDR_EEPROM + (i * 2), 2,
337 netdev->dev_addr + (i * 2)); 319 netdev->dev_addr + (i * 2));
338 } 320 }
339 /* Clear the WEPROM bit (preventing accidental eeprom writes). */ 321 /* Clear the WEPROM bit (preventing accidental eeprom writes). */
@@ -490,44 +472,6 @@ resched:
490 tasklet_schedule(&dev->tl); 472 tasklet_schedule(&dev->tl);
491} 473}
492 474
493static void rx_fixup(unsigned long data)
494{
495 rtl8150_t *dev;
496 struct sk_buff *skb;
497 int status;
498
499 dev = (rtl8150_t *)data;
500
501 spin_lock_irq(&dev->rx_pool_lock);
502 fill_skb_pool(dev);
503 spin_unlock_irq(&dev->rx_pool_lock);
504 if (test_bit(RX_URB_FAIL, &dev->flags))
505 if (dev->rx_skb)
506 goto try_again;
507 spin_lock_irq(&dev->rx_pool_lock);
508 skb = pull_skb(dev);
509 spin_unlock_irq(&dev->rx_pool_lock);
510 if (skb == NULL)
511 goto tlsched;
512 dev->rx_skb = skb;
513 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
514 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
515try_again:
516 status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
517 if (status == -ENODEV) {
518 netif_device_detach(dev->netdev);
519 } else if (status) {
520 set_bit(RX_URB_FAIL, &dev->flags);
521 goto tlsched;
522 } else {
523 clear_bit(RX_URB_FAIL, &dev->flags);
524 }
525
526 return;
527tlsched:
528 tasklet_schedule(&dev->tl);
529}
530
531static void write_bulk_callback(struct urb *urb) 475static void write_bulk_callback(struct urb *urb)
532{ 476{
533 rtl8150_t *dev; 477 rtl8150_t *dev;
@@ -665,6 +609,42 @@ static void free_skb_pool(rtl8150_t *dev)
665 dev_kfree_skb(dev->rx_skb_pool[i]); 609 dev_kfree_skb(dev->rx_skb_pool[i]);
666} 610}
667 611
612static void rx_fixup(unsigned long data)
613{
614 struct rtl8150 *dev = (struct rtl8150 *)data;
615 struct sk_buff *skb;
616 int status;
617
618 spin_lock_irq(&dev->rx_pool_lock);
619 fill_skb_pool(dev);
620 spin_unlock_irq(&dev->rx_pool_lock);
621 if (test_bit(RX_URB_FAIL, &dev->flags))
622 if (dev->rx_skb)
623 goto try_again;
624 spin_lock_irq(&dev->rx_pool_lock);
625 skb = pull_skb(dev);
626 spin_unlock_irq(&dev->rx_pool_lock);
627 if (skb == NULL)
628 goto tlsched;
629 dev->rx_skb = skb;
630 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
631 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
632try_again:
633 status = usb_submit_urb(dev->rx_urb, GFP_ATOMIC);
634 if (status == -ENODEV) {
635 netif_device_detach(dev->netdev);
636 } else if (status) {
637 set_bit(RX_URB_FAIL, &dev->flags);
638 goto tlsched;
639 } else {
640 clear_bit(RX_URB_FAIL, &dev->flags);
641 }
642
643 return;
644tlsched:
645 tasklet_schedule(&dev->tl);
646}
647
668static int enable_net_traffic(rtl8150_t * dev) 648static int enable_net_traffic(rtl8150_t * dev)
669{ 649{
670 u8 cr, tcr, rcr, msr; 650 u8 cr, tcr, rcr, msr;
@@ -778,7 +758,7 @@ static int rtl8150_open(struct net_device *netdev)
778 return -ENOMEM; 758 return -ENOMEM;
779 759
780 set_registers(dev, IDR, 6, netdev->dev_addr); 760 set_registers(dev, IDR, 6, netdev->dev_addr);
781 761
782 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1), 762 usb_fill_bulk_urb(dev->rx_urb, dev->udev, usb_rcvbulkpipe(dev->udev, 1),
783 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev); 763 dev->rx_skb->data, RTL8150_MTU, read_bulk_callback, dev);
784 if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) { 764 if ((res = usb_submit_urb(dev->rx_urb, GFP_KERNEL))) {
@@ -898,8 +878,8 @@ static const struct net_device_ops rtl8150_netdev_ops = {
898 .ndo_stop = rtl8150_close, 878 .ndo_stop = rtl8150_close,
899 .ndo_do_ioctl = rtl8150_ioctl, 879 .ndo_do_ioctl = rtl8150_ioctl,
900 .ndo_start_xmit = rtl8150_start_xmit, 880 .ndo_start_xmit = rtl8150_start_xmit,
901 .ndo_tx_timeout = rtl8150_tx_timeout, 881 .ndo_tx_timeout = rtl8150_tx_timeout,
902 .ndo_set_multicast_list = rtl8150_set_multicast, 882 .ndo_set_rx_mode = rtl8150_set_multicast,
903 .ndo_set_mac_address = rtl8150_set_mac_address, 883 .ndo_set_mac_address = rtl8150_set_mac_address,
904 884
905 .ndo_change_mtu = eth_change_mtu, 885 .ndo_change_mtu = eth_change_mtu,
@@ -929,7 +909,7 @@ static int rtl8150_probe(struct usb_interface *intf,
929 909
930 tasklet_init(&dev->tl, rx_fixup, (unsigned long)dev); 910 tasklet_init(&dev->tl, rx_fixup, (unsigned long)dev);
931 spin_lock_init(&dev->rx_pool_lock); 911 spin_lock_init(&dev->rx_pool_lock);
932 912
933 dev->udev = udev; 913 dev->udev = udev;
934 dev->netdev = netdev; 914 dev->netdev = netdev;
935 netdev->netdev_ops = &rtl8150_netdev_ops; 915 netdev->netdev_ops = &rtl8150_netdev_ops;
@@ -947,7 +927,7 @@ static int rtl8150_probe(struct usb_interface *intf,
947 } 927 }
948 fill_skb_pool(dev); 928 fill_skb_pool(dev);
949 set_ethernet_addr(dev); 929 set_ethernet_addr(dev);
950 930
951 usb_set_intfdata(intf, dev); 931 usb_set_intfdata(intf, dev);
952 SET_NETDEV_DEV(netdev, &intf->dev); 932 SET_NETDEV_DEV(netdev, &intf->dev);
953 if (register_netdev(netdev) != 0) { 933 if (register_netdev(netdev) != 0) {
@@ -989,6 +969,15 @@ static void rtl8150_disconnect(struct usb_interface *intf)
989 } 969 }
990} 970}
991 971
972static struct usb_driver rtl8150_driver = {
973 .name = driver_name,
974 .probe = rtl8150_probe,
975 .disconnect = rtl8150_disconnect,
976 .id_table = rtl8150_table,
977 .suspend = rtl8150_suspend,
978 .resume = rtl8150_resume
979};
980
992static int __init usb_rtl8150_init(void) 981static int __init usb_rtl8150_init(void)
993{ 982{
994 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":" 983 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 15b3d6888ae9..a5b9b12ef268 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -51,6 +51,7 @@
51#define USB_VENDOR_ID_SMSC (0x0424) 51#define USB_VENDOR_ID_SMSC (0x0424)
52#define USB_PRODUCT_ID_LAN7500 (0x7500) 52#define USB_PRODUCT_ID_LAN7500 (0x7500)
53#define USB_PRODUCT_ID_LAN7505 (0x7505) 53#define USB_PRODUCT_ID_LAN7505 (0x7505)
54#define RXW_PADDING 2
54 55
55#define check_warn(ret, fmt, args...) \ 56#define check_warn(ret, fmt, args...) \
56 ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); }) 57 ({ if (ret < 0) netdev_warn(dev->net, fmt, ##args); })
@@ -1000,7 +1001,7 @@ static const struct net_device_ops smsc75xx_netdev_ops = {
1000 .ndo_set_mac_address = eth_mac_addr, 1001 .ndo_set_mac_address = eth_mac_addr,
1001 .ndo_validate_addr = eth_validate_addr, 1002 .ndo_validate_addr = eth_validate_addr,
1002 .ndo_do_ioctl = smsc75xx_ioctl, 1003 .ndo_do_ioctl = smsc75xx_ioctl,
1003 .ndo_set_multicast_list = smsc75xx_set_multicast, 1004 .ndo_set_rx_mode = smsc75xx_set_multicast,
1004 .ndo_set_features = smsc75xx_set_features, 1005 .ndo_set_features = smsc75xx_set_features,
1005}; 1006};
1006 1007
@@ -1088,13 +1089,13 @@ static int smsc75xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
1088 1089
1089 memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b)); 1090 memcpy(&rx_cmd_b, skb->data, sizeof(rx_cmd_b));
1090 le32_to_cpus(&rx_cmd_b); 1091 le32_to_cpus(&rx_cmd_b);
1091 skb_pull(skb, 4 + NET_IP_ALIGN); 1092 skb_pull(skb, 4 + RXW_PADDING);
1092 1093
1093 packet = skb->data; 1094 packet = skb->data;
1094 1095
1095 /* get the packet length */ 1096 /* get the packet length */
1096 size = (rx_cmd_a & RX_CMD_A_LEN) - NET_IP_ALIGN; 1097 size = (rx_cmd_a & RX_CMD_A_LEN) - RXW_PADDING;
1097 align_count = (4 - ((size + NET_IP_ALIGN) % 4)) % 4; 1098 align_count = (4 - ((size + RXW_PADDING) % 4)) % 4;
1098 1099
1099 if (unlikely(rx_cmd_a & RX_CMD_A_RED)) { 1100 if (unlikely(rx_cmd_a & RX_CMD_A_RED)) {
1100 netif_dbg(dev, rx_err, dev->net, 1101 netif_dbg(dev, rx_err, dev->net,
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index f74f3ce71526..eff67678c5a6 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -972,7 +972,7 @@ static const struct net_device_ops smsc95xx_netdev_ops = {
972 .ndo_set_mac_address = eth_mac_addr, 972 .ndo_set_mac_address = eth_mac_addr,
973 .ndo_validate_addr = eth_validate_addr, 973 .ndo_validate_addr = eth_validate_addr,
974 .ndo_do_ioctl = smsc95xx_ioctl, 974 .ndo_do_ioctl = smsc95xx_ioctl,
975 .ndo_set_multicast_list = smsc95xx_set_multicast, 975 .ndo_set_rx_mode = smsc95xx_set_multicast,
976 .ndo_set_features = smsc95xx_set_features, 976 .ndo_set_features = smsc95xx_set_features,
977}; 977};
978 978
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index ce395fe5de26..fae0fbd8bc88 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -238,6 +238,10 @@ void usbnet_skb_return (struct usbnet *dev, struct sk_buff *skb)
238 netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n", 238 netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
239 skb->len + sizeof (struct ethhdr), skb->protocol); 239 skb->len + sizeof (struct ethhdr), skb->protocol);
240 memset (skb->cb, 0, sizeof (struct skb_data)); 240 memset (skb->cb, 0, sizeof (struct skb_data));
241
242 if (skb_defer_rx_timestamp(skb))
243 return;
244
241 status = netif_rx (skb); 245 status = netif_rx (skb);
242 if (status != NET_RX_SUCCESS) 246 if (status != NET_RX_SUCCESS)
243 netif_dbg(dev, rx_err, dev->net, 247 netif_dbg(dev, rx_err, dev->net,
@@ -1053,6 +1057,9 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
1053 unsigned long flags; 1057 unsigned long flags;
1054 int retval; 1058 int retval;
1055 1059
1060 if (skb)
1061 skb_tx_timestamp(skb);
1062
1056 // some devices want funky USB-level framing, for 1063 // some devices want funky USB-level framing, for
1057 // win32 driver (usually) and/or hardware quirks 1064 // win32 driver (usually) and/or hardware quirks
1058 if (info->tx_fixup) { 1065 if (info->tx_fixup) {
@@ -1470,7 +1477,7 @@ int usbnet_suspend (struct usb_interface *intf, pm_message_t message)
1470 if (!dev->suspend_count++) { 1477 if (!dev->suspend_count++) {
1471 spin_lock_irq(&dev->txq.lock); 1478 spin_lock_irq(&dev->txq.lock);
1472 /* don't autosuspend while transmitting */ 1479 /* don't autosuspend while transmitting */
1473 if (dev->txq.qlen && (message.event & PM_EVENT_AUTO)) { 1480 if (dev->txq.qlen && PMSG_IS_AUTO(message)) {
1474 spin_unlock_irq(&dev->txq.lock); 1481 spin_unlock_irq(&dev->txq.lock);
1475 return -EBUSY; 1482 return -EBUSY;
1476 } else { 1483 } else {