#include <console.h>
#include <usb.h>
#include <asm/io.h>
+#include <linux/iopoll.h>
#include "r8a66597.h"
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;
#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