usb: ehci: tegra: Read port speed from hostpc register
Venkat Moganty [Fri, 5 Aug 2011 13:51:08 +0000 (18:51 +0530)]
During system suspend USB port speed need to be stored. If controller has hostpc
then port speed should be read from the hostpc register instead of portsc.

Bug 854000

Original-Change-Id: Ic5c2c7eb11c923a64efe98f3b7006400db5ca50b
Reviewed-on: http://git-master/r/45533
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Ref20e23654c8d80675250240ed901fea26192b18

drivers/usb/host/ehci-tegra.c

index c10f66e..341a05b 100644 (file)
@@ -44,6 +44,7 @@
 #define STS_SRI        (1<<7)  /*      SOF Recieved    */
 
 #define TEGRA_HSIC_CONNECTION_MAX_RETRIES 5
+#define HOSTPC_REG_OFFSET       0x1b4
 
 struct tegra_ehci_hcd {
        struct ehci_hcd *ehci;
@@ -442,7 +443,10 @@ static int tegra_usb_suspend(struct usb_hcd *hcd, bool is_dpd)
 
        spin_lock_irqsave(&tegra->ehci->lock, flags);
 
-       tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3;
+       if (tegra->ehci->has_hostpc)
+               tegra->port_speed = (readl(hcd->regs + HOSTPC_REG_OFFSET) >> 25) & 0x3;
+       else
+               tegra->port_speed = (readl(&hw->port_status[0]) >> 26) & 0x3;
        ehci_halt(tegra->ehci);
 
        spin_unlock_irqrestore(&tegra->ehci->lock, flags);