usb: xhci: tegra: enable HS wake intr for active ports
Ajay Gupta [Fri, 17 May 2013 21:29:06 +0000 (14:29 -0700)]
Enabling HS wake interrupt only for active ports as passed
by board file.

Bug 1268244

Change-Id: I8c5120d290762084c7fd02f60d415a7b19d52bdf
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-on: http://git-master/r/229992
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Ashutosh Jha <ajha@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/usb/host/xhci-tegra.c

index 7320e5d..282ee3e 100644 (file)
@@ -824,24 +824,33 @@ tegra_xhci_hs_wake_on_interrupts(struct tegra_xhci_hcd *tegra, bool enable)
        u32 elpg_program0;
 
        elpg_program0 = readl(tegra->padctl_base + ELPG_PROGRAM_0);
-       elpg_program0 |= (USB2_PORT0_WAKEUP_EVENT | USB2_PORT1_WAKEUP_EVENT |
-                       USB2_HSIC_PORT0_WAKEUP_EVENT |
-                       USB2_HSIC_PORT1_WAKEUP_EVENT);
+       elpg_program0 |= (USB2_PORT0_WAKEUP_EVENT | USB2_PORT1_WAKEUP_EVENT
+                       | USB2_HSIC_PORT0_WAKEUP_EVENT
+                       | USB2_HSIC_PORT1_WAKEUP_EVENT);
        writel(elpg_program0, tegra->padctl_base + ELPG_PROGRAM_0);
 
        /* Enable the wake interrupts */
        elpg_program0 = readl(tegra->padctl_base + ELPG_PROGRAM_0);
-       if (enable)
+       if (enable) {
                /* enable interrupts */
-               elpg_program0 |= (USB2_PORT0_WAKE_INTERRUPT_ENABLE |
-                               USB2_PORT1_WAKE_INTERRUPT_ENABLE |
-                               USB2_HSIC_PORT0_WAKE_INTERRUPT_ENABLE |
-                               USB2_HSIC_PORT1_WAKE_INTERRUPT_ENABLE);
-       else
-               elpg_program0 &= ~(USB2_PORT0_WAKE_INTERRUPT_ENABLE |
-                               USB2_PORT1_WAKE_INTERRUPT_ENABLE |
-                               USB2_HSIC_PORT0_WAKE_INTERRUPT_ENABLE |
-                               USB2_HSIC_PORT1_WAKE_INTERRUPT_ENABLE);
+               if (tegra->bdata->portmap & TEGRA_XUSB_USB2_P0)
+                       elpg_program0 |= USB2_PORT0_WAKE_INTERRUPT_ENABLE;
+               if (tegra->bdata->portmap & TEGRA_XUSB_USB2_P1)
+                       elpg_program0 |= USB2_PORT1_WAKE_INTERRUPT_ENABLE;
+               if (tegra->bdata->portmap & TEGRA_XUSB_HSIC_P0)
+                       elpg_program0 |= USB2_HSIC_PORT0_WAKE_INTERRUPT_ENABLE;
+               if (tegra->bdata->portmap & TEGRA_XUSB_HSIC_P1)
+                       elpg_program0 |= USB2_HSIC_PORT1_WAKE_INTERRUPT_ENABLE;
+       } else {
+               if (tegra->bdata->portmap & TEGRA_XUSB_USB2_P0)
+                       elpg_program0 &= ~USB2_PORT0_WAKE_INTERRUPT_ENABLE;
+               if (tegra->bdata->portmap & TEGRA_XUSB_USB2_P1)
+                       elpg_program0 &= ~USB2_PORT1_WAKE_INTERRUPT_ENABLE;
+               if (tegra->bdata->portmap & TEGRA_XUSB_HSIC_P0)
+                       elpg_program0 &= ~USB2_HSIC_PORT0_WAKE_INTERRUPT_ENABLE;
+               if (tegra->bdata->portmap & TEGRA_XUSB_HSIC_P1)
+                       elpg_program0 &= ~USB2_HSIC_PORT1_WAKE_INTERRUPT_ENABLE;
+       }
        writel(elpg_program0, tegra->padctl_base + ELPG_PROGRAM_0);
 }