Hi Alan,

On 2/13/07, Alan Stern <[EMAIL PROTECTED]> wrote:
> On Mon, 12 Feb 2007, Guilherme Salgado wrote:
>
> > > On Thu, 11 Jan 2007, Jon Smirl wrote:
> > >
> > [...]
> > >
> > > Here we see a resume that failed.  The key indicator is the 0x1000 bit in
> > > the portsc value; it means the port is still suspended even after it was
> > > supposed to have resumed.  This is the Intel hardware-resume bug I
> > > described earlier.  I have seen it on a few occasions but I cannot
> > > duplicate it reproducibly.  If you can, your system would make a good test
> > > case.  Try applying the diagnostic patch below and see what happens.
> > >
> > > When this sort of error occurs, the USB core resets the device and
> > > re-enumerates it.
> > >
> > > > hub 3-0:1.0: port 2 status 0004.0107 after resume, 0
> > > > hub 3-0:1.0: logical disconnect on port 2
> > > > usb 3-2: can't resume, status -19
> > >
> > > This shows the core realizing that the resume failed.
> > >
> >
> > I've been experiencing a similar resume failure on my fingerprint
> > reader (on a Thinkpad T60) and I can reproduce it easily. I applied
> > your diagnostic patch on a 2.6.20 tree and this is what I got on
> > syslog. Please let me know if this is of any help and if there's
> > anything else I could do to help further debugging.
> >
> > Feb 12 22:51:30 frida kernel: [ 3529.760000] usb usb5: usb auto-resume
> > Feb 12 22:51:30 frida kernel: [ 3529.760000] usb usb5: finish resume
> > Feb 12 22:51:30 frida kernel: [ 3529.760000] hub 5-0:1.0: hub_resume
> > Feb 12 22:51:30 frida kernel: [ 3529.760000] usb usb5: wakeup_rh
> > Feb 12 22:51:30 frida kernel: [ 3529.800000] hub 5-0:1.0: state 7
> > ports 2 chg 0000 evt 0000
> > Feb 12 22:51:30 frida kernel: [ 3529.800000] usb 5-2: usb auto-resume
> > Feb 12 22:51:30 frida kernel: [ 3529.832000] uhci_hcd 0000:00:1d.3:
> > port 2 resume iterations 0:0
> > Feb 12 22:51:30 frida kernel: [ 3529.832000] uhci_hcd 0000:00:1d.3:
> > port 2 portsc 1095,01
>
> Yep, that's the problem.  It's good to have a reliable test case, thanks.
>
> Below is a revised version of the diagnostic patch.  Try using it instead
> of the earlier one and let's see what happens.
>

This revised version didn't apply cleanly into my tree, so I did the
changes manually and used upper case characters on the message passed
to dev_info(), to make sure the new module was loaded correctly, and I
seem to have got the same thing on syslog:

Feb 13 21:42:53 frida kernel: [85588.892000] hub 5-0:1.0: hub_suspend
Feb 13 21:42:53 frida kernel: [85588.892000] usb usb5: suspend_rh
Feb 13 21:42:53 frida kernel: [85588.892000] usb usb5: usb auto-suspend
Feb 13 21:42:54 frida kernel: [85590.036000] usb usb5: usb auto-resume
Feb 13 21:42:54 frida kernel: [85590.036000] usb usb5: finish resume
Feb 13 21:42:54 frida kernel: [85590.036000] hub 5-0:1.0: hub_resume
Feb 13 21:42:54 frida kernel: [85590.036000] usb usb5: wakeup_rh
Feb 13 21:42:54 frida kernel: [85590.076000] hub 5-0:1.0: state 7
ports 2 chg 0000 evt 0000
Feb 13 21:42:54 frida kernel: [85590.076000] usb 5-2: usb auto-resume
Feb 13 21:42:54 frida kernel: [85590.108000] uhci_hcd 0000:00:1d.3:
PORT 2 RESUME ITERATIONS 0:1
Feb 13 21:42:54 frida kernel: [85590.108000] uhci_hcd 0000:00:1d.3:
port 2 portsc 1095,01
Feb 13 21:42:54 frida kernel: [85590.108000] hub 5-0:1.0: port 2
status 0004.0107 after resume, 0
Feb 13 21:42:54 frida kernel: [85590.108000] hub 5-0:1.0: logical
disconnect on port 2
Feb 13 21:42:54 frida kernel: [85590.108000] usb 5-2: can't resume, status -19
Feb 13 21:42:54 frida kernel: [85590.108000] hub 5-0:1.0: state 7
ports 2 chg 0004 evt 0000
Feb 13 21:42:54 frida kernel: [85590.108000] uhci_hcd 0000:00:1d.3:
port 2 portsc 0091,01
Feb 13 21:42:54 frida kernel: [85590.108000] hub 5-0:1.0: resume on
port 2, status 0
Feb 13 21:42:54 frida kernel: [85590.108000] hub 5-0:1.0: port 2,
status 0101, change 0004, 12 Mb/s


> Index: 2.6.20/drivers/usb/host/uhci-hub.c
> ===================================================================
> --- 2.6.20.orig/drivers/usb/host/uhci-hub.c
> +++ 2.6.20/drivers/usb/host/uhci-hub.c
> @@ -95,6 +95,7 @@ static void uhci_finish_suspend(struct u
>  {
>         int status;
>         int i;
> +       int j;
>
>         if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
>                 CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
> @@ -106,11 +107,17 @@ static void uhci_finish_suspend(struct u
>                  * which is supposed to take 3 bit times (= 2 microseconds).
>                  * Experiments show that some controllers take longer, so
>                  * we'll poll for completion. */
> +       for (j = 0; j < 1000; ++j) {
>                 for (i = 0; i < 10; ++i) {
> -                       if (!(inw(port_addr) & USBPORTSC_RD))
> -                               break;
> +                       if (!(inw(port_addr) &
> +                                       (USBPORTSC_SUSP | USBPORTSC_RD)))
> +                               goto done; //break;
>                         udelay(1);
>                 }
> +               CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
> +       }
> +done:          dev_info(uhci_dev(uhci), "port %d resume iterations %d:%d\n",
> +                               port+1, j, i);
>         }
>         clear_bit(port, &uhci->resuming_ports);
>  }
>
>

This is the patch I used, btw:

diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
index bacc25c..0da6949 100644
--- a/drivers/usb/host/uhci-hub.c
+++ b/drivers/usb/host/uhci-hub.c
@@ -95,6 +95,7 @@ static void uhci_finish_suspend(struct u
 {
        int status;
        int i;
+       int j;

        if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
                CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
@@ -106,11 +107,17 @@ static void uhci_finish_suspend(struct u
                 * which is supposed to take 3 bit times (= 2 microseconds).
                 * Experiments show that some controllers take longer, so
                 * we'll poll for completion. */
+       for (j = 0; j < 1000; ++j) {
                for (i = 0; i < 10; ++i) {
-                       if (!(inw(port_addr) & USBPORTSC_RD))
-                               break;
+                       if (!(inw(port_addr) &
+                                       (USBPORTSC_RD | USBPORTSC_RD)))
+                               goto done; //break;
                        udelay(1);
                }
+               CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
+       }
+done:          dev_info(uhci_dev(uhci), "PORT %d RESUME ITERATIONS %d:%d\n",
+                               port+1, j, i);
        }
        clear_bit(port, &uhci->resuming_ports);
 }

Cheers,
Guilherme

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to