rk3188: fix cpu up down bug
author黄涛 <huangtao@rock-chips.com>
Tue, 26 Feb 2013 07:06:12 +0000 (15:06 +0800)
committer黄涛 <huangtao@rock-chips.com>
Tue, 26 Feb 2013 07:06:58 +0000 (15:06 +0800)
arch/arm/mach-rk30/hotplug.c

index 355d0382a3c799fbb3d9ac0c5956566996dbff7a..5aa38e38dbfb2a8efbc9a19ffa70810457e4a667 100644 (file)
@@ -33,6 +33,7 @@ int platform_cpu_kill(unsigned int cpu)
         */
        for (k = 0; k < 1000; k++) {
                if (cpumask_test_cpu(cpu, &dead_cpus)) {
+                       mdelay(1);
                        pmu_set_power_domain(PD_A9_0 + cpu, false);
                        return 1;
                }
@@ -50,12 +51,31 @@ int platform_cpu_kill(unsigned int cpu)
  */
 void platform_cpu_die(unsigned int cpu)
 {
+       unsigned int v;
+
        /* hardware shutdown code running on the CPU that is being offlined */
        flush_cache_all();
        dsb();
 
        /* notify platform_cpu_kill() that hardware shutdown is finished */
        cpumask_set_cpu(cpu, &dead_cpus);
+       clean_dcache_area(&dead_cpus, sizeof(dead_cpus));
+
+       asm volatile(
+       "       mcr     p15, 0, %1, c7, c5, 0\n"
+       "       mcr     p15, 0, %1, c7, c10, 4\n"
+       /*
+        * Turn off coherency
+        */
+       "       mrc     p15, 0, %0, c1, c0, 1\n"
+       "       bic     %0, %0, %3\n"           // clear ACTLR.SMP | ACTLR.FW
+       "       mcr     p15, 0, %0, c1, c0, 1\n"
+       "       mrc     p15, 0, %0, c1, c0, 0\n"
+       "       bic     %0, %0, %2\n"
+       "       mcr     p15, 0, %0, c1, c0, 0\n"
+         : "=&r" (v)
+         : "r" (0), "Ir" (CR_C), "Ir" ((1 << 6) | (1 << 0))
+         : "cc");
 
        /* wait for SoC code in platform_cpu_kill() to shut off CPU core
         * power. CPU bring up starts from the reset vector.