Skip to content

Commit

Permalink
usb: renesas_usbhs: missed the "running" flag in usb_dmac with rx path
Browse files Browse the repository at this point in the history
This fixes an issue that a gadget driver (usb_f_fs) is possible to
stop rx transactions after the usb-dmac is used because the following
functions missed to set/check the "running" flag.
 - usbhsf_dma_prepare_pop_with_usb_dmac()
 - usbhsf_dma_pop_done_with_usb_dmac()

So, if next transaction uses pio, the usbhsf_prepare_pop() can not
start the transaction because the "running" flag is 0.

Fixes: 8355b2b ("usb: renesas_usbhs: fix the behavior of some usbhs_pkt_handle")
Cc: <[email protected]> # v3.19+
Signed-off-by: Yoshihiro Shimoda <[email protected]>
Signed-off-by: Felipe Balbi <[email protected]>
  • Loading branch information
shimoday authored and Felipe Balbi committed Feb 12, 2018
1 parent 20bf410 commit 17aa31f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/usb/renesas_usbhs/fifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,10 @@ static int usbhsf_dma_prepare_pop_with_usb_dmac(struct usbhs_pkt *pkt,
if ((uintptr_t)pkt->buf & (USBHS_USB_DMAC_XFER_SIZE - 1))
goto usbhsf_pio_prepare_pop;

/* return at this time if the pipe is running */
if (usbhs_pipe_is_running(pipe))
return 0;

usbhs_pipe_config_change_bfre(pipe, 1);

ret = usbhsf_fifo_select(pipe, fifo, 0);
Expand Down Expand Up @@ -1172,6 +1176,7 @@ static int usbhsf_dma_pop_done_with_usb_dmac(struct usbhs_pkt *pkt,
usbhsf_fifo_clear(pipe, fifo);
pkt->actual = usbhs_dma_calc_received_size(pkt, chan, rcv_len);

usbhs_pipe_running(pipe, 0);
usbhsf_dma_stop(pipe, fifo);
usbhsf_dma_unmap(pkt);
usbhsf_fifo_unselect(pipe, pipe->fifo);
Expand Down

0 comments on commit 17aa31f

Please sign in to comment.