diff options
| author | Santosh Shilimkar <santosh.shilimkar@ti.com> | 2010-08-02 06:18:19 -0400 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2010-08-02 06:18:19 -0400 |
| commit | 7d35b8d09fb0cb0a89c8c265a5bfb52c2867b1d5 (patch) | |
| tree | 1086c9e507b3565563bede1498487e30b7c3c1b3 | |
| parent | 3f9eaf0984952f69cb2d0c1b0f99b95b74742094 (diff) | |
omap4: hotplug: Add basic CPU hotplug support
This patch adds cpu hotplug support for OMAP4430. Only CPU inactive
state is supported as a low power state in the basic hot-plug support
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
| -rw-r--r-- | arch/arm/mach-omap2/Makefile | 1 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/include/mach/omap4-common.h | 7 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/omap-hotplug.c | 79 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/omap-smp.c | 3 |
4 files changed, 89 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 3cb1b510ee42..0db90ff52617 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
| @@ -22,6 +22,7 @@ obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o | |||
| 22 | # SMP support ONLY available for OMAP4 | 22 | # SMP support ONLY available for OMAP4 |
| 23 | obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o | 23 | obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o |
| 24 | obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o | 24 | obj-$(CONFIG_LOCAL_TIMERS) += timer-mpu.o |
| 25 | obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o | ||
| 25 | obj-$(CONFIG_ARCH_OMAP4) += omap44xx-smc.o omap4-common.o | 26 | obj-$(CONFIG_ARCH_OMAP4) += omap44xx-smc.o omap4-common.o |
| 26 | 27 | ||
| 27 | AFLAGS_omap44xx-smc.o :=-Wa,-march=armv7-a | 28 | AFLAGS_omap44xx-smc.o :=-Wa,-march=armv7-a |
diff --git a/arch/arm/mach-omap2/include/mach/omap4-common.h b/arch/arm/mach-omap2/include/mach/omap4-common.h index 423af3a6dd31..2744dfee1ff4 100644 --- a/arch/arm/mach-omap2/include/mach/omap4-common.h +++ b/arch/arm/mach-omap2/include/mach/omap4-common.h | |||
| @@ -13,6 +13,13 @@ | |||
| 13 | #ifndef OMAP_ARCH_OMAP4_COMMON_H | 13 | #ifndef OMAP_ARCH_OMAP4_COMMON_H |
| 14 | #define OMAP_ARCH_OMAP4_COMMON_H | 14 | #define OMAP_ARCH_OMAP4_COMMON_H |
| 15 | 15 | ||
| 16 | /* | ||
| 17 | * wfi used in low power code. Directly opcode is used instead | ||
| 18 | * of instruction to avoid mulit-omap build break | ||
| 19 | */ | ||
| 20 | #define do_wfi() \ | ||
| 21 | __asm__ __volatile__ (".word 0xe320f003" : : : "memory") | ||
| 22 | |||
| 16 | #ifdef CONFIG_CACHE_L2X0 | 23 | #ifdef CONFIG_CACHE_L2X0 |
| 17 | extern void __iomem *l2cache_base; | 24 | extern void __iomem *l2cache_base; |
| 18 | #endif | 25 | #endif |
diff --git a/arch/arm/mach-omap2/omap-hotplug.c b/arch/arm/mach-omap2/omap-hotplug.c new file mode 100644 index 000000000000..6cee456ca542 --- /dev/null +++ b/arch/arm/mach-omap2/omap-hotplug.c | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | /* | ||
| 2 | * OMAP4 SMP cpu-hotplug support | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010 Texas Instruments, Inc. | ||
| 5 | * Author: | ||
| 6 | * Santosh Shilimkar <santosh.shilimkar@ti.com> | ||
| 7 | * | ||
| 8 | * Platform file needed for the OMAP4 SMP. This file is based on arm | ||
| 9 | * realview smp platform. | ||
| 10 | * Copyright (c) 2002 ARM Limited. | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License version 2 as | ||
| 14 | * published by the Free Software Foundation. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include <linux/kernel.h> | ||
| 18 | #include <linux/errno.h> | ||
| 19 | #include <linux/smp.h> | ||
| 20 | #include <linux/completion.h> | ||
| 21 | |||
| 22 | #include <asm/cacheflush.h> | ||
| 23 | #include <mach/omap4-common.h> | ||
| 24 | |||
| 25 | static DECLARE_COMPLETION(cpu_killed); | ||
| 26 | |||
| 27 | int platform_cpu_kill(unsigned int cpu) | ||
| 28 | { | ||
| 29 | return wait_for_completion_timeout(&cpu_killed, 5000); | ||
| 30 | } | ||
| 31 | |||
| 32 | /* | ||
| 33 | * platform-specific code to shutdown a CPU | ||
| 34 | * Called with IRQs disabled | ||
| 35 | */ | ||
| 36 | void platform_cpu_die(unsigned int cpu) | ||
| 37 | { | ||
| 38 | unsigned int this_cpu = hard_smp_processor_id(); | ||
| 39 | |||
| 40 | if (cpu != this_cpu) { | ||
| 41 | pr_crit("platform_cpu_die running on %u, should be %u\n", | ||
| 42 | this_cpu, cpu); | ||
| 43 | BUG(); | ||
| 44 | } | ||
| 45 | pr_notice("CPU%u: shutdown\n", cpu); | ||
| 46 | complete(&cpu_killed); | ||
| 47 | flush_cache_all(); | ||
| 48 | dsb(); | ||
| 49 | |||
| 50 | /* | ||
| 51 | * we're ready for shutdown now, so do it | ||
| 52 | */ | ||
| 53 | if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0) | ||
| 54 | printk(KERN_CRIT "Secure clear status failed\n"); | ||
| 55 | |||
| 56 | for (;;) { | ||
| 57 | /* | ||
| 58 | * Execute WFI | ||
| 59 | */ | ||
| 60 | do_wfi(); | ||
| 61 | |||
| 62 | if (omap_read_auxcoreboot0() == cpu) { | ||
| 63 | /* | ||
| 64 | * OK, proper wakeup, we're done | ||
| 65 | */ | ||
| 66 | break; | ||
| 67 | } | ||
| 68 | pr_debug("CPU%u: spurious wakeup call\n", cpu); | ||
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | int platform_cpu_disable(unsigned int cpu) | ||
| 73 | { | ||
| 74 | /* | ||
| 75 | * we don't allow CPU 0 to be shutdown (it is still too special | ||
| 76 | * e.g. clock tick interrupts) | ||
| 77 | */ | ||
| 78 | return cpu == 0 ? -EPERM : 0; | ||
| 79 | } | ||
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c index 1cf52313759e..af3c20c8d3f9 100644 --- a/arch/arm/mach-omap2/omap-smp.c +++ b/arch/arm/mach-omap2/omap-smp.c | |||
| @@ -73,9 +73,10 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) | |||
| 73 | * the AuxCoreBoot1 register is updated with cpu state | 73 | * the AuxCoreBoot1 register is updated with cpu state |
| 74 | * A barrier is added to ensure that write buffer is drained | 74 | * A barrier is added to ensure that write buffer is drained |
| 75 | */ | 75 | */ |
| 76 | omap_modify_auxcoreboot0(0x200, 0x0); | 76 | omap_modify_auxcoreboot0(0x200, 0xfffffdff); |
| 77 | flush_cache_all(); | 77 | flush_cache_all(); |
| 78 | smp_wmb(); | 78 | smp_wmb(); |
| 79 | smp_cross_call(cpumask_of(cpu)); | ||
| 79 | 80 | ||
| 80 | /* | 81 | /* |
| 81 | * Now the secondary core is starting up let it run its | 82 | * Now the secondary core is starting up let it run its |
