tegra: usb: fix ehci suspend in host mode
Alexandre Courbot [Tue, 7 Jun 2011 06:24:49 +0000 (15:24 +0900)]
When suspend is called and usb1 is in host mode, tegra_hci_remove is
invoked to remove the device. However, at this time it is likely that
runtime PM will have powered off usb1. This patch ensures usb1 is
powered on if necessary within tegra_hci_remove so that ehci controller
registers can be manipulated.

Bug 835677.

Reviewed-on: http://git-master/r/35592
(cherry picked from commit 88d6c27b5fb6122cfe21aa360c417f675f5f2797)

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Original-Change-Id: Ifc98ba9cf42a6b09671bb722ff4bdf23798cf1f8
Reviewed-on: http://git-master/r/37985
Reviewed-by: Hanumanth Venkateswa Moganty <vmoganty@nvidia.com>

Rebase-Id: R36465ebfda53c2289623259b2202975a2d7522c8

drivers/usb/host/ehci-tegra.c

index 46489cf..877d45a 100644 (file)
@@ -1119,6 +1119,9 @@ static int tegra_ehci_remove(struct platform_device *pdev)
 
        if (tegra == NULL || hcd == NULL)
                return -EINVAL;
+       /* make sure controller is on as we will touch its registers */
+       if (!tegra->host_resumed)
+               tegra_ehci_power_up(hcd, true);
 
 #ifdef CONFIG_USB_OTG_UTILS
        if (tegra->transceiver) {