|
40 | 40 | * header file. |
41 | 41 | */ |
42 | 42 |
|
| 43 | +#include <linux/usb.h> |
| 44 | +#include <linux/usb/hcd.h> |
| 45 | + |
43 | 46 | #include "dwc_otg_hcd.h" |
44 | 47 | #include "dwc_otg_regs.h" |
45 | 48 |
|
@@ -694,6 +697,31 @@ static void reset_tasklet_func(void *data) |
694 | 697 | dwc_otg_hcd->flags.b.port_reset_change = 1; |
695 | 698 | } |
696 | 699 |
|
| 700 | +static void completion_tasklet_func(void *ptr) |
| 701 | +{ |
| 702 | + dwc_otg_hcd_t *hcd = (dwc_otg_hcd_t *) ptr; |
| 703 | + struct urb *urb; |
| 704 | + urb_tq_entry_t *item; |
| 705 | + dwc_irqflags_t flags; |
| 706 | + |
| 707 | + DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); |
| 708 | + while (!DWC_TAILQ_EMPTY(&hcd->completed_urb_list)) { |
| 709 | + item = DWC_TAILQ_FIRST(&hcd->completed_urb_list); |
| 710 | + urb = item->urb; |
| 711 | + DWC_TAILQ_REMOVE(&hcd->completed_urb_list, item, |
| 712 | + urb_tq_entries); |
| 713 | + DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); |
| 714 | + DWC_FREE(item); |
| 715 | + |
| 716 | + usb_hcd_unlink_urb_from_ep(hcd->priv, urb); |
| 717 | + usb_hcd_giveback_urb(hcd->priv, urb, urb->status); |
| 718 | + |
| 719 | + DWC_SPINLOCK_IRQSAVE(hcd->lock, &flags); |
| 720 | + } |
| 721 | + DWC_SPINUNLOCK_IRQRESTORE(hcd->lock, flags); |
| 722 | + return; |
| 723 | +} |
| 724 | + |
697 | 725 | static void qh_list_free(dwc_otg_hcd_t * hcd, dwc_list_link_t * qh_list) |
698 | 726 | { |
699 | 727 | dwc_list_link_t *item; |
@@ -833,6 +861,7 @@ static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd) |
833 | 861 |
|
834 | 862 | DWC_TIMER_FREE(dwc_otg_hcd->conn_timer); |
835 | 863 | DWC_TASK_FREE(dwc_otg_hcd->reset_tasklet); |
| 864 | + DWC_TASK_FREE(dwc_otg_hcd->completion_tasklet); |
836 | 865 |
|
837 | 866 | #ifdef DWC_DEV_SRPCAP |
838 | 867 | if (dwc_otg_hcd->core_if->power_down == 2 && |
@@ -877,7 +906,7 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) |
877 | 906 | DWC_LIST_INIT(&hcd->periodic_sched_ready); |
878 | 907 | DWC_LIST_INIT(&hcd->periodic_sched_assigned); |
879 | 908 | DWC_LIST_INIT(&hcd->periodic_sched_queued); |
880 | | - |
| 909 | + DWC_TAILQ_INIT(&hcd->completed_urb_list); |
881 | 910 | /* |
882 | 911 | * Create a host channel descriptor for each host channel implemented |
883 | 912 | * in the controller. Initialize the channel descriptor array. |
@@ -915,6 +944,9 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) |
915 | 944 |
|
916 | 945 | /* Initialize reset tasklet. */ |
917 | 946 | hcd->reset_tasklet = DWC_TASK_ALLOC("reset_tasklet", reset_tasklet_func, hcd); |
| 947 | + |
| 948 | + hcd->completion_tasklet = DWC_TASK_ALLOC("completion_tasklet", |
| 949 | + completion_tasklet_func, hcd); |
918 | 950 | #ifdef DWC_DEV_SRPCAP |
919 | 951 | if (hcd->core_if->power_down == 2) { |
920 | 952 | /* Initialize Power on timer for Host power up in case hibernation */ |
|
0 commit comments