USB: Avoid 20ms delay in EHCI resume
For function ehci_bus_resume() - Added flag resume_needed No need to wait for 20ms if no port was suspended - Change mdelay to msleep - release and reacquire the spinlock around mdelay Signed-off-by: vikram pandita <vikram.pandita@ti.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
8e8ce4b642
commit
3a4e72cbf2
1 changed files with 15 additions and 3 deletions
|
@ -194,6 +194,7 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
|
||||||
u32 temp;
|
u32 temp;
|
||||||
u32 power_okay;
|
u32 power_okay;
|
||||||
int i;
|
int i;
|
||||||
|
u8 resume_needed = 0;
|
||||||
|
|
||||||
if (time_before (jiffies, ehci->next_statechange))
|
if (time_before (jiffies, ehci->next_statechange))
|
||||||
msleep(5);
|
msleep(5);
|
||||||
|
@ -228,7 +229,9 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
|
||||||
|
|
||||||
/* Some controller/firmware combinations need a delay during which
|
/* Some controller/firmware combinations need a delay during which
|
||||||
* they set up the port statuses. See Bugzilla #8190. */
|
* they set up the port statuses. See Bugzilla #8190. */
|
||||||
mdelay(8);
|
spin_unlock_irq(&ehci->lock);
|
||||||
|
msleep(8);
|
||||||
|
spin_lock_irq(&ehci->lock);
|
||||||
|
|
||||||
/* manually resume the ports we suspended during bus_suspend() */
|
/* manually resume the ports we suspended during bus_suspend() */
|
||||||
i = HCS_N_PORTS (ehci->hcs_params);
|
i = HCS_N_PORTS (ehci->hcs_params);
|
||||||
|
@ -236,12 +239,21 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
|
||||||
temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
|
temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
|
||||||
temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
|
temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
|
||||||
if (test_bit(i, &ehci->bus_suspended) &&
|
if (test_bit(i, &ehci->bus_suspended) &&
|
||||||
(temp & PORT_SUSPEND))
|
(temp & PORT_SUSPEND)) {
|
||||||
temp |= PORT_RESUME;
|
temp |= PORT_RESUME;
|
||||||
|
resume_needed = 1;
|
||||||
|
}
|
||||||
ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
|
ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* msleep for 20ms only if code is trying to resume port */
|
||||||
|
if (resume_needed) {
|
||||||
|
spin_unlock_irq(&ehci->lock);
|
||||||
|
msleep(20);
|
||||||
|
spin_lock_irq(&ehci->lock);
|
||||||
|
}
|
||||||
|
|
||||||
i = HCS_N_PORTS (ehci->hcs_params);
|
i = HCS_N_PORTS (ehci->hcs_params);
|
||||||
mdelay (20);
|
|
||||||
while (i--) {
|
while (i--) {
|
||||||
temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
|
temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
|
||||||
if (test_bit(i, &ehci->bus_suspended) &&
|
if (test_bit(i, &ehci->bus_suspended) &&
|
||||||
|
|
Loading…
Add table
Reference in a new issue