summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2023-11-13 19:49:49 +0800
committersakumisu <[email protected]>2023-11-13 19:49:49 +0800
commitd10cbd5dafb284e9984e199ce93efa47d65a004c (patch)
tree50a61def2a1072b439d325b82c87bcce9cb3fccb
parent40a019e0632e5325a4f837e5fe29e9222f956e7d (diff)
check if token is active without errors, if token has errors, go to wakeup sem
-rw-r--r--port/ehci/usb_hc_ehci.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/port/ehci/usb_hc_ehci.c b/port/ehci/usb_hc_ehci.c
index cdabdf01..7e6e9469 100644
--- a/port/ehci/usb_hc_ehci.c
+++ b/port/ehci/usb_hc_ehci.c
@@ -682,25 +682,24 @@ static void ehci_check_qh(struct ehci_qh_hw *qhead, struct ehci_qh_hw *qh)
token = qh->hw.overlay.token;
- if (token & QTD_TOKEN_STATUS_ACTIVE) {
+ /* Check if token is only in active status without errors */
+ if ((token & (QTD_TOKEN_STATUS_ERRORS | QTD_TOKEN_STATUS_ACTIVE)) == QTD_TOKEN_STATUS_ACTIVE) {
return;
}
- qtd = EHCI_ADDR2QTD(qh->first_qtd);
-
- while (qtd) {
- if (qtd->hw.token & QTD_TOKEN_STATUS_ACTIVE) {
- return;
- }
- qtd = EHCI_ADDR2QTD(qtd->hw.next_qtd);
- }
-
urb = qh->urb;
pipe = urb->pipe;
- ehci_qh_scan_qtds(qhead, qh);
-
if ((token & QTD_TOKEN_STATUS_ERRORS) == 0) {
+ qtd = EHCI_ADDR2QTD(qh->first_qtd);
+
+ while (qtd) {
+ if (qtd->hw.token & QTD_TOKEN_STATUS_ACTIVE) {
+ return;
+ }
+ qtd = EHCI_ADDR2QTD(qtd->hw.next_qtd);
+ }
+
if (token & QTD_TOKEN_TOGGLE) {
pipe->toggle = true;
} else {
@@ -719,6 +718,8 @@ static void ehci_check_qh(struct ehci_qh_hw *qhead, struct ehci_qh_hw *qh)
}
}
+ ehci_qh_scan_qtds(qhead, qh);
+
if (pipe->ep_type == USB_ENDPOINT_TYPE_INTERRUPT) {
qh->remove_in_iaad = 0;
ehci_qh_free(qh);