diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2010-06-24 10:22:40 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-06-24 11:42:06 +0200 |
commit | 0b863c83d0908a1524eed1e55f0efc3397badd2e (patch) | |
tree | 18d986188e0d5daffd4df2a60fba23bc9ab90a94 | |
parent | d99aa6b7613fe670eff2930ebc6f79d667947530 (diff) | |
download | barebox-0b863c83d0908a1524eed1e55f0efc3397badd2e.tar.gz barebox-0b863c83d0908a1524eed1e55f0efc3397badd2e.tar.xz |
ehci: use is_timeout for timeout instead of udelay counter
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/usb/usb_ehci_core.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/usb_ehci_core.c index c5d4da3f6c..e70e8718a7 100644 --- a/drivers/usb/usb_ehci_core.c +++ b/drivers/usb/usb_ehci_core.c @@ -213,18 +213,20 @@ static inline void ehci_invalidate_dcache(struct QH *qh) static int handshake(uint32_t *ptr, uint32_t mask, uint32_t done, int usec) { uint32_t result; + uint64_t start; - do { + start = get_time_ns(); + + while (1) { result = ehci_readl(ptr); if (result == ~(uint32_t)0) return -1; result &= mask; if (result == done) return 0; - udelay(1); - usec--; - } while (usec > 0); - return -1; + if (is_timeout(start, usec * USECOND)) + return -ETIMEDOUT; + } } static int ehci_reset(struct ehci_priv *ehci) |