Commit | Line | Data |
---|---|---|
7d35b8d0 SS |
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> | |
247c445c | 20 | #include <linux/io.h> |
7d35b8d0 SS |
21 | |
22 | #include <asm/cacheflush.h> | |
732231a7 | 23 | #include "omap-wakeupgen.h" |
4e65331c TL |
24 | |
25 | #include "common.h" | |
7d35b8d0 | 26 | |
b5b4f288 SS |
27 | #include "powerdomain.h" |
28 | ||
7d35b8d0 SS |
29 | /* |
30 | * platform-specific code to shutdown a CPU | |
31 | * Called with IRQs disabled | |
32 | */ | |
06915321 | 33 | void __ref omap4_cpu_die(unsigned int cpu) |
7d35b8d0 | 34 | { |
247c445c SS |
35 | unsigned int boot_cpu = 0; |
36 | void __iomem *base = omap_get_wakeupgen_base(); | |
b5b4f288 | 37 | |
7d35b8d0 SS |
38 | flush_cache_all(); |
39 | dsb(); | |
40 | ||
41 | /* | |
42 | * we're ready for shutdown now, so do it | |
43 | */ | |
247c445c SS |
44 | if (omap_secure_apis_support()) { |
45 | if (omap_modify_auxcoreboot0(0x0, 0x200) != 0x0) | |
46 | pr_err("Secure clear status failed\n"); | |
47 | } else { | |
48 | __raw_writel(0, base + OMAP_AUX_CORE_BOOT_0); | |
49 | } | |
50 | ||
7d35b8d0 SS |
51 | |
52 | for (;;) { | |
53 | /* | |
b5b4f288 | 54 | * Enter into low power state |
7d35b8d0 | 55 | */ |
b5b4f288 | 56 | omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF); |
247c445c SS |
57 | |
58 | if (omap_secure_apis_support()) | |
59 | boot_cpu = omap_read_auxcoreboot0(); | |
60 | else | |
61 | boot_cpu = | |
62 | __raw_readl(base + OMAP_AUX_CORE_BOOT_0) >> 5; | |
63 | ||
64 | if (boot_cpu == smp_processor_id()) { | |
7d35b8d0 SS |
65 | /* |
66 | * OK, proper wakeup, we're done | |
67 | */ | |
68 | break; | |
69 | } | |
70 | pr_debug("CPU%u: spurious wakeup call\n", cpu); | |
71 | } | |
72 | } |