]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.13.6/usb-gadget-udc-renesas_usb3-fix-return-value-of-usb3_write_pipe.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.13.6 / usb-gadget-udc-renesas_usb3-fix-return-value-of-usb3_write_pipe.patch
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()
5
6 From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
7
8 commit 447b8a01b84f048d93d43bfe1fcaa4fcc56595cc upstream.
9
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).
14
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>
19
20 ---
21 drivers/usb/gadget/udc/renesas_usb3.c | 5 +++--
22 1 file changed, 3 insertions(+), 2 deletions(-)
23
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;
29 u32 tmp = 0;
30 - bool is_last;
31 + bool is_last = !len ? true : false;
32
33 if (usb3_wait_pipe_status(usb3_ep, PX_STA_BUFSTS) < 0)
34 return -EBUSY;
35 @@ -1053,7 +1053,8 @@ static int usb3_write_pipe(struct renesa
36 usb3_write(usb3, tmp, fifo_reg);
37 }
38
39 - is_last = usb3_is_transfer_complete(usb3_ep, usb3_req);
40 + if (!is_last)
41 + is_last = usb3_is_transfer_complete(usb3_ep, usb3_req);
42 /* Send the data */
43 usb3_set_px_con_send(usb3_ep, len, is_last);
44