Re: [PATCH] ARM: OMAP: EHCI: Fix the hub disconnect after resume

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

 



On Wed, 27 Jun 2012, Keshava Munegowda wrote:

> Its observed that in Beagle XM , during suspend/resume the OMAP
> EHCI controller losing the register contents. this is causing the
> hub disconnect after the resume, this is causing failure of
> device detection after the resume.
> to avoid the hub disconnect , The ehci config flag register is
> configured again , reset the phy and issue the port powers during
> resume.

The idea is good, but the implementation is wrong.

> +static int omap_ehci_bus_resume(struct usb_hcd *hcd)
> +{
> +
> +	struct device				*dev = hcd->self.controller;
> +	struct ehci_hcd_omap_platform_data	*pdata = dev->platform_data;
> +	struct resource				*regs = hcd->regs;
> +
> +	/* In case , ports are not powered and config flag not set */
> +	if (~(ehci_read(regs, EHCI_CONFIGFLAG) & 0x01)) {
> +		ehci_write(regs, EHCI_CONFIGFLAG, 0x1);
> +
> +		/*
> +		 * An undocumented "feature" in the OMAP3 EHCI controller,
> +		 * causes suspended ports to be taken out of suspend when
> +		 * the USBCMD.Run/Stop bit is cleared (for example when
> +		 * we do ehci_bus_suspend).
> +		 * This breaks suspend-resume if the root-hub is allowed
> +		 * to suspend. Writing 1 to this undocumented register bit
> +		 * disables this feature and restores normal behavior.
> +		 */
> +		ehci_write(regs, EHCI_INSNREG04,
> +			   EHCI_INSNREG04_DISABLE_UNSUSPEND);
> +
> +		/* Soft reset the PHY using PHY reset command over ULPI */
> +		if (pdata->port_mode[0] == OMAP_EHCI_PORT_MODE_PHY)
> +			omap_ehci_soft_phy_reset(dev, 0);
> +		if (pdata->port_mode[1] == OMAP_EHCI_PORT_MODE_PHY)
> +			omap_ehci_soft_phy_reset(dev, 1);
> +
> +		/* root ports should always stay powered */
> +		ehci_port_power(hcd_to_ehci(hcd), 1);
> +	}

This needs to be done in the resume routine, not the bus_resume 
routine.  Since ehci-omap doesn't have any suspend or resume routines, 
it's not surprising that the controller doesn't work correctly after 
the system is resumed.

In a couple of days I will submit a patch that will make it a lot
easier to add suspend and resume routines for EHCI platform drivers.  
Maybe you'd prefer to wait until then to fix this issue.

Alan Stern

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


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux