MLK-12761 ARM: imx: add mu as wakeup source for i.mx7d
authorAnson Huang <Anson.Huang@nxp.com>
Thu, 5 May 2016 10:21:10 +0000 (18:21 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:51:55 +0000 (14:51 -0500)
When A7 platform is in low power mode while M4 is NOT,
M4 should be able to send message to wake up A7, so
MU must be always as wake up source.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
arch/arm/mach-imx/common.h
arch/arm/mach-imx/gpcv2.c
arch/arm/mach-imx/mu.c

index 305eeab..a76f8c3 100644 (file)
@@ -133,9 +133,11 @@ int imx_gpc_mf_power_on(unsigned int irq, unsigned int on);
 #ifdef CONFIG_HAVE_IMX_GPCV2
 int imx_gpcv2_mf_power_on(unsigned int irq, unsigned int on);
 void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn);
+void imx_gpcv2_add_m4_wake_up_irq(u32 hwirq, bool enable);
 #else
 static inline int imx_gpcv2_mf_power_on(unsigned int irq, unsigned int on) { return 0; }
 static inline void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn) {}
+static void imx_gpcv2_add_m4_wake_up_irq(u32 hwirq, bool enable) {}
 #endif
 void __init imx_gpcv2_check_dt(void);
 void imx_gpcv2_set_lpm_mode(enum mxc_cpu_pwr_mode mode);
index 39bfbd4..c9fc9a8 100644 (file)
@@ -117,6 +117,23 @@ static u32 gpcv2_mf_request_on[IMR_NUM];
 static DEFINE_SPINLOCK(gpcv2_lock);
 static struct notifier_block nb_mipi, nb_pcie;
 
+void imx_gpcv2_add_m4_wake_up_irq(u32 hwirq, bool enable)
+{
+       unsigned int idx = hwirq / 32;
+       unsigned long flags;
+       u32 mask;
+
+       /* Sanity check for SPI irq */
+       if (hwirq < 32)
+               return;
+
+       mask = 1 << hwirq % 32;
+       spin_lock_irqsave(&gpcv2_lock, flags);
+       gpcv2_wake_irqs[idx] = enable ? gpcv2_wake_irqs[idx] | mask :
+               gpcv2_wake_irqs[idx] & ~mask;
+       spin_unlock_irqrestore(&gpcv2_lock, flags);
+}
+
 static int imx_gpcv2_irq_set_wake(struct irq_data *d, unsigned int on)
 {
        unsigned int idx = d->hwirq / 32;
index 2a482be..c992e58 100644 (file)
@@ -388,6 +388,9 @@ static int imx_mu_probe(struct platform_device *pdev)
                /* enable the bit26(RIE1) of MU_ACR */
                writel_relaxed(readl_relaxed(mu_base + MU_ACR) |
                        BIT(26) | BIT(27), mu_base + MU_ACR);
+               /* MU always as a wakeup source for low power mode */
+               imx_gpcv2_add_m4_wake_up_irq(irq_to_desc(irq)->irq_data.hwirq,
+                       true);
        } else {
                INIT_DELAYED_WORK(&mu_work, mu_work_handler);