Sundar Iyer | 9d704c0 | 2010-09-15 10:45:51 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) STMicroelectronics 2009 |
| 3 | * Copyright (C) ST-Ericsson SA 2010 |
| 4 | * |
| 5 | * License Terms: GNU General Public License v2 |
| 6 | * Based on ARM realview platform |
| 7 | * |
| 8 | * Author: Sundar Iyer <sundar.iyer@stericsson.com> |
| 9 | * |
| 10 | */ |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/errno.h> |
| 13 | #include <linux/smp.h> |
Sundar Iyer | 9d704c0 | 2010-09-15 10:45:51 +0100 | [diff] [blame] | 14 | |
| 15 | #include <asm/cacheflush.h> |
Will Deacon | eb50439 | 2012-01-20 12:01:12 +0100 | [diff] [blame] | 16 | #include <asm/smp_plat.h> |
Sundar Iyer | 9d704c0 | 2010-09-15 10:45:51 +0100 | [diff] [blame] | 17 | |
Marc Zyngier | 5ac21a9 | 2011-09-08 13:15:22 +0100 | [diff] [blame^] | 18 | #include <mach/setup.h> |
| 19 | |
Sundar Iyer | 9d704c0 | 2010-09-15 10:45:51 +0100 | [diff] [blame] | 20 | extern volatile int pen_release; |
| 21 | |
Marc Zyngier | 5ac21a9 | 2011-09-08 13:15:22 +0100 | [diff] [blame^] | 22 | /* |
| 23 | * platform-specific code to shutdown a CPU |
| 24 | * |
| 25 | * Called with IRQs disabled |
| 26 | */ |
| 27 | void __ref ux500_cpu_die(unsigned int cpu) |
Sundar Iyer | 9d704c0 | 2010-09-15 10:45:51 +0100 | [diff] [blame] | 28 | { |
| 29 | flush_cache_all(); |
| 30 | |
Marc Zyngier | 5ac21a9 | 2011-09-08 13:15:22 +0100 | [diff] [blame^] | 31 | /* directly enter low power state, skipping secure registers */ |
Sundar Iyer | 9d704c0 | 2010-09-15 10:45:51 +0100 | [diff] [blame] | 32 | for (;;) { |
| 33 | __asm__ __volatile__("dsb\n\t" "wfi\n\t" |
| 34 | : : : "memory"); |
Will Deacon | 2876348 | 2011-08-09 12:21:36 +0100 | [diff] [blame] | 35 | if (pen_release == cpu_logical_map(cpu)) { |
Sundar Iyer | 9d704c0 | 2010-09-15 10:45:51 +0100 | [diff] [blame] | 36 | /* |
| 37 | * OK, proper wakeup, we're done |
| 38 | */ |
| 39 | break; |
| 40 | } |
| 41 | } |
| 42 | } |