Commit | Line | Data |
---|---|---|
1cea7326 | 1 | /* |
1cea7326 CC |
2 | * |
3 | * Copyright (C) 2002 ARM Ltd. | |
4 | * All Rights Reserved | |
59b0f682 | 5 | * Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved. |
1cea7326 CC |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License version 2 as | |
9 | * published by the Free Software Foundation. | |
10 | */ | |
11 | #include <linux/kernel.h> | |
1cea7326 | 12 | #include <linux/smp.h> |
1cea7326 CC |
13 | |
14 | #include <asm/cacheflush.h> | |
59b0f682 | 15 | #include <asm/smp_plat.h> |
1cea7326 | 16 | |
59b0f682 JL |
17 | #include "sleep.h" |
18 | #include "tegra_cpu_car.h" | |
1cea7326 | 19 | |
59b0f682 | 20 | static void (*tegra_hotplug_shutdown)(void); |
1cea7326 | 21 | |
1cea7326 CC |
22 | /* |
23 | * platform-specific code to shutdown a CPU | |
24 | * | |
25 | * Called with IRQs disabled | |
26 | */ | |
a1725732 | 27 | void __ref tegra_cpu_die(unsigned int cpu) |
1cea7326 | 28 | { |
59b0f682 | 29 | cpu = cpu_logical_map(cpu); |
d4450261 | 30 | |
59b0f682 JL |
31 | /* Flush the L1 data cache. */ |
32 | flush_cache_all(); | |
1cea7326 | 33 | |
59b0f682 JL |
34 | /* Shut down the current CPU. */ |
35 | tegra_hotplug_shutdown(); | |
36 | ||
37 | /* Clock gate the CPU */ | |
38 | tegra_wait_cpu_in_reset(cpu); | |
39 | tegra_disable_cpu_clock(cpu); | |
d4450261 | 40 | |
59b0f682 JL |
41 | /* Should never return here. */ |
42 | BUG(); | |
1cea7326 CC |
43 | } |
44 | ||
25468fe8 | 45 | int tegra_cpu_disable(unsigned int cpu) |
1cea7326 CC |
46 | { |
47 | /* | |
48 | * we don't allow CPU 0 to be shutdown (it is still too special | |
49 | * e.g. clock tick interrupts) | |
50 | */ | |
51 | return cpu == 0 ? -EPERM : 0; | |
52 | } | |
59b0f682 | 53 | |
453689e4 JL |
54 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC |
55 | extern void tegra20_hotplug_shutdown(void); | |
56 | void __init tegra20_hotplug_init(void) | |
57 | { | |
58 | tegra_hotplug_shutdown = tegra20_hotplug_shutdown; | |
59 | } | |
60 | #endif | |
61 | ||
59b0f682 JL |
62 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC |
63 | extern void tegra30_hotplug_shutdown(void); | |
64 | void __init tegra30_hotplug_init(void) | |
65 | { | |
66 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; | |
67 | } | |
68 | #endif |