forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/usb/isp1760/isp1760-hcd.c
....@@ -22,6 +22,7 @@
2222 #include <linux/debugfs.h>
2323 #include <linux/uaccess.h>
2424 #include <linux/io.h>
25
+#include <linux/iopoll.h>
2526 #include <linux/mm.h>
2627 #include <linux/timer.h>
2728 #include <asm/unaligned.h>
....@@ -380,18 +381,15 @@
380381 u32 mask, u32 done, int usec)
381382 {
382383 u32 result;
384
+ int ret;
383385
384
- do {
385
- result = reg_read32(hcd->regs, reg);
386
- if (result == ~0)
387
- return -ENODEV;
388
- result &= mask;
389
- if (result == done)
390
- return 0;
391
- udelay(1);
392
- usec--;
393
- } while (usec > 0);
394
- return -ETIMEDOUT;
386
+ ret = readl_poll_timeout_atomic(hcd->regs + reg, result,
387
+ ((result & mask) == done ||
388
+ result == U32_MAX), 1, usec);
389
+ if (result == U32_MAX)
390
+ return -ENODEV;
391
+
392
+ return ret;
395393 }
396394
397395 /* reset a non-running (STS_HALT == 1) controller */
....@@ -788,11 +786,11 @@
788786 mem_reads8(hcd->regs, qtd->payload_addr,
789787 qtd->data_buffer,
790788 qtd->actual_length);
791
- /* Fall through (?) */
789
+ fallthrough;
792790 case OUT_PID:
793791 qtd->urb->actual_length +=
794792 qtd->actual_length;
795
- /* Fall through ... */
793
+ fallthrough;
796794 case SETUP_PID:
797795 break;
798796 }
....@@ -1032,8 +1030,6 @@
10321030 urb->status = -EOVERFLOW;
10331031 else if (FROM_DW3_CERR(ptd->dw3))
10341032 urb->status = -EPIPE; /* Stall */
1035
- else if (ptd->dw3 & DW3_ERROR_BIT)
1036
- urb->status = -EPROTO; /* XactErr */
10371033 else
10381034 urb->status = -EPROTO; /* Unknown */
10391035 /*