[U-Boot] [PATCH] MUSB driver: Timeout is never detected as the while loop does not end

2012-08-30 Thread Matej Frančeškin
Timeout variable is decremented once more when while condition is not met.
Following if does not detect correctly that timeout has occurred.
Because of this bug the usb start command on AM335X-EVM board did not detect 
correctly that USB device was not attached.

timeout = musb_cfg.timeout;
while (timeout--)
if (readb(musbr-devctl)  MUSB_DEVCTL_HM)
break;
/* if musb core is not in host mode, then return */
if (!timeout)
return -1;


Signed-off-by: Matej Franceskin matej.frances...@comtrade.com
CC: Marek Vasut ma...@denx.de?

---
 drivers/usb/musb/musb_hcd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index 2df52c1..8d44c46 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -1113,7 +1113,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;
/* if musb core is not in host mode, then return */
if (!timeout)
return -1; 
-- 
1.7.9.5
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] MUSB driver: Timeout is never detected as the while loop does not end

2012-08-30 Thread Tom Rini
On Thu, Aug 30, 2012 at 09:24:39AM +0200, Matej Fran?e?kin wrote:

 Timeout variable is decremented once more when while condition is not met.
 Following if does not detect correctly that timeout has occurred.
 Because of this bug the usb start command on AM335X-EVM board did not 
 detect correctly that USB device was not attached.
 
   timeout = musb_cfg.timeout;
   while (timeout--)
   if (readb(musbr-devctl)  MUSB_DEVCTL_HM)
   break;
   /* if musb core is not in host mode, then return */
   if (!timeout)
   return -1;
 
 
 Signed-off-by: Matej Franceskin matej.frances...@comtrade.com
 CC: Marek Vasut ma...@denx.de?

Acked-by: Tom Rini tr...@ti.com

-- 
Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] MUSB driver: Timeout is never detected as the while loop does not end

2012-08-30 Thread Marek Vasut
Dear Matej Frančeškin,

 Timeout variable is decremented once more when while condition is not met.
 Following if does not detect correctly that timeout has occurred.
 Because of this bug the usb start command on AM335X-EVM board did not
 detect correctly that USB device was not attached.
 
   timeout = musb_cfg.timeout;
   while (timeout--)
   if (readb(musbr-devctl)  MUSB_DEVCTL_HM)
   break;
   /* if musb core is not in host mode, then return */
   if (!timeout)
   return -1;
 
 
 Signed-off-by: Matej Franceskin matej.frances...@comtrade.com
 CC: Marek Vasut ma...@denx.de?

Applied, thanks

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] MUSB driver: Timeout is never detected as the while loop does not end

2012-08-29 Thread Matej Frančeškin
Timeout variable is decremented once more when while condition is not met.
Following if does not detect correctly that timeout has occurred.
Because of this bug the usb start command on AM335X-EVM board did not detect 
correctly that USB device was not attached.

timeout = musb_cfg.timeout;
while (timeout--)
if (readb(musbr-devctl)  MUSB_DEVCTL_HM)
break;
/* if musb core is not in host mode, then return */
if (!timeout)
return -1;


---
 drivers/usb/musb/musb_hcd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index 2df52c1..8d44c46 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -1113,7 +1113,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;
/* if musb core is not in host mode, then return */
if (!timeout)
return -1; 
-- 
1.7.9.5
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] MUSB driver: Timeout is never detected as the while loop does not end

2012-08-29 Thread Marek Vasut
Dear Matej Frančeškin,

 Timeout variable is decremented once more when while condition is not met.
 Following if does not detect correctly that timeout has occurred.
 Because of this bug the usb start command on AM335X-EVM board did not
 detect correctly that USB device was not attached.
 
   timeout = musb_cfg.timeout;
   while (timeout--)
   if (readb(musbr-devctl)  MUSB_DEVCTL_HM)
   break;
   /* if musb core is not in host mode, then return */
   if (!timeout)
   return -1;
 

CCing Tom, SoB line missing, please read http://www.denx.de/wiki/U-Boot/Patches

 ---
  drivers/usb/musb/musb_hcd.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
 index 2df52c1..8d44c46 100644
 --- a/drivers/usb/musb/musb_hcd.c
 +++ b/drivers/usb/musb/musb_hcd.c
 @@ -1113,7 +1113,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;
   /* if musb core is not in host mode, then return */
   if (!timeout)
   return -1;

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot