aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs
diff options
context:
space:
mode:
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>2014-08-22 07:14:10 -0400
committerFelipe Balbi <balbi@ti.com>2014-09-03 10:15:58 -0400
commitc0ed8b23b257a84d103764cdbd490ee5e2749da3 (patch)
tree45629df6db135cf0ceca8362f42256d4dbc57f7f /drivers/usb/renesas_usbhs
parentc4d8199ba1a7aa390b06db23f4532e2c1875aefb (diff)
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>
Diffstat (limited to 'drivers/usb/renesas_usbhs')
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 3efece3c72a3..1564829951c0 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -889,16 +889,29 @@ usbhsf_pio_prepare_push:
889static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done) 889static int usbhsf_dma_push_done(struct usbhs_pkt *pkt, int *is_done)
890{ 890{
891 struct usbhs_pipe *pipe = pkt->pipe; 891 struct usbhs_pipe *pipe = pkt->pipe;
892 int is_short = pkt->trans % usbhs_pipe_get_maxpacket(pipe);
892 893
893 pkt->actual = pkt->trans; 894 pkt->actual += pkt->trans;
895
896 if (pkt->actual < pkt->length)
897 *is_done = 0; /* there are remainder data */
898 else if (is_short)
899 *is_done = 1; /* short packet */
900 else
901 *is_done = !pkt->zero; /* send zero packet? */
894 902
895 *is_done = !pkt->zero; /* send zero packet ? */
896 usbhs_pipe_running(pipe, !*is_done); 903 usbhs_pipe_running(pipe, !*is_done);
897 904
898 usbhsf_dma_stop(pipe, pipe->fifo); 905 usbhsf_dma_stop(pipe, pipe->fifo);
899 usbhsf_dma_unmap(pkt); 906 usbhsf_dma_unmap(pkt);
900 usbhsf_fifo_unselect(pipe, pipe->fifo); 907 usbhsf_fifo_unselect(pipe, pipe->fifo);
901 908
909 if (!*is_done) {
910 /* change handler to PIO */
911 pkt->handler = &usbhs_fifo_pio_push_handler;
912 return pkt->handler->try_run(pkt, is_done);
913 }
914
902 return 0; 915 return 0;
903} 916}
904 917