MUSB timeout broken
Subsystems (2)
PATCH 1/1 MUSB timeout broken
The following construct (musb_hcd.c, usb_lowlevel_init)
timeout = musb_cfg.timeout;
while (timeout--)
if (readb(&musbr->devctl) & MUSB_DEVCTL_HM)
break;will leave timeout == -1 when the timeout is reached, hence the timeout detecting code that follows will not trigger:
/* if musb core is not in host mode, then return */
if (!timeout)
return -1;Without the patch below, doing a 'usb reset' without a device connected makes it impossible to discover connected devices later. I have not investigated why this happens since the timeout logic was broken (and correcting that fixed the issue at hand).
Changed to pre-decrement since I assume the timeout value is not *that* exact.
Thanks,
Orjan
drivers/usb/musb/musb_hcd.c +1 -1
@@ -1114,7 +1114,7 @@ int usb_lowlevel_init(void)* should be a usb device connected. */ timeout = musb_cfg.timeout; -while (timeout--) +while (--timeout)if (readb (&musbr->devctl) &MUSB_DEVCTL_HM )break ;
Signature · 2 lines
Orjan Friberg FlatFrog Laboratories AB
PATCH 1/1 MUSB timeout broken
Dear Orjan Friberg,
Quoted 15 lines · In message <[email protected]> you wrote:
The following construct (
musb_hcd.c,usb_lowlevel_init)timeout = musb_cfg.timeout; while (timeout--) if (readb(&musbr->devctl) & MUSB_DEVCTL_HM) break;will leave timeout == -1 when the timeout is reached, hence the timeout detecting code that follows will not trigger:
/* if musb core is not in host mode, then return */ if (!timeout) return -1;
Quoted 7 lines
Without the patch below, doing a 'usb reset' without a device connected makes it impossible to discover connected devices later. I have not investigated why this happens since the timeout logic was broken (and correcting that fixed the issue at hand).
Changed to pre-decrement since I assume the timeout value is not *that* exact.
Thanks for spotting and reporting.
Quoted 8 lines
Thanks,
Orjandrivers/usb/musb/musb_hcd.c +0
-0
drivers/usb/musb/musb_hcd.c int usb_lowlevel_init(void) · line 1119
Quoted 7 lines
drivers/usb/musb/musb_hcd.c +1
-1@@ -1114,7 +1114,7 @@ int usb_lowlevel_init(void)* should be a usb device connected. */ timeout = musb_cfg.timeout; -while (timeout--) +while (--timeout)if (readb (&musbr->devctl) &MUSB_DEVCTL_HM )break ;
Unfortunately, your patch is white space corrupted, and missing a proper Signed-off-by: line.
Please fix and repost. Thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Q: How many DEC repairman does it take to fix a flat ? A: Five; four to hold the car up and one to swap tires.