usb: gadget: udc: renesas_usb3: Fix return value of usb3_write_pipe()

This patch fixes an issue that this driver cannot go status stage
in control read when the req.zero is set to 1 and the len in
usb3_write_pipe() is set to 0. Otherwise, if we use g_ncm driver,
usb enumeration takes long time (5 seconds or more).

Fixes: 746bfe63bb ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
Yoshihiro Shimoda 2017-09-25 17:01:25 +09:00 committed by Felipe Balbi
parent 73f2f5745f
commit 447b8a01b8

View file

@ -1038,7 +1038,7 @@ static int usb3_write_pipe(struct renesas_usb3_ep *usb3_ep,
usb3_ep->ep.maxpacket); usb3_ep->ep.maxpacket);
u8 *buf = usb3_req->req.buf + usb3_req->req.actual; u8 *buf = usb3_req->req.buf + usb3_req->req.actual;
u32 tmp = 0; u32 tmp = 0;
bool is_last; bool is_last = !len ? true : false;
if (usb3_wait_pipe_status(usb3_ep, PX_STA_BUFSTS) < 0) if (usb3_wait_pipe_status(usb3_ep, PX_STA_BUFSTS) < 0)
return -EBUSY; return -EBUSY;
@ -1059,7 +1059,8 @@ static int usb3_write_pipe(struct renesas_usb3_ep *usb3_ep,
usb3_write(usb3, tmp, fifo_reg); usb3_write(usb3, tmp, fifo_reg);
} }
is_last = usb3_is_transfer_complete(usb3_ep, usb3_req); if (!is_last)
is_last = usb3_is_transfer_complete(usb3_ep, usb3_req);
/* Send the data */ /* Send the data */
usb3_set_px_con_send(usb3_ep, len, is_last); usb3_set_px_con_send(usb3_ep, len, is_last);