[hafqa] [hafqa] [Bug 3026] New: USB state hangs at b_idle on n810(won't allow mode change from sysfs)

From: bugzilla-daemon at maemo.org bugzilla-daemon at maemo.org
Date: Tue Mar 18 17:45:24 EET 2008
https://bugs.maemo.org/show_bug.cgi?id=3026

           Summary: USB state hangs at b_idle on n810(won't allow mode
                    change from sysfs)
           Product: System software
           Version: 4.0
          Platform: ARM
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Low
         Component: hildon-theme
        AssignedTo: michael.kostrzewa at nokia.com
        ReportedBy: roadmapformaemo at gmail.com
         QAContact: hildon-theme-bugs at maemo.org


SOFTWARE VERSION:
OS2008- Chinook (n810 only?)

STEPS TO REPRODUCE THE PROBLEM:
I'm not the only one having this issue, but not everyone is. Could be a
hardware problem...
1. Boot the tablet
2. open osso-xterm and do-
   $sudo gainroot
   #echo host>/sys/devices/platform/musb_hdrc/mode

EXPECTED OUTCOME:
Mode should be changed.
ACTUAL OUTCOME:
Mode is not changed-
   #tail /sys/devices/platform/musb_hdrc/mode
gives-
   b_idle

It seems that the soft ID pullup is getting stuck UP (usb peripheral). It will
unstick if external Vbus voltage is applied to the port and allow normal mode
change from sysfs... (i.e.- If I plug the tablet into my PC as periperal, then
unmount and unplug it, I can change modes once. But if I change mode to otg or
peripheral it sticks at b_idle again.

REPRODUCIBILITY:

always

EXTRA SOFTWARE INSTALLED:
Have tried this on freshly flashed (51-3) n810 in R&D mode with no additional
software...

OTHER COMMENTS:
I was able to patch the musb_core.c file to make this issue go away by making
the driver reinitialize when mode changes. I'm not a kernel developer so my fix
may not be 'correct'. but here it is-

## BEGIN PATCH ##
--- kernel-source-rx-34-2.6.21.0-orig/drivers/usb/musb/musb_core.c     
2008-03-17 21:12:38.000000000 -0600
+++ kernel-source-rx-34-2.6.21.0/drivers/usb/musb/musb_core.c   2008-03-17
22:15:37.000000000 -0600
@@ -1693,16 +1693,30 @@
 {
        struct musb     *musb = dev_to_musb(dev);
        unsigned long   flags;
+       static int last_state;
+       int new_state = 0;
+       //reset driver only if we are changing states... seems to fix id pullup
sticking
+       if (!strncmp(buf, "host", 4)) new_state = 3;
+       if (!strncmp(buf, "peripheral", 10)) new_state = 2;
+       if (!strncmp(buf, "otg", 3)) new_state = 1;
+       if (!last_state) last_state = new_state;
+
+       if (!(last_state == new_state)){ 
+               musb_stop(musb);
+               musb_start(musb);
+
+               spin_lock_irqsave(&musb->lock, flags);
+               if (!strncmp(buf, "host", 4))
+                       musb_platform_set_mode(musb, MUSB_HOST);
+               if (!strncmp(buf, "peripheral", 10))
+                       musb_platform_set_mode(musb, MUSB_PERIPHERAL);  
+               if (!strncmp(buf, "otg", 3))
+                       musb_platform_set_mode(musb, MUSB_OTG);

-       spin_lock_irqsave(&musb->lock, flags);
-       if (!strncmp(buf, "host", 4))
-               musb_platform_set_mode(musb, MUSB_HOST);
-       if (!strncmp(buf, "peripheral", 10))
-               musb_platform_set_mode(musb, MUSB_PERIPHERAL);
-       if (!strncmp(buf, "otg", 3))
-               musb_platform_set_mode(musb, MUSB_OTG);
-       spin_unlock_irqrestore(&musb->lock, flags);
+               spin_unlock_irqrestore(&musb->lock, flags);
+       }

+       last_state = new_state;
        return n;
 }
 static DEVICE_ATTR(mode, 0644, musb_mode_show, musb_mode_store);

## END PATCH ##

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.12)
Gecko/20080129 Iceweasel/2.0.0.12 (Debian-2.0.0.12-0etch1)


-- 
Configure bugmail: https://bugs.maemo.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.

More information about the hafqa mailing list