Skip to content

Commit 47699b0

Browse files
Peter Ujfalusigregkh
authored andcommitted
usb: musb: tusb6010: Handle DMA TX completion in DMA callback as well
Handle the DMA TX in a similar way as we do for the RX: in the DMA completion callback. Since we are no longer using DMA completion interrupt for the TX we can as wall keep these interrupts disabled, but keep the handler for debug purposes. Signed-off-by: Peter Ujfalusi <[email protected]> Tested-by: Tony Lindgren <[email protected]> Signed-off-by: Bin Liu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4cadc71 commit 47699b0

File tree

2 files changed

+4
-48
lines changed

2 files changed

+4
-48
lines changed

drivers/usb/musb/tusb6010.c

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -881,26 +881,14 @@ static irqreturn_t tusb_musb_interrupt(int irq, void *__hci)
881881
| TUSB_INT_SRC_ID_STATUS_CHNG))
882882
idle_timeout = tusb_otg_ints(musb, int_src, tbase);
883883

884-
/* TX dma callback must be handled here, RX dma callback is
885-
* handled in tusb_omap_dma_cb.
884+
/*
885+
* Just clear the DMA interrupt if it comes as the completion for both
886+
* TX and RX is handled by the DMA callback in tusb6010_omap
886887
*/
887888
if ((int_src & TUSB_INT_SRC_TXRX_DMA_DONE)) {
888889
u32 dma_src = musb_readl(tbase, TUSB_DMA_INT_SRC);
889-
u32 real_dma_src = musb_readl(tbase, TUSB_DMA_INT_MASK);
890890

891891
dev_dbg(musb->controller, "DMA IRQ %08x\n", dma_src);
892-
real_dma_src = ~real_dma_src & dma_src;
893-
if (tusb_dma_omap(musb) && real_dma_src) {
894-
int tx_source = (real_dma_src & 0xffff);
895-
int i;
896-
897-
for (i = 1; i <= 15; i++) {
898-
if (tx_source & (1 << i)) {
899-
dev_dbg(musb->controller, "completing ep%i %s\n", i, "tx");
900-
musb_dma_completion(musb, i, 1);
901-
}
902-
}
903-
}
904892
musb_writel(tbase, TUSB_DMA_INT_CLEAR, dma_src);
905893
}
906894

drivers/usb/musb/tusb6010_omap.c

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,7 @@ static void tusb_omap_dma_cb(int lch, u16 ch_status, void *data)
173173

174174
channel->status = MUSB_DMA_STATUS_FREE;
175175

176-
/* Handle only RX callbacks here. TX callbacks must be handled based
177-
* on the TUSB DMA status interrupt.
178-
* REVISIT: Use both TUSB DMA status interrupt and OMAP DMA callback
179-
* interrupt for RX and TX.
180-
*/
181-
if (!chdat->tx)
182-
musb_dma_completion(musb, chdat->epnum, chdat->tx);
176+
musb_dma_completion(musb, chdat->epnum, chdat->tx);
183177

184178
/* We must terminate short tx transfers manually by setting TXPKTRDY.
185179
* REVISIT: This same problem may occur with other MUSB dma as well.
@@ -464,22 +458,12 @@ tusb_omap_dma_allocate(struct dma_controller *c,
464458
int ret, i;
465459
struct tusb_omap_dma *tusb_dma;
466460
struct musb *musb;
467-
void __iomem *tbase;
468461
struct dma_channel *channel = NULL;
469462
struct tusb_omap_dma_ch *chdat = NULL;
470463
struct tusb_dma_data *dma_data = NULL;
471-
u32 reg;
472464

473465
tusb_dma = container_of(c, struct tusb_omap_dma, controller);
474466
musb = tusb_dma->controller.musb;
475-
tbase = musb->ctrl_base;
476-
477-
reg = musb_readl(tbase, TUSB_DMA_INT_MASK);
478-
if (tx)
479-
reg &= ~(1 << hw_ep->epnum);
480-
else
481-
reg &= ~(1 << (hw_ep->epnum + 15));
482-
musb_writel(tbase, TUSB_DMA_INT_MASK, reg);
483467

484468
/* REVISIT: Why does dmareq5 not work? */
485469
if (hw_ep->epnum == 0) {
@@ -548,26 +532,10 @@ static void tusb_omap_dma_release(struct dma_channel *channel)
548532
{
549533
struct tusb_omap_dma_ch *chdat = to_chdat(channel);
550534
struct musb *musb = chdat->musb;
551-
void __iomem *tbase = musb->ctrl_base;
552-
u32 reg;
553535

554536
dev_dbg(musb->controller, "ep%i ch%i\n", chdat->epnum,
555537
chdat->dma_data->ch);
556538

557-
reg = musb_readl(tbase, TUSB_DMA_INT_MASK);
558-
if (chdat->tx)
559-
reg |= (1 << chdat->epnum);
560-
else
561-
reg |= (1 << (chdat->epnum + 15));
562-
musb_writel(tbase, TUSB_DMA_INT_MASK, reg);
563-
564-
reg = musb_readl(tbase, TUSB_DMA_INT_CLEAR);
565-
if (chdat->tx)
566-
reg |= (1 << chdat->epnum);
567-
else
568-
reg |= (1 << (chdat->epnum + 15));
569-
musb_writel(tbase, TUSB_DMA_INT_CLEAR, reg);
570-
571539
channel->status = MUSB_DMA_STATUS_UNKNOWN;
572540

573541
omap_stop_dma(chdat->dma_data->ch);

0 commit comments

Comments
 (0)