Commit | Line | Data |
---|---|---|
1cea7326 | 1 | /* |
1cea7326 CC |
2 | * Copyright (C) 2002 ARM Ltd. |
3 | * All Rights Reserved | |
7469688e | 4 | * Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved. |
1cea7326 CC |
5 | * |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 as | |
8 | * published by the Free Software Foundation. | |
9 | */ | |
a0524acc TR |
10 | |
11 | #include <linux/clk/tegra.h> | |
1cea7326 | 12 | #include <linux/kernel.h> |
1cea7326 | 13 | #include <linux/smp.h> |
1cea7326 | 14 | |
05ccf196 | 15 | #include <soc/tegra/common.h> |
304664ea TR |
16 | #include <soc/tegra/fuse.h> |
17 | ||
59b0f682 | 18 | #include <asm/smp_plat.h> |
1cea7326 | 19 | |
59b0f682 | 20 | #include "sleep.h" |
1cea7326 | 21 | |
59b0f682 | 22 | static void (*tegra_hotplug_shutdown)(void); |
1cea7326 | 23 | |
b8119431 JL |
24 | int tegra_cpu_kill(unsigned cpu) |
25 | { | |
26 | cpu = cpu_logical_map(cpu); | |
27 | ||
28 | /* Clock gate the CPU */ | |
29 | tegra_wait_cpu_in_reset(cpu); | |
30 | tegra_disable_cpu_clock(cpu); | |
31 | ||
32 | return 1; | |
33 | } | |
34 | ||
1cea7326 CC |
35 | /* |
36 | * platform-specific code to shutdown a CPU | |
37 | * | |
38 | * Called with IRQs disabled | |
39 | */ | |
b96fc2f3 | 40 | void tegra_cpu_die(unsigned int cpu) |
1cea7326 | 41 | { |
05ccf196 TR |
42 | if (!tegra_hotplug_shutdown) { |
43 | WARN(1, "hotplug is not yet initialized\n"); | |
44 | return; | |
45 | } | |
46 | ||
57886616 | 47 | /* Clean L1 data cache */ |
ac2527bf | 48 | tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS); |
1cea7326 | 49 | |
59b0f682 JL |
50 | /* Shut down the current CPU. */ |
51 | tegra_hotplug_shutdown(); | |
52 | ||
59b0f682 JL |
53 | /* Should never return here. */ |
54 | BUG(); | |
1cea7326 CC |
55 | } |
56 | ||
05ccf196 | 57 | static int __init tegra_hotplug_init(void) |
453689e4 | 58 | { |
7469688e | 59 | if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) |
05ccf196 TR |
60 | return 0; |
61 | ||
62 | if (!soc_is_tegra()) | |
63 | return 0; | |
453689e4 | 64 | |
304664ea | 65 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20) |
7469688e | 66 | tegra_hotplug_shutdown = tegra20_hotplug_shutdown; |
304664ea | 67 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30) |
7469688e | 68 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; |
304664ea | 69 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114) |
33d5c019 | 70 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; |
304664ea | 71 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124) |
9997e626 | 72 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; |
05ccf196 TR |
73 | |
74 | return 0; | |
59b0f682 | 75 | } |
05ccf196 | 76 | pure_initcall(tegra_hotplug_init); |