]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/mfd/db8500-prcmu.c
ARM: ux500: move PM-related PRCMU functions to machine
[karo-tx-linux.git] / drivers / mfd / db8500-prcmu.c
index 75a60c4721ffa196092038242d4d4637f1709d31..16e5696024a5258f35edf69a1d596944512ace27 100644 (file)
@@ -26,7 +26,6 @@
 #include <linux/fs.h>
 #include <linux/platform_device.h>
 #include <linux/uaccess.h>
-#include <linux/irqchip/arm-gic.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/dbx500-prcmu.h>
 #include <linux/mfd/abx500/ab8500.h>
@@ -794,119 +793,6 @@ u8 db8500_prcmu_get_power_state_result(void)
        return readb(tcdm_base + PRCM_ACK_MB0_AP_PWRSTTR_STATUS);
 }
 
-/* This function decouple the gic from the prcmu */
-int db8500_prcmu_gic_decouple(void)
-{
-       u32 val = readl(PRCM_A9_MASK_REQ);
-
-       /* Set bit 0 register value to 1 */
-       writel(val | PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ,
-              PRCM_A9_MASK_REQ);
-
-       /* Make sure the register is updated */
-       readl(PRCM_A9_MASK_REQ);
-
-       /* Wait a few cycles for the gic mask completion */
-       udelay(1);
-
-       return 0;
-}
-
-/* This function recouple the gic with the prcmu */
-int db8500_prcmu_gic_recouple(void)
-{
-       u32 val = readl(PRCM_A9_MASK_REQ);
-
-       /* Set bit 0 register value to 0 */
-       writel(val & ~PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ, PRCM_A9_MASK_REQ);
-
-       return 0;
-}
-
-#define PRCMU_GIC_NUMBER_REGS 5
-
-/*
- * This function checks if there are pending irq on the gic. It only
- * makes sense if the gic has been decoupled before with the
- * db8500_prcmu_gic_decouple function. Disabling an interrupt only
- * disables the forwarding of the interrupt to any CPU interface. It
- * does not prevent the interrupt from changing state, for example
- * becoming pending, or active and pending if it is already
- * active. Hence, we have to check the interrupt is pending *and* is
- * active.
- */
-bool db8500_prcmu_gic_pending_irq(void)
-{
-       u32 pr; /* Pending register */
-       u32 er; /* Enable register */
-       void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE);
-       int i;
-
-        /* 5 registers. STI & PPI not skipped */
-       for (i = 0; i < PRCMU_GIC_NUMBER_REGS; i++) {
-
-               pr = readl_relaxed(dist_base + GIC_DIST_PENDING_SET + i * 4);
-               er = readl_relaxed(dist_base + GIC_DIST_ENABLE_SET + i * 4);
-
-               if (pr & er)
-                       return true; /* There is a pending interrupt */
-       }
-
-       return false;
-}
-
-/*
- * This function checks if there are pending interrupt on the
- * prcmu which has been delegated to monitor the irqs with the
- * db8500_prcmu_copy_gic_settings function.
- */
-bool db8500_prcmu_pending_irq(void)
-{
-       u32 it, im;
-       int i;
-
-       for (i = 0; i < PRCMU_GIC_NUMBER_REGS - 1; i++) {
-               it = readl(PRCM_ARMITVAL31TO0 + i * 4);
-               im = readl(PRCM_ARMITMSK31TO0 + i * 4);
-               if (it & im)
-                       return true; /* There is a pending interrupt */
-       }
-
-       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.
- */
-int db8500_prcmu_copy_gic_settings(void)
-{
-       u32 er; /* Enable register */
-       void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE);
-       int i;
-
-        /* We skip the STI and PPI */
-       for (i = 0; i < PRCMU_GIC_NUMBER_REGS - 1; i++) {
-               er = readl_relaxed(dist_base +
-                                  GIC_DIST_ENABLE_SET + (i + 1) * 4);
-               writel(er, PRCM_ARMITMSK31TO0 + i * 4);
-       }
-
-       return 0;
-}
-
 /* This function should only be called while mb0_transfer.lock is held. */
 static void config_wakeups(void)
 {