summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-12-13 17:58:36 -0500
committerTom Rini <trini@konsulko.com>2017-12-13 17:58:36 -0500
commit6b308494c5d5ef0cbdb76af4628b3478d0445b41 (patch)
tree2e8d3a7940c64c7cd97a783eeb59a0097f9fad58 /drivers
parentfd12455643dbe68e2a3675b1d2adb384ebacd251 (diff)
parent243fd6420d2275275b8267ead971a7dbd69b369f (diff)
Merge branch 'master' of git://git.denx.de/u-boot-usb
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/host/r8a66597-hcd.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 28d2bc8454..e0ca2cb0d4 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -10,6 +10,7 @@
#include <console.h>
#include <usb.h>
#include <asm/io.h>
+#include <linux/iopoll.h>
#include "r8a66597.h"
@@ -297,7 +298,6 @@ static int send_setup_packet(struct r8a66597 *r8a66597, struct usb_device *dev,
int timeout = 3000;
#if defined(CONFIG_RZA_USB)
u16 dcpctr;
- int timeout2 = 10000;
#endif
u16 devsel = setup->request == USB_REQ_SET_ADDRESS ? 0 : dev->devnum;
@@ -308,13 +308,10 @@ static int send_setup_packet(struct r8a66597 *r8a66597, struct usb_device *dev,
#if defined(CONFIG_RZA_USB)
dcpctr = r8a66597_read(r8a66597, DCPCTR);
if ((dcpctr & PID) == PID_BUF) {
- timeout2 = 10000;
- while (!(dcpctr & BSTS)) {
- dcpctr = r8a66597_read(r8a66597, DCPCTR);
- if (timeout2-- < 0) {
- printf("DCPCTR clear timeout!\n");
- break;
- }
+ if (readw_poll_timeout(r8a66597->reg + DCPCTR, dcpctr,
+ dcpctr & BSTS, 1000) < 0) {
+ printf("DCPCTR BSTS timeout!\n");
+ return -ETIMEDOUT;
}
}
#endif