Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6273f181 authored by Peter Chen's avatar Peter Chen Committed by Greg Kroah-Hartman
Browse files

USB: EHCI: add condition for delay during the resume



Without this condition, all controllers will do this delay,
and increase the resume time.

Only enabled and unsuspended port needs this delay, but
Some buggy hardware(like Synopsys usb controller) will
clear suspend bit once they receive/send resume signal,
so it takes resume bit as consideration.

Tested it at Freescale i.mx6q Sabrelite board.

Signed-off-by: default avatarPeter Chen <peter.chen@freescale.com>
Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e8cebb9c
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -384,11 +384,24 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
	ehci_writel(ehci, ehci->command, &ehci->regs->command);
	ehci->rh_state = EHCI_RH_RUNNING;

	/* Some controller/firmware combinations need a delay during which
	 * they set up the port statuses.  See Bugzilla #8190. */
	/*
	 * According to Bugzilla #8190, the port status for some controllers
	 * will be wrong without a delay. At their wrong status, the port
	 * is enabled, but not suspended neither resumed.
	 */
	i = HCS_N_PORTS(ehci->hcs_params);
	while (i--) {
		temp = ehci_readl(ehci, &ehci->regs->port_status[i]);
		if ((temp & PORT_PE) &&
				!(temp & (PORT_SUSPEND | PORT_RESUME))) {
			ehci_dbg(ehci, "Port status(0x%x) is wrong\n", temp);
			spin_unlock_irq(&ehci->lock);
			msleep(8);
			spin_lock_irq(&ehci->lock);
			break;
		}
	}

	if (ehci->shutdown)
		goto shutdown;