Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 283644
b: refs/heads/master
c: 1229835
h: refs/heads/master
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Jan 9, 2012
1 parent b15898b commit 04766fb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8b306796995609c281f6d32b3cbaa814551ad5ac
refs/heads/master: 1229835ccb6d7ea2b36230121205be95c88eca88
31 changes: 30 additions & 1 deletion trunk/arch/arm/mach-shmobile/hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,43 @@
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/smp.h>
#include <linux/cpumask.h>
#include <linux/delay.h>
#include <mach/common.h>
#include <asm/cacheflush.h>

static cpumask_t dead_cpus;

int platform_cpu_kill(unsigned int cpu)
{
return shmobile_platform_cpu_kill(cpu);
int k;

/* this function is running on another CPU than the offline target,
* here we need wait for shutdown code in platform_cpu_die() to
* finish before asking SoC-specific code to power off the CPU core.
*/
for (k = 0; k < 1000; k++) {
if (cpumask_test_cpu(cpu, &dead_cpus))
return shmobile_platform_cpu_kill(cpu);

mdelay(1);
}

return 0;
}

void platform_cpu_die(unsigned int cpu)
{
/* 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);

/* wait for SoC code in platform_cpu_kill() to shut off CPU core
* power. CPU bring up starts from the reset vector.
*/
while (1) {
/*
* here's the WFI
Expand All @@ -34,6 +62,7 @@ void platform_cpu_die(unsigned int cpu)

int platform_cpu_disable(unsigned int cpu)
{
cpumask_clear_cpu(cpu, &dead_cpus);
/*
* we don't allow CPU 0 to be shutdown (it is still too special
* e.g. clock tick interrupts)
Expand Down

0 comments on commit 04766fb

Please sign in to comment.