summaryrefslogtreecommitdiff
path: root/drivers/usb/host/ehci-tegra.c
diff options
context:
space:
mode:
authorBo Yan <byan@nvidia.com>2011-08-24 10:31:31 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-11-30 21:48:48 -0800
commit5e9678f72a508026a953cb92b51791c8e48f7cb0 (patch)
treeee4b6b1a61ceddfba24619d9d46e147076808352 /drivers/usb/host/ehci-tegra.c
parentfc7a71e8979e2740dddf52b9182b601a512fb1ea (diff)
usb: ehci: tegra: Synchronize suspend and shutdown
Synchronize shutdown with suspend, this is to prevent race condition between shutdown and suspend Bug 798849 Original-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> Rebase-Id: Rb867cf2a4d3e42fca0eac5aaf6eb7554468cce88
Diffstat (limited to 'drivers/usb/host/ehci-tegra.c')
-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 20aba66b9592..2e5b001691cd 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -686,6 +686,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]);
@@ -695,6 +700,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;
}