RE: ehci-fsl driver's power management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 6 Apr 2012, Chen Peter-B29397 wrote:

> > Anatolij and others:
> > 
> > Can you explain why the ehci_fsl_mpc512x_drv_suspend() routine goes to
> > the trouble of turning off the CMD_RUN bit in the EHCI command
> > register, and why ehci_fsl_mpc512x_drv_resume() turns it back on?
> > 
> 
> > These routines handle power management for the EHCI controller.  At the
> > time they run, the root hub is guaranteed to be suspended -- that is,
> > ehci_bus_suspend() has run and ehci_bus_resume() hasn't been called
> > yet.  As a result, the CMD_RUN bit should already be off and it should
> > remain off.
> > 
> > Would it be okay for me to remove the code that changes the CMD_RUN
> > bit?
> > 
> At fsl driver, the controller suspend/resume routine is not only used at system pm
> routine, but also for OTG ID switch, it needs to save/restore registers as udc driver
> will change it. I (I work at ARM platform) guess operation for CMD_RUN is to make sure
> CMD_RUN is 0 before switch to device mode, set CMD_RUN to 1 before host wants to run.

IIRC there was a problem involving timing.  Suspending the root hub 
might take too long for the OTG protocol.  But the problem goes farther 
than that; even when the root hub is suspended, somebody might still 
try to access it via usbfs.

Wouldn't it be better to unregister the host bus entirely when
switching to device mode?  This seems more reliable than calling the
controller's suspend routine.  The problem is how to do it quickly
enough.

> > Also, why does the resume routine call usb_hcd_resume_root_hub()?  Is
> > there a hardware bug that causes the controller not to issue the proper
> > IRQ when a root-hub wakeup event occurs?
> > 
> The reason is when CMD_RUN is 1, the usb_hcd_resume_root_hub will not be called at PCD interrupt.
> The last four lines of code at ehci_fsl_mpc512x_drv_resume may be commented since pcd interrupt
> will be occurred after vbus is on.
> 
> 
>         tmp = ehci_readl(ehci, &ehci->regs->command);
>         tmp |= CMD_RUN;              
>         ehci_writel(ehci, tmp, &ehci->regs->command);
> 
>         usb_hcd_resume_root_hub(hcd);

This all appears to be a result of trying to use the same code for 
suspend and OTG mode switching.  Not a good idea.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux