diff options
author | Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> | 2014-08-22 20:14:10 +0900 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2014-12-05 09:25:21 +0900 |
commit | 46bdaf553a68e3aba64af5af39952091d72e4243 (patch) | |
tree | ea101913b0878af6d7b1a54a7b08dad1a3fb537d | |
parent | 17479e68d7904ceb5d7477dd7b17c5add6ceb774 (diff) | |
download | renesas_kernel-46bdaf553a68e3aba64af5af39952091d72e4243.tar.gz renesas_kernel-46bdaf553a68e3aba64af5af39952091d72e4243.tar.bz2 renesas_kernel-46bdaf553a68e3aba64af5af39952091d72e4243.zip |
usb: renesas_usbhs: fix the condition of is_done in usbhsf_dma_push_done
This patch fixes the condition of is_done in usbhsf_dma_push_done().
This function will be called after a transmission finished by DMAC.
So, the function should check if the transmission packet is short packet
or not. Also the function should call try_run to send the zero packet
by the pio handler if the "*is_done" is not set. Otherwize, the
transaction will not finish if a gadget driver sets the "zero" flag
in a transmission.
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry picked from commit c0ed8b23b257a84d103764cdbd490ee5e2749da3)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | drivers/usb/renesas_usbhs/fifo.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c index 3efece3c72a..1564829951c 100644 --- a/drivers/usb/renesas_usbhs/fifo.c +++ b/drivers/usb/renesas_usbhs/fifo.c @@ -889,16 +889,29 @@ usbhsf_pio_prepare_push: static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done) { struct usbhs_pipe *pipe = pkt->pipe; + int is_short = pkt->trans % usbhs_pipe_get_maxpacket(pipe); - pkt->actual = pkt->trans; + pkt->actual += pkt->trans; + + if (pkt->actual < pkt->length) + *is_done = 0; /* there are remainder data */ + else if (is_short) + *is_done = 1; /* short packet */ + else + *is_done = !pkt->zero; /* send zero packet? */ - *is_done = !pkt->zero; /* send zero packet ? */ usbhs_pipe_running(pipe, !*is_done); usbhsf_dma_stop(pipe, pipe->fifo); usbhsf_dma_unmap(pkt); usbhsf_fifo_unselect(pipe, pipe->fifo); + if (!*is_done) { + /* change handler to PIO */ + pkt->handler = &usbhs_fifo_pio_push_handler; + return pkt->handler->try_run(pkt, is_done); + } + return 0; } |