Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d0ffff8fddd5853e4b2b101790ac0c3690655af5
Commit:     d0ffff8fddd5853e4b2b101790ac0c3690655af5
Parent:     c9d8c2b324d24ffb4fdcd93b3f752530a5a0a591
Author:     Andres Salomon <[EMAIL PROTECTED]>
AuthorDate: Thu Jan 11 18:39:16 2007 -0500
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Mon Jan 22 11:46:55 2007 -0800

    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 <[EMAIL PROTECTED]>
    Cc: David Hollis <[EMAIL PROTECTED]>
    Cc: Chris Ball <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/net/asix.c |   18 +++++++++++++-----
 1 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c
index f538013..896449f 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)
 
 static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
 {
-       int ret;
+       int ret, embd_phy;
        void *buf;
        u16 rx_ctl;
        struct asix_data *data = (struct asix_data *)&dev->data;
@@ -919,13 +919,15 @@ static int ax88772_bind(struct usbnet *dev, struct 
usb_interface *intf)
                        AX_GPIO_RSE | AX_GPIO_GPO_2 | AX_GPIO_GPO2EN, 5)) < 0)
                goto out2;
 
+       /* 0x10 is the phy id of the embedded 10/100 ethernet phy */
+       embd_phy = ((asix_get_phy_addr(dev) & 0x1f) == 0x10 ? 1 : 0);
        if ((ret = asix_write_cmd(dev, AX_CMD_SW_PHY_SELECT,
-                               1, 0, 0, buf)) < 0) {
+                               embd_phy, 0, 0, buf)) < 0) {
                dbg("Select PHY #1 failed: %d", ret);
                goto out2;
        }
 
-       if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD)) < 0)
+       if ((ret = asix_sw_reset(dev, AX_SWRESET_IPPD | AX_SWRESET_PRL)) < 0)
                goto out2;
 
        msleep(150);
@@ -933,8 +935,14 @@ static int ax88772_bind(struct usbnet *dev, struct 
usb_interface *intf)
                goto out2;
 
        msleep(150);
-       if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL | AX_SWRESET_PRL)) < 0)
-               goto out2;
+       if (embd_phy) {
+               if ((ret = asix_sw_reset(dev, AX_SWRESET_IPRL)) < 0)
+                       goto out2;
+       }
+       else {
+               if ((ret = asix_sw_reset(dev, AX_SWRESET_PRTE)) < 0)
+                       goto out2;
+       }
 
        msleep(150);
        rx_ctl = asix_read_rx_ctl(dev);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to