[U-Boot-Users] USB mips timeout on reset complite

Rodolfo Giometti giometti at linux.it
Tue Apr 11 14:39:18 CEST 2006


Hello,

here a little patch who implements a timeout on wait for reset
complite of the USB controller. This avoids system hang if, for some
reason, the USB controllor cannot reset correctly.

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti at enneenne.com
Linux Device Driver                             giometti at gnudd.com
Embedded Systems                     		giometti at linux.it
UNIX programming                     phone:     +39 349 2432127
-------------- next part --------------
diff-tree ec82ef79b429e94308346beb549d4dd96dfac35e (from 3a5e21881a194f4d4e053be8410d82a2458e8544)
Author: Rodolfo Giometti <giometti at zaigor.enneenne.com>
Date:   Tue Apr 11 14:35:25 2006 +0200

    Timeout on wait for reset complite added.

diff --git a/cpu/mips/au1x00_usb_ohci.c b/cpu/mips/au1x00_usb_ohci.c
index dbf72dc..92121a5 100644
--- a/cpu/mips/au1x00_usb_ohci.c
+++ b/cpu/mips/au1x00_usb_ohci.c
@@ -1572,6 +1572,7 @@ int usb_lowlevel_init(void)
 	u32 pin_func;
 	u32 sys_freqctrl, sys_clksrc;
 	u32 prid = read_c0_prid();
+	int count = 3000;
 
 	dbg("in usb_lowlevel_init\n");
 
@@ -1641,8 +1642,13 @@ int usb_lowlevel_init(void)
 
 	/* wait for reset complete (read register twice; see au1500 errata) */
 	while (au_readl(USB_HOST_CONFIG),
-	       !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD))
+	       !(au_readl(USB_HOST_CONFIG) & USBH_ENABLE_RD)) {
 		udelay(1000);
+		if (--count == 0) {
+			err("unable to reset USB host!!");
+			return -1;
+		}
+	}
 
 	dbg("OHCI clock running\n");
 


More information about the U-Boot mailing list