spi-topcliff-pch: supports a spi mode setup and bit order setup by IO control
[zen-stable.git] / arch / arm / mach-shmobile / hotplug.c
blob828d22f3af5750b022f898bdb44aa79d56577e4d
1 /*
2 * SMP support for R-Mobile / SH-Mobile
4 * Copyright (C) 2010 Magnus Damm
6 * Based on realview, Copyright (C) 2002 ARM Ltd, All Rights Reserved
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/errno.h>
14 #include <linux/smp.h>
15 #include <linux/cpumask.h>
16 #include <linux/delay.h>
17 #include <mach/common.h>
18 #include <asm/cacheflush.h>
20 static cpumask_t dead_cpus;
22 int platform_cpu_kill(unsigned int cpu)
24 int k;
26 /* this function is running on another CPU than the offline target,
27 * here we need wait for shutdown code in platform_cpu_die() to
28 * finish before asking SoC-specific code to power off the CPU core.
30 for (k = 0; k < 1000; k++) {
31 if (cpumask_test_cpu(cpu, &dead_cpus))
32 return shmobile_platform_cpu_kill(cpu);
34 mdelay(1);
37 return 0;
40 void platform_cpu_die(unsigned int cpu)
42 /* hardware shutdown code running on the CPU that is being offlined */
43 flush_cache_all();
44 dsb();
46 /* notify platform_cpu_kill() that hardware shutdown is finished */
47 cpumask_set_cpu(cpu, &dead_cpus);
49 /* wait for SoC code in platform_cpu_kill() to shut off CPU core
50 * power. CPU bring up starts from the reset vector.
52 while (1) {
54 * here's the WFI
56 asm(".word 0xe320f003\n"
59 : "memory", "cc");
63 int platform_cpu_disable(unsigned int cpu)
65 cpumask_clear_cpu(cpu, &dead_cpus);
67 * we don't allow CPU 0 to be shutdown (it is still too special
68 * e.g. clock tick interrupts)
70 return cpu == 0 ? -EPERM : 0;