openwrt/target/linux/brcm2708/patches-4.14/950-0135-fiq_fsm-rewind-DMA...

45 lines
1.5 KiB
Diff

From 3d0898f22d62dd7a05c39de9ea7e200689dc6c20 Mon Sep 17 00:00:00 2001
From: P33M <P33M@users.noreply.github.com>
Date: Fri, 24 Nov 2017 13:49:26 +0000
Subject: [PATCH 135/454] fiq_fsm: rewind DMA pointer for OUT transactions that
fail (#2288)
See: https://github.com/raspberrypi/linux/issues/2140
---
drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
--- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
@@ -267,6 +267,15 @@ static void notrace fiq_fsm_reload_hctsi
}
/**
+ * fiq_fsm_reload_hcdma() - for OUT transactions, rewind DMA pointer
+ */
+static void notrace fiq_fsm_reload_hcdma(struct fiq_state *st, int n)
+{
+ hcdma_data_t hcdma = st->channel[n].hcdma_copy;
+ FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA, hcdma.d32);
+}
+
+/**
* fiq_iso_out_advance() - update DMA address and split position bits
* for isochronous OUT transactions.
*
@@ -827,11 +836,14 @@ static int notrace noinline fiq_fsm_do_h
fiq_fsm_setup_csplit(state, n);
} else if (hcint.b.nak) {
// No buffer space in TT. Retry on a uframe boundary.
+ fiq_fsm_reload_hcdma(state, n);
st->fsm = FIQ_NP_SSPLIT_RETRY;
handled = 1;
} else if (hcint.b.xacterr) {
// The only other one we care about is xacterr. This implies HS bus error - retry.
st->nr_errors++;
+ if(st->hcchar_copy.b.epdir == 0)
+ fiq_fsm_reload_hcdma(state, n);
st->fsm = FIQ_NP_SSPLIT_RETRY;
if (st->nr_errors >= 3) {
st->fsm = FIQ_NP_SPLIT_HS_ABORTED;