Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 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> |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 20 | |
| 21 | #include <asm/cacheflush.h> |
Tony Lindgren | 4e65331 | 2011-11-10 22:45:17 +0100 | [diff] [blame] | 22 | |
| 23 | #include "common.h" |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 24 | |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 25 | #include "powerdomain.h" |
| 26 | |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 27 | int platform_cpu_kill(unsigned int cpu) |
| 28 | { |
Russell King | 3c030be | 2010-11-30 11:07:35 +0000 | [diff] [blame] | 29 | return 1; |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | /* |
| 33 | * platform-specific code to shutdown a CPU |
| 34 | * Called with IRQs disabled |
| 35 | */ |
Santosh Shilimkar | 82dfcbf | 2012-02-22 16:10:04 +0530 | [diff] [blame] | 36 | void __ref platform_cpu_die(unsigned int cpu) |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 37 | { |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 38 | unsigned int this_cpu; |
| 39 | |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 40 | flush_cache_all(); |
| 41 | dsb(); |
| 42 | |
| 43 | /* |
| 44 | * we're ready for shutdown now, so do it |
| 45 | */ |
| 46 | if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0) |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 47 | pr_err("Secure clear status failed\n"); |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 48 | |
| 49 | for (;;) { |
| 50 | /* |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 51 | * Enter into low power state |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 52 | */ |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 53 | omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF); |
| 54 | this_cpu = smp_processor_id(); |
| 55 | if (omap_read_auxcoreboot0() == this_cpu) { |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 56 | /* |
| 57 | * OK, proper wakeup, we're done |
| 58 | */ |
| 59 | break; |
| 60 | } |
| 61 | pr_debug("CPU%u: spurious wakeup call\n", cpu); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | int platform_cpu_disable(unsigned int cpu) |
| 66 | { |
| 67 | /* |
| 68 | * we don't allow CPU 0 to be shutdown (it is still too special |
| 69 | * e.g. clock tick interrupts) |
| 70 | */ |
| 71 | return cpu == 0 ? -EPERM : 0; |
| 72 | } |