Merge branch 'etnaviv/fixes' of https://git.pengutronix.de/git/lst/linux into drm...
[linux-2.6-block.git] / arch / arm / mach-tegra / hotplug.c
CommitLineData
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
5c753e04 20#include "common.h"
59b0f682 21#include "sleep.h"
1cea7326 22
59b0f682 23static void (*tegra_hotplug_shutdown)(void);
1cea7326 24
b8119431
JL
25int tegra_cpu_kill(unsigned cpu)
26{
27 cpu = cpu_logical_map(cpu);
28
29 /* Clock gate the CPU */
30 tegra_wait_cpu_in_reset(cpu);
31 tegra_disable_cpu_clock(cpu);
32
33 return 1;
34}
35
1cea7326
CC
36/*
37 * platform-specific code to shutdown a CPU
38 *
39 * Called with IRQs disabled
40 */
b96fc2f3 41void tegra_cpu_die(unsigned int cpu)
1cea7326 42{
05ccf196
TR
43 if (!tegra_hotplug_shutdown) {
44 WARN(1, "hotplug is not yet initialized\n");
45 return;
46 }
47
57886616 48 /* Clean L1 data cache */
ac2527bf 49 tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
1cea7326 50
59b0f682
JL
51 /* Shut down the current CPU. */
52 tegra_hotplug_shutdown();
53
59b0f682
JL
54 /* Should never return here. */
55 BUG();
1cea7326
CC
56}
57
05ccf196 58static int __init tegra_hotplug_init(void)
453689e4 59{
7469688e 60 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
05ccf196
TR
61 return 0;
62
63 if (!soc_is_tegra())
64 return 0;
453689e4 65
304664ea 66 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
7469688e 67 tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
304664ea 68 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
7469688e 69 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
304664ea 70 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
33d5c019 71 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
304664ea 72 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
9997e626 73 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
05ccf196
TR
74
75 return 0;
59b0f682 76}
05ccf196 77pure_initcall(tegra_hotplug_init);