Merge tag 'multiplatform' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[pandora-kernel.git] / arch / arm / mach-tegra / platsmp.c
index 24bfb65..81cb265 100644 (file)
@@ -31,6 +31,7 @@
 #include "fuse.h"
 #include "flowctrl.h"
 #include "reset.h"
+#include "tegra_cpu_car.h"
 
 #include "common.h"
 
@@ -40,17 +41,6 @@ static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
 
 #define EVP_CPU_RESET_VECTOR \
        (IO_ADDRESS(TEGRA_EXCEPTION_VECTORS_BASE) + 0x100)
-#define CLK_RST_CONTROLLER_CLK_CPU_CMPLX \
-       (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x4c)
-#define CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET \
-       (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x340)
-#define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR \
-       (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x344)
-#define CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR \
-       (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x34c)
-
-#define CPU_CLOCK(cpu) (0x1<<(8+cpu))
-#define CPU_RESET(cpu) (0x1111ul<<(cpu))
 
 static void __cpuinit tegra_secondary_init(unsigned int cpu)
 {
@@ -65,13 +55,8 @@ static void __cpuinit tegra_secondary_init(unsigned int cpu)
 
 static int tegra20_power_up_cpu(unsigned int cpu)
 {
-       u32 reg;
-
        /* Enable the CPU clock. */
-       reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
-       writel(reg & ~CPU_CLOCK(cpu), CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
-       barrier();
-       reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
+       tegra_enable_cpu_clock(cpu);
 
        /* Clear flow controller CSR. */
        flowctrl_write_cpu_csr(cpu, 0);
@@ -81,7 +66,6 @@ static int tegra20_power_up_cpu(unsigned int cpu)
 
 static int tegra30_power_up_cpu(unsigned int cpu)
 {
-       u32 reg;
        int ret, pwrgateid;
        unsigned long timeout;
 
@@ -105,8 +89,7 @@ static int tegra30_power_up_cpu(unsigned int cpu)
        }
 
        /* CPU partition is powered. Enable the CPU clock. */
-       writel(CPU_CLOCK(cpu), CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR);
-       reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX_CLR);
+       tegra_enable_cpu_clock(cpu);
        udelay(10);
 
        /* Remove I/O clamps. */
@@ -130,8 +113,7 @@ static int __cpuinit tegra_boot_secondary(unsigned int cpu, struct task_struct *
         * via the flow controller). This will have no effect on first boot
         * of the CPU since it should already be in reset.
         */
-       writel(CPU_RESET(cpu), CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET);
-       dmb();
+       tegra_put_cpu_in_reset(cpu);
 
        /*
         * Unhalt the CPU. If the flow controller was used to power-gate the
@@ -157,8 +139,7 @@ static int __cpuinit tegra_boot_secondary(unsigned int cpu, struct task_struct *
                goto done;
 
        /* Take the CPU out of reset. */
-       writel(CPU_RESET(cpu), CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR);
-       wmb();
+       tegra_cpu_out_of_reset(cpu);
 done:
        return status;
 }
@@ -196,5 +177,6 @@ struct smp_operations tegra_smp_ops __initdata = {
        .smp_boot_secondary     = tegra_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
        .cpu_die                = tegra_cpu_die,
+       .cpu_disable            = tegra_cpu_disable,
 #endif
 };