aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb/asix_devices.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 16:38:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-02 16:38:27 -0400
commitaecdc33e111b2c447b622e287c6003726daa1426 (patch)
tree3e7657eae4b785e1a1fb5dfb225dbae0b2f0cfc6 /drivers/net/usb/asix_devices.c
parenta20acf99f75e49271381d65db097c9763060a1e8 (diff)
parenta3a6cab5ea10cca64d036851fe0d932448f2fe4f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking changes from David Miller: 1) GRE now works over ipv6, from Dmitry Kozlov. 2) Make SCTP more network namespace aware, from Eric Biederman. 3) TEAM driver now works with non-ethernet devices, from Jiri Pirko. 4) Make openvswitch network namespace aware, from Pravin B Shelar. 5) IPV6 NAT implementation, from Patrick McHardy. 6) Server side support for TCP Fast Open, from Jerry Chu and others. 7) Packet BPF filter supports MOD and XOR, from Eric Dumazet and Daniel Borkmann. 8) Increate the loopback default MTU to 64K, from Eric Dumazet. 9) Use a per-task rather than per-socket page fragment allocator for outgoing networking traffic. This benefits processes that have very many mostly idle sockets, which is quite common. From Eric Dumazet. 10) Use up to 32K for page fragment allocations, with fallbacks to smaller sizes when higher order page allocations fail. Benefits are a) less segments for driver to process b) less calls to page allocator c) less waste of space. From Eric Dumazet. 11) Allow GRO to be used on GRE tunnels, from Eric Dumazet. 12) VXLAN device driver, one way to handle VLAN issues such as the limitation of 4096 VLAN IDs yet still have some level of isolation. From Stephen Hemminger. 13) As usual there is a large boatload of driver changes, with the scale perhaps tilted towards the wireless side this time around. Fix up various fairly trivial conflicts, mostly caused by the user namespace changes. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1012 commits) hyperv: Add buffer for extended info after the RNDIS response message. hyperv: Report actual status in receive completion packet hyperv: Remove extra allocated space for recv_pkt_list elements hyperv: Fix page buffer handling in rndis_filter_send_request() hyperv: Fix the missing return value in rndis_filter_set_packet_filter() hyperv: Fix the max_xfer_size in RNDIS initialization vxlan: put UDP socket in correct namespace vxlan: Depend on CONFIG_INET sfc: Fix the reported priorities of different filter types sfc: Remove EFX_FILTER_FLAG_RX_OVERRIDE_IP sfc: Fix loopback self-test with separate_tx_channels=1 sfc: Fix MCDI structure field lookup sfc: Add parentheses around use of bitfield macro arguments sfc: Fix null function pointer in efx_sriov_channel_type vxlan: virtual extensible lan igmp: export symbol ip_mc_leave_group netlink: add attributes to fdb interface tg3: unconditionally select HWMON support when tg3 is enabled. Revert "net: ti cpsw ethernet: allow reading phy interface mode from DT" gre: fix sparse warning ...
Diffstat (limited to 'drivers/net/usb/asix_devices.c')
-rw-r--r--drivers/net/usb/asix_devices.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
index 32e31c5c5dc6..33ab824773c5 100644
--- a/drivers/net/usb/asix_devices.c
+++ b/drivers/net/usb/asix_devices.c
@@ -221,7 +221,8 @@ static int ax88172_bind(struct usbnet *dev, struct usb_interface *intf)
221 /* Get the MAC address */ 221 /* Get the MAC address */
222 ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf); 222 ret = asix_read_cmd(dev, AX88172_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
223 if (ret < 0) { 223 if (ret < 0) {
224 dbg("read AX_CMD_READ_NODE_ID failed: %d", ret); 224 netdev_dbg(dev->net, "read AX_CMD_READ_NODE_ID failed: %d\n",
225 ret);
225 goto out; 226 goto out;
226 } 227 }
227 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 228 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
@@ -303,7 +304,7 @@ static int ax88772_reset(struct usbnet *dev)
303 304
304 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL); 305 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
305 if (ret < 0) { 306 if (ret < 0) {
306 dbg("Select PHY #1 failed: %d", ret); 307 netdev_dbg(dev->net, "Select PHY #1 failed: %d\n", ret);
307 goto out; 308 goto out;
308 } 309 }
309 310
@@ -331,13 +332,13 @@ static int ax88772_reset(struct usbnet *dev)
331 332
332 msleep(150); 333 msleep(150);
333 rx_ctl = asix_read_rx_ctl(dev); 334 rx_ctl = asix_read_rx_ctl(dev);
334 dbg("RX_CTL is 0x%04x after software reset", rx_ctl); 335 netdev_dbg(dev->net, "RX_CTL is 0x%04x after software reset\n", rx_ctl);
335 ret = asix_write_rx_ctl(dev, 0x0000); 336 ret = asix_write_rx_ctl(dev, 0x0000);
336 if (ret < 0) 337 if (ret < 0)
337 goto out; 338 goto out;
338 339
339 rx_ctl = asix_read_rx_ctl(dev); 340 rx_ctl = asix_read_rx_ctl(dev);
340 dbg("RX_CTL is 0x%04x setting to 0x0000", rx_ctl); 341 netdev_dbg(dev->net, "RX_CTL is 0x%04x setting to 0x0000\n", rx_ctl);
341 342
342 ret = asix_sw_reset(dev, AX_SWRESET_PRL); 343 ret = asix_sw_reset(dev, AX_SWRESET_PRL);
343 if (ret < 0) 344 if (ret < 0)
@@ -364,7 +365,7 @@ static int ax88772_reset(struct usbnet *dev)
364 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT, 365 AX88772_IPG0_DEFAULT | AX88772_IPG1_DEFAULT,
365 AX88772_IPG2_DEFAULT, 0, NULL); 366 AX88772_IPG2_DEFAULT, 0, NULL);
366 if (ret < 0) { 367 if (ret < 0) {
367 dbg("Write IPG,IPG1,IPG2 failed: %d", ret); 368 netdev_dbg(dev->net, "Write IPG,IPG1,IPG2 failed: %d\n", ret);
368 goto out; 369 goto out;
369 } 370 }
370 371
@@ -381,10 +382,13 @@ static int ax88772_reset(struct usbnet *dev)
381 goto out; 382 goto out;
382 383
383 rx_ctl = asix_read_rx_ctl(dev); 384 rx_ctl = asix_read_rx_ctl(dev);
384 dbg("RX_CTL is 0x%04x after all initializations", rx_ctl); 385 netdev_dbg(dev->net, "RX_CTL is 0x%04x after all initializations\n",
386 rx_ctl);
385 387
386 rx_ctl = asix_read_medium_status(dev); 388 rx_ctl = asix_read_medium_status(dev);
387 dbg("Medium Status is 0x%04x after all initializations", rx_ctl); 389 netdev_dbg(dev->net,
390 "Medium Status is 0x%04x after all initializations\n",
391 rx_ctl);
388 392
389 return 0; 393 return 0;
390 394
@@ -416,7 +420,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
416 /* Get the MAC address */ 420 /* Get the MAC address */
417 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf); 421 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
418 if (ret < 0) { 422 if (ret < 0) {
419 dbg("Failed to read MAC address: %d", ret); 423 netdev_dbg(dev->net, "Failed to read MAC address: %d\n", ret);
420 return ret; 424 return ret;
421 } 425 }
422 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 426 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
@@ -439,7 +443,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
439 /* Reset the PHY to normal operation mode */ 443 /* Reset the PHY to normal operation mode */
440 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL); 444 ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, embd_phy, 0, 0, NULL);
441 if (ret < 0) { 445 if (ret < 0) {
442 dbg("Select PHY #1 failed: %d", ret); 446 netdev_dbg(dev->net, "Select PHY #1 failed: %d\n", ret);
443 return ret; 447 return ret;
444 } 448 }
445 449
@@ -459,7 +463,7 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
459 463
460 /* Read PHYID register *AFTER* the PHY was reset properly */ 464 /* Read PHYID register *AFTER* the PHY was reset properly */
461 phyid = asix_get_phyid(dev); 465 phyid = asix_get_phyid(dev);
462 dbg("PHYID=0x%08x", phyid); 466 netdev_dbg(dev->net, "PHYID=0x%08x\n", phyid);
463 467
464 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */ 468 /* Asix framing packs multiple eth frames into a 2K usb bulk transfer */
465 if (dev->driver_info->flags & FLAG_FRAMING_AX) { 469 if (dev->driver_info->flags & FLAG_FRAMING_AX) {
@@ -575,13 +579,13 @@ static int ax88178_reset(struct usbnet *dev)
575 u32 phyid; 579 u32 phyid;
576 580
577 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status); 581 asix_read_cmd(dev, AX_CMD_READ_GPIOS, 0, 0, 1, &status);
578 dbg("GPIO Status: 0x%04x", status); 582 netdev_dbg(dev->net, "GPIO Status: 0x%04x\n", status);
579 583
580 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL); 584 asix_write_cmd(dev, AX_CMD_WRITE_ENABLE, 0, 0, 0, NULL);
581 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom); 585 asix_read_cmd(dev, AX_CMD_READ_EEPROM, 0x0017, 0, 2, &eeprom);
582 asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL); 586 asix_write_cmd(dev, AX_CMD_WRITE_DISABLE, 0, 0, 0, NULL);
583 587
584 dbg("EEPROM index 0x17 is 0x%04x", eeprom); 588 netdev_dbg(dev->net, "EEPROM index 0x17 is 0x%04x\n", eeprom);
585 589
586 if (eeprom == cpu_to_le16(0xffff)) { 590 if (eeprom == cpu_to_le16(0xffff)) {
587 data->phymode = PHY_MODE_MARVELL; 591 data->phymode = PHY_MODE_MARVELL;
@@ -592,7 +596,7 @@ static int ax88178_reset(struct usbnet *dev)
592 data->ledmode = le16_to_cpu(eeprom) >> 8; 596 data->ledmode = le16_to_cpu(eeprom) >> 8;
593 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1; 597 gpio0 = (le16_to_cpu(eeprom) & 0x80) ? 0 : 1;
594 } 598 }
595 dbg("GPIO0: %d, PhyMode: %d", gpio0, data->phymode); 599 netdev_dbg(dev->net, "GPIO0: %d, PhyMode: %d\n", gpio0, data->phymode);
596 600
597 /* Power up external GigaPHY through AX88178 GPIO pin */ 601 /* Power up external GigaPHY through AX88178 GPIO pin */
598 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40); 602 asix_write_gpio(dev, AX_GPIO_RSE | AX_GPIO_GPO_1 | AX_GPIO_GPO1EN, 40);
@@ -601,14 +605,14 @@ static int ax88178_reset(struct usbnet *dev)
601 asix_write_gpio(dev, 0x001c, 300); 605 asix_write_gpio(dev, 0x001c, 300);
602 asix_write_gpio(dev, 0x003c, 30); 606 asix_write_gpio(dev, 0x003c, 30);
603 } else { 607 } else {
604 dbg("gpio phymode == 1 path"); 608 netdev_dbg(dev->net, "gpio phymode == 1 path\n");
605 asix_write_gpio(dev, AX_GPIO_GPO1EN, 30); 609 asix_write_gpio(dev, AX_GPIO_GPO1EN, 30);
606 asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30); 610 asix_write_gpio(dev, AX_GPIO_GPO1EN | AX_GPIO_GPO_1, 30);
607 } 611 }
608 612
609 /* Read PHYID register *AFTER* powering up PHY */ 613 /* Read PHYID register *AFTER* powering up PHY */
610 phyid = asix_get_phyid(dev); 614 phyid = asix_get_phyid(dev);
611 dbg("PHYID=0x%08x", phyid); 615 netdev_dbg(dev->net, "PHYID=0x%08x\n", phyid);
612 616
613 /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */ 617 /* Set AX88178 to enable MII/GMII/RGMII interface for external PHY */
614 asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL); 618 asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 0, 0, 0, NULL);
@@ -770,7 +774,7 @@ static int ax88178_bind(struct usbnet *dev, struct usb_interface *intf)
770 /* Get the MAC address */ 774 /* Get the MAC address */
771 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf); 775 ret = asix_read_cmd(dev, AX_CMD_READ_NODE_ID, 0, 0, ETH_ALEN, buf);
772 if (ret < 0) { 776 if (ret < 0) {
773 dbg("Failed to read MAC address: %d", ret); 777 netdev_dbg(dev->net, "Failed to read MAC address: %d\n", ret);
774 return ret; 778 return ret;
775 } 779 }
776 memcpy(dev->net->dev_addr, buf, ETH_ALEN); 780 memcpy(dev->net->dev_addr, buf, ETH_ALEN);
@@ -930,6 +934,10 @@ static const struct usb_device_id products [] = {
930 USB_DEVICE (0x04f1, 0x3008), 934 USB_DEVICE (0x04f1, 0x3008),
931 .driver_info = (unsigned long) &ax8817x_info, 935 .driver_info = (unsigned long) &ax8817x_info,
932}, { 936}, {
937 // Lenovo U2L100P 10/100
938 USB_DEVICE (0x17ef, 0x7203),
939 .driver_info = (unsigned long) &ax88772_info,
940}, {
933 // ASIX AX88772B 10/100 941 // ASIX AX88772B 10/100
934 USB_DEVICE (0x0b95, 0x772b), 942 USB_DEVICE (0x0b95, 0x772b),
935 .driver_info = (unsigned long) &ax88772_info, 943 .driver_info = (unsigned long) &ax88772_info,