/* Force HC to halt state from unknown (EHCI spec section 2.3). Must be called with interrupts enabled and the lock not held.  */
int ehci_halt(struct ehci_hcd *ehci)
/* Force HC to halt state from unknown (EHCI spec section 2.3). Must be called with interrupts enabled and the lock not held.  */
int ehci_halt(struct ehci_hcd *ehci)
{
    u32 temp;
    uint32_t cpusr;
    hal_spin_lock(&ehci->lock);
    ehci_writel(ehci, 0, &ehci->regs->intr_enable);
    ehci->command &= ~CMD_RUN;
    temp = ehci_readl(ehci, &ehci->regs->command);
    temp &= ~(CMD_RUN | CMD_IAAD);
    ehci_writel(ehci, temp, &ehci->regs->command);
    hal_spin_unlock(&ehci->lock);
    return ehci_handshake(ehci, &ehci->regs->status,
              STS_HALT, STS_HALT, 16 * 125);
}