]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
MLK-10174-1 arm: imx: gpc: export an interface to keep mega fast power
authorLi Jun <jun.li@freescale.com>
Thu, 29 Jan 2015 02:26:52 +0000 (10:26 +0800)
committerLi Jun <jun.li@freescale.com>
Thu, 29 Jan 2015 04:47:42 +0000 (12:47 +0800)
Add an interface for GPC used by drivers to keep mega fast mix domain
power.

Signed-off-by: Li Jun <jun.li@freescale.com>
arch/arm/mach-imx/gpc.c
include/linux/imx_gpc.h [new file with mode: 0644]

index f089ec2e53826fd9d2d36cc7de1f641d40965670..0f31e86295a373fd1c6f7a0876244677b0aa9f97 100644 (file)
@@ -71,6 +71,7 @@ static void __iomem *gpc_base;
 static u32 gpc_mf_irqs[IMR_NUM];
 static u32 gpc_wake_irqs[IMR_NUM];
 static u32 gpc_saved_imrs[IMR_NUM];
+static u32 gpc_mf_request_on[IMR_NUM];
 static u32 bypass;
 static DEFINE_SPINLOCK(gpc_lock);
 static struct notifier_block nb_pcie;
@@ -145,7 +146,8 @@ static void imx_gpc_mf_mix_off(void)
        int i;
 
        for (i = 0; i < IMR_NUM; i++)
-               if ((gpc_wake_irqs[i] & gpc_mf_irqs[i]) != 0)
+               if (((gpc_wake_irqs[i] | gpc_mf_request_on[i]) &
+                                               gpc_mf_irqs[i]) != 0)
                        return;
 
        pr_info("Turn off M/F mix!\n");
@@ -280,6 +282,22 @@ static int imx_pcie_regulator_notify(struct notifier_block *nb,
        return NOTIFY_OK;
 }
 
+int imx_gpc_mf_request_on(unsigned int irq, unsigned int on)
+{
+       unsigned int idx = irq / 32 - 1;
+       unsigned long flags;
+       u32 mask;
+
+       mask = 1 << (irq % 32);
+       spin_lock_irqsave(&gpc_lock, flags);
+       gpc_mf_request_on[idx] = on ? gpc_mf_request_on[idx] | mask :
+                                 gpc_mf_request_on[idx] & ~mask;
+       spin_unlock_irqrestore(&gpc_lock, flags);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(imx_gpc_mf_request_on);
+
 void __init imx_gpc_init(void)
 {
        struct device_node *np;
diff --git a/include/linux/imx_gpc.h b/include/linux/imx_gpc.h
new file mode 100644 (file)
index 0000000..2cffa4b
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2015 Freescale Semiconductor, Inc.
+ */
+
+/*
+ * The code contained herein is licensed under the GNU Lesser General
+ * Public License.  You may obtain a copy of the GNU Lesser General
+ * Public License Version 2.1 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/lgpl-license.html
+ * http://www.gnu.org/copyleft/lgpl.html
+ */
+
+/*
+ * @file linux/imx_gpc.h
+ *
+ * @brief Global header file for imx GPC
+ *
+ * @ingroup GPC
+ */
+#ifndef __LINUX_IMX_GPC_H__
+#define __LINUX_IMX_GPC_H__
+
+int imx_gpc_mf_request_on(unsigned int irq, unsigned int on);
+#endif /* __LINUX_IMX_GPC_H__ */