ARM: tegra: enable Ardbeg USB2 UHSIC PHY wakeup
Mark Kuo [Thu, 1 Aug 2013 08:52:32 +0000 (16:52 +0800)]
Icera Bruce modem is using tegra_ehci2_device on t124 Ardbeg with HSIC
phy, so enable USB2 UHSIC PHY wakeup source so that remote wakeup can
work in LP0.

Also add a generic function tegra_set_wake_source() in wakeups-t12x.c,
which can be used to modify tegra_wake_event_irq table from board files.

Bug 1333745

Change-Id: Ia58998fc71c0575d87fc65b00a7bd6e7cd49a3f7
Signed-off-by: Mark Kuo <mkuo@nvidia.com>
Reviewed-on: http://git-master/r/254199
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/board-ardbeg.c
arch/arm/mach-tegra/pm-irq.h
arch/arm/mach-tegra/wakeups-t12x.c

index 3edd80a..76a0ca0 100644 (file)
@@ -882,13 +882,20 @@ static void ardbeg_modem_init(void)
 
        switch (modem_id) {
        case TEGRA_BB_BRUCE:
-               if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB))
+               if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB)) {
+                       /* Set specific USB wake source for Ardbeg */
+                       if (board_info.board_id == BOARD_E1780)
+                               tegra_set_wake_source(42, INT_USB2);
                        platform_device_register(&icera_bruce_device);
+               }
                break;
        case TEGRA_BB_HSIC_HUB: /* HSIC hub */
                if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB)) {
                        tegra_ehci2_device.dev.platform_data =
                                &tegra_ehci2_hsic_smsc_hub_pdata;
+                       /* Set specific USB wake source for Ardbeg */
+                       if (board_info.board_id == BOARD_E1780)
+                               tegra_set_wake_source(42, INT_USB2);
                        platform_device_register(&tegra_ehci2_device);
                }
                break;
index 61af6d7..ce161cf 100644 (file)
@@ -32,6 +32,7 @@ bool tegra_pm_irq_lp0_allowed(void);
 int tegra_gpio_to_wake(int gpio);
 void tegra_irq_to_wake(int irq, int *wak_list, int *wak_size);
 int tegra_wake_to_irq(int wake);
+int tegra_set_wake_source(int wake, int wake_int);
 int tegra_disable_wake_source(int wake);
 #else
 static inline int tegra_pm_irq_set_wake_type(int wake, int flow_type)
@@ -48,6 +49,10 @@ void tegra_irq_to_wake(int irq, int *wak_list, int *wak_size)
        *wak_size = 0;
        return;
 }
+static inline int tegra_set_wake_source(int wake, int wake_int)
+{
+       return 0;
+}
 static inline int tegra_disable_wake_source(int wake)
 {
        return 0;
index 6ea83f0..36ace0c 100644 (file)
@@ -224,11 +224,19 @@ int tegra_wake_to_irq(int wake)
        return ret;
 }
 
-int tegra_disable_wake_source(int wake)
+int tegra_set_wake_source(int wake, int irq)
 {
+       if (wake < 0)
+               return -EINVAL;
+
        if (wake >= ARRAY_SIZE(tegra_wake_event_irq))
                return -EINVAL;
 
-       tegra_wake_event_irq[wake] = -EINVAL;
+       tegra_wake_event_irq[wake] = irq;
        return 0;
 }
+
+int tegra_disable_wake_source(int wake)
+{
+       return tegra_set_wake_source(wake, -EINVAL);
+}