65a33f98a6ad475e48ec4097494fa99888383deb
[oweals/openwrt.git] /
1 From 3d0898f22d62dd7a05c39de9ea7e200689dc6c20 Mon Sep 17 00:00:00 2001
2 From: P33M <P33M@users.noreply.github.com>
3 Date: Fri, 24 Nov 2017 13:49:26 +0000
4 Subject: [PATCH 135/454] fiq_fsm: rewind DMA pointer for OUT transactions that
5  fail (#2288)
6
7 See: https://github.com/raspberrypi/linux/issues/2140
8 ---
9  drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 12 ++++++++++++
10  1 file changed, 12 insertions(+)
11
12 --- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
13 +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
14 @@ -267,6 +267,15 @@ static void notrace fiq_fsm_reload_hctsi
15  }
16  
17  /**
18 + * fiq_fsm_reload_hcdma() - for OUT transactions, rewind DMA pointer
19 + */
20 +static void notrace fiq_fsm_reload_hcdma(struct fiq_state *st, int n)
21 +{
22 +       hcdma_data_t hcdma = st->channel[n].hcdma_copy;
23 +       FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA, hcdma.d32);
24 +}
25 +
26 +/**
27   * fiq_iso_out_advance() - update DMA address and split position bits
28   * for isochronous OUT transactions.
29   *
30 @@ -827,11 +836,14 @@ static int notrace noinline fiq_fsm_do_h
31                         fiq_fsm_setup_csplit(state, n);
32                 } else if (hcint.b.nak) {
33                         // No buffer space in TT. Retry on a uframe boundary.
34 +                       fiq_fsm_reload_hcdma(state, n);
35                         st->fsm = FIQ_NP_SSPLIT_RETRY;
36                         handled = 1;
37                 } else if (hcint.b.xacterr) {
38                         // The only other one we care about is xacterr. This implies HS bus error - retry.
39                         st->nr_errors++;
40 +                       if(st->hcchar_copy.b.epdir == 0)
41 +                               fiq_fsm_reload_hcdma(state, n);
42                         st->fsm = FIQ_NP_SSPLIT_RETRY;
43                         if (st->nr_errors >= 3) {
44                                 st->fsm = FIQ_NP_SPLIT_HS_ABORTED;