Skip to content

Commit 3b53ff1

Browse files
P33Mpopcornmix
P33M
authored andcommitted
dwc_otg: fiq_fsm: fix incorrect DMA register offset calculation
Rationalise the offset and update all call sites. Fixes raspberrypi#2408
1 parent 675e29f commit 3b53ff1

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static int notrace fiq_increment_dma_buf(struct fiq_state *st, int num_channels,
250250
BUG();
251251

252252
hcdma.d32 = (dma_addr_t) &blob->channel[n].index[i].buf[0];
253-
FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32);
253+
FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA, hcdma.d32);
254254
st->channel[n].dma_info.index = i;
255255
return 0;
256256
}
@@ -302,7 +302,7 @@ static int notrace fiq_iso_out_advance(struct fiq_state *st, int num_channels, i
302302

303303
/* New DMA address - address of bounce buffer referred to in index */
304304
hcdma.d32 = (uint32_t) &blob->channel[n].index[i].buf[0];
305-
//hcdma.d32 = FIQ_READ(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n));
305+
//hcdma.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA);
306306
//hcdma.d32 += st->channel[n].dma_info.slot_len[i];
307307
fiq_print(FIQDBG_INT, st, "LAST: %01d ", last);
308308
fiq_print(FIQDBG_INT, st, "LEN: %03d", st->channel[n].dma_info.slot_len[i]);
@@ -317,7 +317,7 @@ static int notrace fiq_iso_out_advance(struct fiq_state *st, int num_channels, i
317317
st->channel[n].dma_info.index++;
318318
FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCSPLT, hcsplt.d32);
319319
FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HCTSIZ, hctsiz.d32);
320-
FIQ_WRITE(st->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32);
320+
FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA, hcdma.d32);
321321
return last;
322322
}
323323

@@ -564,7 +564,7 @@ static int notrace noinline fiq_fsm_update_hs_isoc(struct fiq_state *state, int
564564

565565
/* grab the next DMA address offset from the array */
566566
hcdma.d32 = st->hcdma_copy.d32 + st->hs_isoc_info.iso_desc[st->hs_isoc_info.index].offset;
567-
FIQ_WRITE(state->dwc_regs_base + HC_DMA + (HC_OFFSET * n), hcdma.d32);
567+
FIQ_WRITE(state->dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA, hcdma.d32);
568568

569569
/* We need to set multi_count. This is a bit tricky - has to be set per-transaction as
570570
* the core needs to be told to send the correct number. Caution: for IN transfers,

drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ do { \
9494
#define HC_START 0x500
9595
#define HC_OFFSET 0x020
9696

97-
#define HC_DMA 0x514
97+
#define HC_DMA 0x14
9898

9999
#define HCCHAR 0x00
100100
#define HCSPLT 0x04

0 commit comments

Comments
 (0)