public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@linux.it>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] USB mips timeout on reset complite
Date: Tue, 11 Apr 2006 14:39:18 +0200	[thread overview]
Message-ID: <20060411123918.GF21613@enneenne.com> (raw)

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

                 reply	other threads:[~2006-04-11 12:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060411123918.GF21613@enneenne.com \
    --to=giometti@linux.it \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox