aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/net
diff options
context:
space:
mode:
authorAndres Salomon <dilinger@debian.org>2007-01-11 18:39:16 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-01-22 14:46:55 -0500
commitd0ffff8fddd5853e4b2b101790ac0c3690655af5 (patch)
treebfd65bbfa9c33b4c5244c8b206b32d5d7842ea4b /drivers/usb/net
parentc9d8c2b324d24ffb4fdcd93b3f752530a5a0a591 (diff)
USB: asix: Detect internal PHY and enable/use accordingly
Different AX88772 dongles use different PHYs; the chip is capable of using both a primary and secondary PHY, and supports an internal and external PHY. It appears that some DUB-E100 devices use the internal PHY, so trying to use an external one will not work (note that this is different across revisions, as well; the "A" and "B" revs of the DUB-E100 use different PHYs!). The data sheet for the AX88772 chip specifies that the internal PHY id will be 0x10, so if that's read from the EEPROM, we should use that rather than attempting to use an external PHY. Thanks to Mitch Bradley for pointing this out! Signed-off-by: Andres Salomon <dilinger@debian.org> Cc: David Hollis <dhollis@davehollis.com> Cc: Chris Ball <cjb@laptop.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/net')
-rw-r--r--drivers/usb/net/asix.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c
index f538013965b0..896449f0cf85 100644
--- a/drivers/usb/net/asix.c
+++ b/drivers/usb/net/asix.c
@@ -898,7 +898,7 @@ static int ax88772_link_reset(struct usbnet *dev)
898 898
899static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) 899static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
900{ 900{
901 int ret; 901 int ret, embd_phy;
902 void *buf; 902 void *buf;
903 u16 rx_ctl; 903 u16 rx_ctl;
904 struct asix_data *data = (struct asix_data *)&dev->data; 904 struct asix_data *data = (struct asix_data *)&dev->data;
@@ -919,13 +919,15 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
919 AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0) 919 AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0)
920 goto out2; 920 goto out2;
921 921
922 /* 0x10 is the phy id of the embedded 10/100 ethernet phy */
923 embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0);
922 if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT, 924 if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT,
923 1, 0, 0, buf)) < 0) { 925 embd_phy, 0, 0, buf)) < 0) {
924 dbg("Select PHY #1 failed: %d", ret); 926 dbg("Select PHY #1 failed: %d", ret);
925 goto out2; 927 goto out2;
926 } 928 }
927 929
928 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD)) < 0) 930 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0)
929 goto out2; 931 goto out2;
930 932
931 msleep(150); 933 msleep(150);
@@ -933,8 +935,14 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
933 goto out2; 935 goto out2;
934 936
935 msleep(150); 937 msleep(150);
936 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0) 938 if (embd_phy) {
937 goto out2; 939 if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0)
940 goto out2;
941 }
942 else {
943 if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0)
944 goto out2;
945 }
938 946
939 msleep(150); 947 msleep(150);
940 rx_ctl = asix_read_rx_ctl(dev); 948 rx_ctl = asix_read_rx_ctl(dev);