提交 c0ed8b23 编写于 作者: Y Yoshihiro Shimoda 提交者: Felipe Balbi

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: NYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: NFelipe Balbi <balbi@ti.com>
上级 c4d8199b
......@@ -889,16 +889,29 @@ static int usbhsf_dma_prepare_push(struct usbhs_pkt *pkt, int *is_done)
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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册