From 725468621023ddda620e6377f2a77ed34f686d59 Mon Sep 17 00:00:00 2001 From: Mayank Rana Date: Thu, 28 Jan 2021 14:10:24 -0800 Subject: [PATCH] dwc3: gadget: Increase retry count from 500 to 3000 iterations DWC3 XMIT_DEV command is timing out for USB function wakeup functionality with current 500 iterations (i.e. timeout comes around 300us). USB DWC3 controller shall take more time to process this particular command. Hence increase retry count from 500 to 3000 iterations (i.e same as dwc3 endpoint command timeout value) to have sucessful USB function wakeup functionality. Change-Id: I1b5a9dd64a01ad9592a04c275beef77eaee523be Signed-off-by: Mayank Rana --- drivers/usb/dwc3/gadget.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index de7bdc7a9448..834f286cf79d 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -313,6 +313,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, spin_lock(&dwc->lock); } +#define DWC_CMD_TIMEOUT 3000 /** * dwc3_send_gadget_generic_command - issue a generic command for the controller * @dwc: pointer to the controller context @@ -324,7 +325,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, */ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, unsigned cmd, u32 param) { - u32 timeout = 500; + u32 timeout = DWC_CMD_TIMEOUT; int status = 0; int ret = 0; u32 reg; @@ -366,7 +367,7 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned cmd, { const struct usb_endpoint_descriptor *desc = dep->endpoint.desc; struct dwc3 *dwc = dep->dwc; - u32 timeout = 3000; + u32 timeout = DWC_CMD_TIMEOUT; u32 saved_config = 0; u32 reg;