16.12.2020 12:32, Peter Chen пишет: >> ... >>>> +static int tegra_usb_internal_port_reset(struct ehci_hcd *ehci, >>>> + u32 __iomem *portsc_reg, >>>> + unsigned long *flags) >>>> +{ >>>> + u32 saved_usbintr, temp; >>>> + unsigned int i, tries; >>>> + int retval = 0; >>>> + >>>> + saved_usbintr = ehci_readl(ehci, &ehci->regs->intr_enable); >>>> + /* disable USB interrupt */ >>>> + ehci_writel(ehci, 0, &ehci->regs->intr_enable); >>>> + spin_unlock_irqrestore(&ehci->lock, *flags); >>>> + >>>> + /* >>>> + * Here we have to do Port Reset at most twice for >>>> + * Port Enable bit to be set. >>>> + */ >>>> + for (i = 0; i < 2; i++) { >>>> + temp = ehci_readl(ehci, portsc_reg); >>>> + temp |= PORT_RESET; >>>> + ehci_writel(ehci, temp, portsc_reg); >>>> + mdelay(10); >>> Needs accurate delay? How about usleep_range? >> To be hones I don't know for sure whether hub_control() could be used from >> interrupt context. This mdelay is borrowed from the older ehci-tegra driver. >> >> Are you suggesting that it should be safe to sleep here? >> > I see msleep is called at tegra_ehci_hub_control at ehci-tegra.c. > .hub_control is not called at interrupt context. > Alright, I'll change to use msleep() in v2, thanks.