diff options
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/asix.c | 72 | ||||
-rw-r--r-- | drivers/net/usb/cdc_ether.c | 2 | ||||
-rw-r--r-- | drivers/net/usb/lg-vl600.c | 25 | ||||
-rw-r--r-- | drivers/net/usb/smsc75xx.c | 7 |
4 files changed, 72 insertions, 34 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 97a1cc7ce684..823715ac1277 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -36,7 +36,7 @@ | |||
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 "26-Sep-2011" | 39 | #define DRIVER_VERSION "08-Nov-2011" |
40 | #define 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 */ |
@@ -163,7 +163,7 @@ | |||
163 | #define MARVELL_CTRL_TXDELAY 0x0002 | 163 | #define MARVELL_CTRL_TXDELAY 0x0002 |
164 | #define MARVELL_CTRL_RXDELAY 0x0080 | 164 | #define MARVELL_CTRL_RXDELAY 0x0080 |
165 | 165 | ||
166 | #define PHY_MODE_RTL8211CL 0x0004 | 166 | #define PHY_MODE_RTL8211CL 0x000C |
167 | 167 | ||
168 | /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ | 168 | /* This structure cannot exceed sizeof(unsigned long [5]) AKA 20 bytes */ |
169 | struct asix_data { | 169 | struct asix_data { |
@@ -652,9 +652,17 @@ static u32 asix_get_phyid(struct usbnet *dev) | |||
652 | { | 652 | { |
653 | int phy_reg; | 653 | int phy_reg; |
654 | u32 phy_id; | 654 | u32 phy_id; |
655 | int i; | ||
655 | 656 | ||
656 | 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. */ |
657 | 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) | ||
658 | return 0; | 666 | return 0; |
659 | 667 | ||
660 | phy_id = (phy_reg & 0xffff) << 16; | 668 | phy_id = (phy_reg & 0xffff) << 16; |
@@ -1075,7 +1083,7 @@ static const struct net_device_ops ax88772_netdev_ops = { | |||
1075 | 1083 | ||
1076 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | 1084 | static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) |
1077 | { | 1085 | { |
1078 | int ret; | 1086 | int ret, embd_phy; |
1079 | struct asix_data *data = (struct asix_data *)&dev->data; | 1087 | struct asix_data *data = (struct asix_data *)&dev->data; |
1080 | u8 buf[ETH_ALEN]; | 1088 | u8 buf[ETH_ALEN]; |
1081 | u32 phyid; | 1089 | u32 phyid; |
@@ -1100,16 +1108,36 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1100 | dev->mii.reg_num_mask = 0x1f; | 1108 | dev->mii.reg_num_mask = 0x1f; |
1101 | dev->mii.phy_id = asix_get_phy_addr(dev); | 1109 | dev->mii.phy_id = asix_get_phy_addr(dev); |
1102 | 1110 | ||
1103 | phyid = asix_get_phyid(dev); | ||
1104 | dbg("PHYID=0x%08x", phyid); | ||
1105 | |||
1106 | dev->net->netdev_ops = &ax88772_netdev_ops; | 1111 | dev->net->netdev_ops = &ax88772_netdev_ops; |
1107 | dev->net->ethtool_ops = &ax88772_ethtool_ops; | 1112 | dev->net->ethtool_ops = &ax88772_ethtool_ops; |
1108 | 1113 | ||
1109 | ret = ax88772_reset(dev); | 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); | ||
1110 | if (ret < 0) | 1130 | if (ret < 0) |
1111 | return ret; | 1131 | return ret; |
1112 | 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 | |||
1113 | /* 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 */ |
1114 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1142 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |
1115 | /* hard_mtu is still the default - the device does not support | 1143 | /* hard_mtu is still the default - the device does not support |
@@ -1220,6 +1248,7 @@ static int ax88178_reset(struct usbnet *dev) | |||
1220 | __le16 eeprom; | 1248 | __le16 eeprom; |
1221 | u8 status; | 1249 | u8 status; |
1222 | int gpio0 = 0; | 1250 | int gpio0 = 0; |
1251 | u32 phyid; | ||
1223 | 1252 | ||
1224 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); | 1253 | asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); |
1225 | dbg("GPIO Status: 0x%04x", status); | 1254 | dbg("GPIO Status: 0x%04x", status); |
@@ -1235,12 +1264,13 @@ static int ax88178_reset(struct usbnet *dev) | |||
1235 | data->ledmode = 0; | 1264 | data->ledmode = 0; |
1236 | gpio0 = 1; | 1265 | gpio0 = 1; |
1237 | } else { | 1266 | } else { |
1238 | data->phymode = le16_to_cpu(eeprom) & 7; | 1267 | data->phymode = le16_to_cpu(eeprom) & 0x7F; |
1239 | data->ledmode = le16_to_cpu(eeprom) >> 8; | 1268 | data->ledmode = le16_to_cpu(eeprom) >> 8; |
1240 | gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; | 1269 | gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; |
1241 | } | 1270 | } |
1242 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); | 1271 | dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); |
1243 | 1272 | ||
1273 | /* Power up external GigaPHY through AX88178 GPIO pin */ | ||
1244 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); | 1274 | asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); |
1245 | if ((le16_to_cpu(eeprom) >> 8) != 1) { | 1275 | if ((le16_to_cpu(eeprom) >> 8) != 1) { |
1246 | asix_write_gpio(dev, 0x003c, 30); | 1276 | asix_write_gpio(dev, 0x003c, 30); |
@@ -1252,6 +1282,13 @@ static int ax88178_reset(struct usbnet *dev) | |||
1252 | asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); | 1282 | asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); |
1253 | } | 1283 | } |
1254 | 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 | |||
1255 | asix_sw_reset(dev, 0); | 1292 | asix_sw_reset(dev, 0); |
1256 | msleep(150); | 1293 | msleep(150); |
1257 | 1294 | ||
@@ -1396,7 +1433,6 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1396 | { | 1433 | { |
1397 | int ret; | 1434 | int ret; |
1398 | u8 buf[ETH_ALEN]; | 1435 | u8 buf[ETH_ALEN]; |
1399 | u32 phyid; | ||
1400 | struct asix_data *data = (struct asix_data *)&dev->data; | 1436 | struct asix_data *data = (struct asix_data *)&dev->data; |
1401 | 1437 | ||
1402 | data->eeprom_len = AX88772_EEPROM_LEN; | 1438 | data->eeprom_len = AX88772_EEPROM_LEN; |
@@ -1423,12 +1459,12 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf) | |||
1423 | dev->net->netdev_ops = &ax88178_netdev_ops; | 1459 | dev->net->netdev_ops = &ax88178_netdev_ops; |
1424 | dev->net->ethtool_ops = &ax88178_ethtool_ops; | 1460 | dev->net->ethtool_ops = &ax88178_ethtool_ops; |
1425 | 1461 | ||
1426 | phyid = asix_get_phyid(dev); | 1462 | /* Blink LEDS so users know driver saw dongle */ |
1427 | dbg("PHYID=0x%08x", phyid); | 1463 | asix_sw_reset(dev, 0); |
1464 | msleep(150); | ||
1428 | 1465 | ||
1429 | ret = ax88178_reset(dev); | 1466 | asix_sw_reset(dev, AX_SWRESET_PRL | AX_SWRESET_IPPD); |
1430 | if (ret < 0) | 1467 | msleep(150); |
1431 | return ret; | ||
1432 | 1468 | ||
1433 | /* 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 */ |
1434 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { | 1470 | if (dev->driver_info->flags & FLAG_FRAMING_AX) { |
@@ -1619,6 +1655,10 @@ static const struct usb_device_id products [] = { | |||
1619 | // ASIX 88772a | 1655 | // ASIX 88772a |
1620 | USB_DEVICE(0x0db0, 0xa877), | 1656 | USB_DEVICE(0x0db0, 0xa877), |
1621 | .driver_info = (unsigned long) &ax88772_info, | 1657 | .driver_info = (unsigned long) &ax88772_info, |
1658 | }, { | ||
1659 | // Asus USB Ethernet Adapter | ||
1660 | USB_DEVICE (0x0b95, 0x7e2b), | ||
1661 | .driver_info = (unsigned long) &ax88772_info, | ||
1622 | }, | 1662 | }, |
1623 | { }, // END | 1663 | { }, // END |
1624 | }; | 1664 | }; |
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c index 26637c354299..41a61efc331e 100644 --- a/drivers/net/usb/cdc_ether.c +++ b/drivers/net/usb/cdc_ether.c | |||
@@ -570,7 +570,7 @@ static const struct usb_device_id products [] = { | |||
570 | { | 570 | { |
571 | USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, | 571 | USB_DEVICE_AND_INTERFACE_INFO(0x1004, 0x61aa, USB_CLASS_COMM, |
572 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), | 572 | USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), |
573 | .driver_info = (unsigned long)&wwan_info, | 573 | .driver_info = 0, |
574 | }, | 574 | }, |
575 | 575 | ||
576 | /* | 576 | /* |
diff --git a/drivers/net/usb/lg-vl600.c b/drivers/net/usb/lg-vl600.c index 497db19f8cf8..45a981fde43f 100644 --- a/drivers/net/usb/lg-vl600.c +++ b/drivers/net/usb/lg-vl600.c | |||
@@ -144,10 +144,11 @@ static int vl600_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | frame = (struct vl600_frame_hdr *) buf->data; | 146 | frame = (struct vl600_frame_hdr *) buf->data; |
147 | /* NOTE: Should check that frame->magic == 0x53544448? | 147 | /* Yes, check that frame->magic == 0x53544448 (or 0x44544d48), |
148 | * Otherwise if we receive garbage at the beginning of the frame | 148 | * otherwise we may run out of memory w/a bad packet */ |
149 | * we may end up allocating a huge buffer and saving all the | 149 | if (ntohl(frame->magic) != 0x53544448 && |
150 | * future incoming data into it. */ | 150 | ntohl(frame->magic) != 0x44544d48) |
151 | goto error; | ||
151 | 152 | ||
152 | if (buf->len < sizeof(*frame) || | 153 | if (buf->len < sizeof(*frame) || |
153 | buf->len != le32_to_cpup(&frame->len)) { | 154 | buf->len != le32_to_cpup(&frame->len)) { |
@@ -296,6 +297,11 @@ encapsulate: | |||
296 | * overwrite the remaining fields. | 297 | * overwrite the remaining fields. |
297 | */ | 298 | */ |
298 | 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); | ||
299 | memset(&packet->dummy, 0, sizeof(packet->dummy)); | 305 | memset(&packet->dummy, 0, sizeof(packet->dummy)); |
300 | packet->len = cpu_to_le32(orig_len); | 306 | packet->len = cpu_to_le32(orig_len); |
301 | 307 | ||
@@ -308,21 +314,12 @@ encapsulate: | |||
308 | if (skb->len < full_len) /* Pad */ | 314 | if (skb->len < full_len) /* Pad */ |
309 | skb_put(skb, full_len - skb->len); | 315 | skb_put(skb, full_len - skb->len); |
310 | 316 | ||
311 | /* The VL600 wants IPv6 packets to have an IPv4 ethertype | ||
312 | * Check if this is an IPv6 packet, and set the ethertype | ||
313 | * to 0x800 | ||
314 | */ | ||
315 | if ((skb->data[sizeof(struct vl600_pkt_hdr *) + 0x22] & 0xf0) == 0x60) { | ||
316 | skb->data[sizeof(struct vl600_pkt_hdr *) + 0x20] = 0x08; | ||
317 | skb->data[sizeof(struct vl600_pkt_hdr *) + 0x21] = 0; | ||
318 | } | ||
319 | |||
320 | return skb; | 317 | return skb; |
321 | } | 318 | } |
322 | 319 | ||
323 | static const struct driver_info vl600_info = { | 320 | static const struct driver_info vl600_info = { |
324 | .description = "LG VL600 modem", | 321 | .description = "LG VL600 modem", |
325 | .flags = FLAG_ETHER | FLAG_RX_ASSEMBLE, | 322 | .flags = FLAG_RX_ASSEMBLE | FLAG_WWAN, |
326 | .bind = vl600_bind, | 323 | .bind = vl600_bind, |
327 | .unbind = vl600_unbind, | 324 | .unbind = vl600_unbind, |
328 | .status = usbnet_cdc_status, | 325 | .status = usbnet_cdc_status, |
diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c index 9741b24f0668..e85840ee36e0 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); }) |
@@ -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, |