aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/gadget.c
diff options
context:
space:
mode:
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>2012-02-24 20:32:15 -0500
committerFelipe Balbi <balbi@ti.com>2012-03-02 05:12:09 -0500
commitaee63e3cb6b0396b99c6387a47cb90a7417f3957 (patch)
tree76468eed5464d6fca184f725467060518d23b5cd /drivers/usb/dwc3/gadget.c
parent7d26b58735f5badf2b7ce3320c6ba21b603c77a9 (diff)
usb: dwc3: shorten long delay in dwc3_gadget_set_link_state()
The loop in dwc3_gadget_set_link_state() was using a udelay(500), which is a long time to delay in interrupt context. Change it to udelay(5) and increase the loop count to match. Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r--drivers/usb/dwc3/gadget.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index fac11491850f..e2633dd03f8c 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -95,11 +95,11 @@ int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode)
95 * @state: the state to put link into 95 * @state: the state to put link into
96 * 96 *
97 * Caller should take care of locking. This function will 97 * Caller should take care of locking. This function will
98 * return 0 on success or -EINVAL. 98 * return 0 on success or -ETIMEDOUT.
99 */ 99 */
100int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state) 100int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state)
101{ 101{
102 int retries = 100; 102 int retries = 10000;
103 u32 reg; 103 u32 reg;
104 104
105 reg = dwc3_readl(dwc->regs, DWC3_DCTL); 105 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
@@ -113,11 +113,10 @@ int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum dwc3_link_state state)
113 while (--retries) { 113 while (--retries) {
114 reg = dwc3_readl(dwc->regs, DWC3_DSTS); 114 reg = dwc3_readl(dwc->regs, DWC3_DSTS);
115 115
116 /* in HS, means ON */
117 if (DWC3_DSTS_USBLNKST(reg) == state) 116 if (DWC3_DSTS_USBLNKST(reg) == state)
118 return 0; 117 return 0;
119 118
120 udelay(500); 119 udelay(5);
121 } 120 }
122 121
123 dev_vdbg(dwc->dev, "link state change request timed out\n"); 122 dev_vdbg(dwc->dev, "link state change request timed out\n");