Greg KH wrote:
> On Thu, Jan 11, 2007 at 09:29:54PM +0000, Chris Ball wrote:
>>>> On Thu, 11 Jan 2007 18:55:05, Rui Santos <[EMAIL PROTECTED]> said:
>>    > Hi, By applying this patch on kernel 2.6.19.1 the effect is the
>>    > opposite on some Network Cards.  The Hardware I used to test it was
>>    > 'D-Link DUB-E100 Rev. B1' and 'D-Link DUB-E100 Rev. B1
>>    > Alternate'. It works without the patch, and stops working after
>>    > applying it.  The Network Card is detected, the driver is loaded
>>    > with no apparent errors, the ethtool seems to report the same
>>    > applied settings but, not even a ping gets trough.
>>
>> Confirmed, our DUB-E100s stop working with this patch too.
> 
> Not good.  David, any thoughts?
> 
> thanks,
> 
> greg k-h

Does the attached patch work for you folks?  The original patch causes
the driver to always use the external PHY; something we don't want if
the hardware is telling us that we should be using an internal PHY.
This patch checks whether to not to use the internal phy.

>From c9aabfc121a62b12e35223482c4aa132b12d9fd1 Mon Sep 17 00:00:00 2001
From: Andres Salomon <[EMAIL PROTECTED]>
Date: Thu, 11 Jan 2007 18:39:16 -0500
Subject: [PATCH] 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]>
---
 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 usb
 
 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 *d
                        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 *d
                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);
-- 
1.4.1

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to