]> git.karo-electronics.de Git - linux-beck.git/blob - arch/arm/mach-tegra/hotplug.c
ARM: tegra: Use a function to get the chip ID
[linux-beck.git] / arch / arm / mach-tegra / hotplug.c
1 /*
2  *  Copyright (C) 2002 ARM Ltd.
3  *  All Rights Reserved
4  *  Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved.
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  */
10
11 #include <linux/clk/tegra.h>
12 #include <linux/kernel.h>
13 #include <linux/smp.h>
14
15 #include <soc/tegra/fuse.h>
16
17 #include <asm/smp_plat.h>
18
19 #include "sleep.h"
20
21 static void (*tegra_hotplug_shutdown)(void);
22
23 int tegra_cpu_kill(unsigned cpu)
24 {
25         cpu = cpu_logical_map(cpu);
26
27         /* Clock gate the CPU */
28         tegra_wait_cpu_in_reset(cpu);
29         tegra_disable_cpu_clock(cpu);
30
31         return 1;
32 }
33
34 /*
35  * platform-specific code to shutdown a CPU
36  *
37  * Called with IRQs disabled
38  */
39 void __ref tegra_cpu_die(unsigned int cpu)
40 {
41         /* Clean L1 data cache */
42         tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
43
44         /* Shut down the current CPU. */
45         tegra_hotplug_shutdown();
46
47         /* Should never return here. */
48         BUG();
49 }
50
51 void __init tegra_hotplug_init(void)
52 {
53         if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
54                 return;
55
56         if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
57                 tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
58         if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
59                 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
60         if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
61                 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
62         if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
63                 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
64 }