All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] USB mips timeout on reset complite
@ 2006-04-11 12:39 Rodolfo Giometti
  0 siblings, 0 replies; only message in thread
From: Rodolfo Giometti @ 2006-04-11 12:39 UTC (permalink / raw)
  To: u-boot

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@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");
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-04-11 12:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-11 12:39 [U-Boot-Users] USB mips timeout on reset complite Rodolfo Giometti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.