/* Reset a non-running (STS_HALT == 1) controller. Must be called with interrupts enabled and the lock not held.  */
int ehci_reset(struct ehci_hcd *ehci)
/* Reset a non-running (STS_HALT == 1) controller. Must be called with interrupts enabled and the lock not held.  */
int ehci_reset(struct ehci_hcd *ehci)
{
    int retval;
    u32 command = ehci_readl(ehci, &ehci->regs->command);
    command |= CMD_RESET;
    ehci_writel(ehci, command, &ehci->regs->command);
    ehci->rh_state = EHCI_RH_HALTED;
    retval = ehci_handshake(ehci, &ehci->regs->command,
                CMD_RESET, 0, 250 * 1000);
    if (ehci->has_hostpc) {
        ehci_writel(ehci, USBMODE_EX_HC | USBMODE_EX_VBPS,
                &ehci->regs->usbmode_ex);
        ehci_writel(ehci, TXFIFO_DEFAULT, &ehci->regs->txfill_tuning);
    }
    if (retval)
        return retval;
    ehci->port_c_suspend = ehci->suspended_ports =
            ehci->resuming_ports = 0;
    return retval;
}