From 08d70a350e6171b4f774b4293af9557ef1f3ce36 Mon Sep 17 00:00:00 2001 From: Bo Yan Date: Wed, 24 Aug 2011 10:31:31 -0700 Subject: usb: ehci: tegra: Synchronize suspend and shutdown Synchronize shutdown with suspend, this is to prevent race condition between shutdown and suspend Bug 798849 Change-Id: I61cc2a03cef15d1656ad41bfefff446910210ffd Reviewed-on: http://git-master/r/49013 Reviewed-by: Bo Yan Tested-by: Bo Yan Reviewed-by: Yu-Huan Hsu --- drivers/usb/host/ehci-tegra.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index a67a5276b662..a53963ee46d3 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -612,6 +612,11 @@ static int tegra_ehci_bus_suspend(struct usb_hcd *hcd) u32 port_status; int error_status = 0; + mutex_lock(&tegra->tegra_ehci_hcd_mutex); + /* ehci_shutdown touches the USB controller registers, make sure + * controller has clocks to it */ + if (!tegra->host_resumed) + tegra_ehci_power_up(hcd, false); error_status = ehci_bus_suspend(hcd); if (!error_status && tegra->power_down_on_bus_suspend) { port_status = ehci_readl(ehci, &ehci->regs->port_status[0]); @@ -621,6 +626,7 @@ static int tegra_ehci_bus_suspend(struct usb_hcd *hcd) } } tegra_usb_phy_postsuspend(tegra->phy, false); + mutex_unlock(&tegra->tegra_ehci_hcd_mutex); return error_status; } -- cgit v1.2.3