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 | 247c445 | 2012-05-09 20:38:35 +0530 | [diff] [blame] | 20 | #include <linux/io.h> |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 21 | |
Tony Lindgren | 732231a | 2012-09-20 11:41:16 -0700 | [diff] [blame] | 22 | #include "omap-wakeupgen.h" |
Tony Lindgren | 4e65331 | 2011-11-10 22:45:17 +0100 | [diff] [blame] | 23 | #include "common.h" |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 24 | #include "powerdomain.h" |
| 25 | |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 26 | /* |
| 27 | * platform-specific code to shutdown a CPU |
| 28 | * Called with IRQs disabled |
| 29 | */ |
Marc Zyngier | 0691532 | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 30 | void __ref omap4_cpu_die(unsigned int cpu) |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 31 | { |
Santosh Shilimkar | 247c445 | 2012-05-09 20:38:35 +0530 | [diff] [blame] | 32 | unsigned int boot_cpu = 0; |
| 33 | void __iomem *base = omap_get_wakeupgen_base(); |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 34 | |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 35 | /* |
| 36 | * we're ready for shutdown now, so do it |
| 37 | */ |
Santosh Shilimkar | 247c445 | 2012-05-09 20:38:35 +0530 | [diff] [blame] | 38 | if (omap_secure_apis_support()) { |
| 39 | if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0) |
| 40 | pr_err("Secure clear status failed\n"); |
| 41 | } else { |
Victor Kamensky | edfaf05 | 2014-04-15 20:37:46 +0300 | [diff] [blame] | 42 | writel_relaxed(0, base + OMAP_AUX_CORE_BOOT_0); |
Santosh Shilimkar | 247c445 | 2012-05-09 20:38:35 +0530 | [diff] [blame] | 43 | } |
| 44 | |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 45 | |
| 46 | for (;;) { |
| 47 | /* |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 48 | * Enter into low power state |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 49 | */ |
Santosh Shilimkar | b5b4f28 | 2010-06-16 22:19:48 +0530 | [diff] [blame] | 50 | omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF); |
Santosh Shilimkar | 247c445 | 2012-05-09 20:38:35 +0530 | [diff] [blame] | 51 | |
| 52 | if (omap_secure_apis_support()) |
| 53 | boot_cpu = omap_read_auxcoreboot0(); |
| 54 | else |
| 55 | boot_cpu = |
Victor Kamensky | edfaf05 | 2014-04-15 20:37:46 +0300 | [diff] [blame] | 56 | readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5; |
Santosh Shilimkar | 247c445 | 2012-05-09 20:38:35 +0530 | [diff] [blame] | 57 | |
| 58 | if (boot_cpu == smp_processor_id()) { |
Santosh Shilimkar | 7d35b8d | 2010-08-02 13:18:19 +0300 | [diff] [blame] | 59 | /* |
| 60 | * OK, proper wakeup, we're done |
| 61 | */ |
| 62 | break; |
| 63 | } |
| 64 | pr_debug("CPU%u: spurious wakeup call\n", cpu); |
| 65 | } |
| 66 | } |