If we check the use_dma before calling ->channel_program() then in case of use_dma is 0 we don't have to remove the MUSB_TXCSR_DMAENAB bit because we never set it. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> --- drivers/usb/musb/musb_gadget.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 696e9e0..06ceaf1 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -366,7 +366,7 @@ static void txstate(struct musb *musb, struct musb_request *req) } #endif - if (is_cppi_enabled()) { + if (is_cppi_enabled() && use_dma) { /* program endpoint CSR first, then setup DMA */ csr &= ~(MUSB_TXCSR_P_UNDERRUN | MUSB_TXCSR_TXPKTRDY); csr |= MUSB_TXCSR_DMAENAB | MUSB_TXCSR_DMAMODE | @@ -390,7 +390,7 @@ static void txstate(struct musb *musb, struct musb_request *req) * unreliable except for the * last-packet-is-already-short case. */ - use_dma = use_dma && c->channel_program( + use_dma = c->channel_program( musb_ep->dma, musb_ep->packet_sz, 0, request->dma + request->actual, @@ -402,8 +402,8 @@ static void txstate(struct musb *musb, struct musb_request *req) musb_writew(epio, MUSB_TXCSR, csr); /* invariant: prequest->buf is non-null */ } - } else if (tusb_dma_omap()) - use_dma = use_dma && c->channel_program( + } else if (tusb_dma_omap() && use_dma) + use_dma = c->channel_program( musb_ep->dma, musb_ep->packet_sz, request->zero, request->dma + request->actual, -- 1.8.4.rc1 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html