]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
mfd : Check if the other db8500 core is in WFI
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 28 Feb 2012 21:46:09 +0000 (22:46 +0100)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 6 Mar 2012 17:46:56 +0000 (18:46 +0100)
This patch allows to check if the other core is in WFI
mode. It is the last check the idle routine has to do before
entering into the retention state.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/db8500-prcmu.c
drivers/mfd/dbx500-prcmu-regs.h
include/linux/mfd/db8500-prcmu.h
include/linux/mfd/dbx500-prcmu.h

index 4e27db841fabfa69a6e097622289a0941d21ee7b..a1b3464cdba3d872b6ff72a23099c3e6c4844c9f 100644 (file)
@@ -903,6 +903,18 @@ bool db8500_prcmu_pending_irq(void)
        return false;
 }
 
+/*
+ * This function checks if the specified cpu is in in WFI. It's usage
+ * makes sense only if the gic is decoupled with the db8500_prcmu_gic_decouple
+ * function. Of course passing smp_processor_id() to this function will
+ * always return false...
+ */
+bool db8500_prcmu_is_cpu_in_wfi(int cpu)
+{
+       return readl(PRCM_ARM_WFI_STANDBY) & cpu ? PRCM_ARM_WFI_STANDBY_WFI1 :
+                    PRCM_ARM_WFI_STANDBY_WFI0;
+}
+
 /*
  * This function copies the gic SPI settings to the prcmu in order to
  * monitor them and abort/finish the retention/off sequence or state.
index b9ab4ce626541f8b4f5a15774f8c4526938eb88c..3a0bf91d7780894a552f0f83d0cd9defb4637c63 100644 (file)
@@ -79,6 +79,8 @@
 
 /* ARM WFI Standby signal register */
 #define PRCM_ARM_WFI_STANDBY    (_PRCMU_BASE + 0x130)
+#define PRCM_ARM_WFI_STANDBY_WFI0               0x08
+#define PRCM_ARM_WFI_STANDBY_WFI1               0x10
 #define PRCM_IOCR              (_PRCMU_BASE + 0x310)
 #define PRCM_IOCR_IOFORCE                      0x1
 
index 926bdb3adc0fb093601d15500f5a9fdb8259821a..048a534fde3883218e6c220e0f8af65c76f13606 100644 (file)
@@ -585,6 +585,7 @@ int db8500_prcmu_gic_recouple(void);
 int db8500_prcmu_copy_gic_settings(void);
 bool db8500_prcmu_gic_pending_irq(void);
 bool db8500_prcmu_pending_irq(void);
+bool db8500_prcmu_is_cpu_in_wfi(int cpu);
 void db8500_prcmu_enable_wakeups(u32 wakeups);
 int db8500_prcmu_set_epod(u16 epod_id, u8 epod_state);
 int db8500_prcmu_request_clock(u8 clock, bool enable);
index 5c72c07e20e47be1e2b08bdfd8771dc19db0dd58..eaa99a02178500ba60d2521c251369b95827315a 100644 (file)
@@ -305,6 +305,14 @@ static inline bool prcmu_gic_pending_irq(void)
                return db8500_prcmu_gic_pending_irq();
 }
 
+static inline bool prcmu_is_cpu_in_wfi(int cpu)
+{
+       if (cpu_is_u5500())
+               return -EINVAL;
+       else
+               return db8500_prcmu_is_cpu_in_wfi(cpu);
+}
+
 static inline int prcmu_copy_gic_settings(void)
 {
        if (cpu_is_u5500())