From: 黄涛 Date: Tue, 26 Feb 2013 07:06:12 +0000 (+0800) Subject: rk3188: fix cpu up down bug X-Git-Tag: firefly_0821_release~7516 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cdac9860690d06a9c8368d5077bce40f6d507c94;p=firefly-linux-kernel-4.4.55.git rk3188: fix cpu up down bug --- diff --git a/arch/arm/mach-rk30/hotplug.c b/arch/arm/mach-rk30/hotplug.c index 355d0382a3c7..5aa38e38dbfb 100644 --- a/arch/arm/mach-rk30/hotplug.c +++ b/arch/arm/mach-rk30/hotplug.c @@ -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.