9
0
Fork 0

ehci: Force a ehci_halt before trying to reset

As observed on OMAP some controllers do not like being
resetted when running.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2010-06-24 10:34:27 +02:00
parent 0b863c83d0
commit 2f64aa66ab
1 changed files with 21 additions and 0 deletions

View File

@ -770,12 +770,33 @@ unknown:
return -1;
}
/* force HC to halt state from unknown (EHCI spec section 2.3) */
static int ehci_halt(struct ehci_priv *ehci)
{
u32 temp = ehci_readl(&ehci->hcor->or_usbsts);
/* disable any irqs left enabled by previous code */
ehci_writel(&ehci->hcor->or_usbintr, 0);
if (temp & STS_HALT)
return 0;
temp = ehci_readl(&ehci->hcor->or_usbcmd);
temp &= ~CMD_RUN;
ehci_writel(&ehci->hcor->or_usbcmd, temp);
return handshake(&ehci->hcor->or_usbsts,
STS_HALT, STS_HALT, 16 * 125);
}
static int ehci_init(struct usb_host *host)
{
struct ehci_priv *ehci = to_ehci(host);
uint32_t reg;
uint32_t cmd;
ehci_halt(ehci);
/* EHCI spec section 4.1 */
if (ehci_reset(ehci) != 0)
return -1;