diff options
author | Gregory Herrero <gregory.herrero@intel.com> | 2015-09-22 09:16:45 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2015-10-01 13:40:16 -0400 |
commit | 08c4ffc24087d1949948002abdbac0d1e71ade5d (patch) | |
tree | 3298f2b031f9d40c51b3c0fb68748af49c73edd5 | |
parent | bea78555f71e01196d0a4613ffefd4c8920ba439 (diff) |
usb: dwc2: host: reset frame number after suspend
Frame number is reset in hardware after exiting hibernation.
Thus, reset frame_number and ensure qh are queued with correct
sched_frame.
Otherwise, qh->sched_frame may be too high compared to
current frame number (which is 0). This can delay addition of qh in
the list of transfers until frame number reaches qh->sched_frame.
Signed-off-by: Gregory Herrero <gregory.herrero@intel.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Tested-by: Robert Baldyga <r.baldyga@samsung.com>
Tested-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Tested-by: John Youn <johnyoun@synopsys.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r-- | drivers/usb/dwc2/core.c | 1 | ||||
-rw-r--r-- | drivers/usb/dwc2/hcd_queue.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 0bfc987dd373..f5c3120f4879 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c | |||
@@ -116,6 +116,7 @@ static int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) | |||
116 | 116 | ||
117 | dwc2_writel(hr->hprt0, hsotg->regs + HPRT0); | 117 | dwc2_writel(hr->hprt0, hsotg->regs + HPRT0); |
118 | dwc2_writel(hr->hfir, hsotg->regs + HFIR); | 118 | dwc2_writel(hr->hfir, hsotg->regs + HFIR); |
119 | hsotg->frame_number = 0; | ||
119 | 120 | ||
120 | return 0; | 121 | return 0; |
121 | } | 122 | } |
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index 712977fd67d1..801bd9d9c4bd 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c | |||
@@ -583,6 +583,14 @@ int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | |||
583 | /* QH already in a schedule */ | 583 | /* QH already in a schedule */ |
584 | return 0; | 584 | return 0; |
585 | 585 | ||
586 | if (!dwc2_frame_num_le(qh->sched_frame, hsotg->frame_number) && | ||
587 | !hsotg->frame_number) { | ||
588 | dev_dbg(hsotg->dev, | ||
589 | "reset frame number counter\n"); | ||
590 | qh->sched_frame = dwc2_frame_num_inc(hsotg->frame_number, | ||
591 | SCHEDULE_SLOP); | ||
592 | } | ||
593 | |||
586 | /* Add the new QH to the appropriate schedule */ | 594 | /* Add the new QH to the appropriate schedule */ |
587 | if (dwc2_qh_is_non_per(qh)) { | 595 | if (dwc2_qh_is_non_per(qh)) { |
588 | /* Always start in inactive schedule */ | 596 | /* Always start in inactive schedule */ |