summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Yan <byan@nvidia.com>2011-08-24 10:31:31 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-09-02 17:52:39 -0700
commit08d70a350e6171b4f774b4293af9557ef1f3ce36 (patch)
tree10ad38ea1f2d3c312adffab9540c71156da72f57
parentd23a50ccde4b3e8627d6d1d78e7e09a13229585e (diff)
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 <byan@nvidia.com> Tested-by: Bo Yan <byan@nvidia.com> Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>
-rw-r--r--drivers/usb/host/ehci-tegra.c6
1 files changed, 6 insertions, 0 deletions
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;
}