1 From 447b8a01b84f048d93d43bfe1fcaa4fcc56595cc Mon Sep 17 00:00:00 2001
2 From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
3 Date: Mon, 25 Sep 2017 17:01:25 +0900
4 Subject: usb: gadget: udc: renesas_usb3: Fix return value of usb3_write_pipe()
6 From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
8 commit 447b8a01b84f048d93d43bfe1fcaa4fcc56595cc upstream.
10 This patch fixes an issue that this driver cannot go status stage
11 in control read when the req.zero is set to 1 and the len in
12 usb3_write_pipe() is set to 0. Otherwise, if we use g_ncm driver,
13 usb enumeration takes long time (5 seconds or more).
15 Fixes: 746bfe63bba3 ("usb: gadget: renesas_usb3: add support for Renesas USB3.0 peripheral controller")
16 Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
17 Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 drivers/usb/gadget/udc/renesas_usb3.c | 5 +++--
22 1 file changed, 3 insertions(+), 2 deletions(-)
24 --- a/drivers/usb/gadget/udc/renesas_usb3.c
25 +++ b/drivers/usb/gadget/udc/renesas_usb3.c
26 @@ -1032,7 +1032,7 @@ static int usb3_write_pipe(struct renesa
27 usb3_ep->ep.maxpacket);
28 u8 *buf = usb3_req->req.buf + usb3_req->req.actual;
31 + bool is_last = !len ? true : false;
33 if (usb3_wait_pipe_status(usb3_ep, PX_STA_BUFSTS) < 0)
35 @@ -1053,7 +1053,8 @@ static int usb3_write_pipe(struct renesa
36 usb3_write(usb3, tmp, fifo_reg);
39 - is_last = usb3_is_transfer_complete(usb3_ep, usb3_req);
41 + is_last = usb3_is_transfer_complete(usb3_ep, usb3_req);
43 usb3_set_px_con_send(usb3_ep, len, is_last);