xref: /linux/arch/arm/mach-tegra/hotplug.c (revision 304664eab93f9e95a8d28fbd9702ede88bb10cc5)
11cea7326SColin Cross /*
21cea7326SColin Cross  *  Copyright (C) 2002 ARM Ltd.
31cea7326SColin Cross  *  All Rights Reserved
47469688eSHiroshi Doyu  *  Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved.
51cea7326SColin Cross  *
61cea7326SColin Cross  * This program is free software; you can redistribute it and/or modify
71cea7326SColin Cross  * it under the terms of the GNU General Public License version 2 as
81cea7326SColin Cross  * published by the Free Software Foundation.
91cea7326SColin Cross  */
10a0524accSThierry Reding 
11a0524accSThierry Reding #include <linux/clk/tegra.h>
121cea7326SColin Cross #include <linux/kernel.h>
131cea7326SColin Cross #include <linux/smp.h>
141cea7326SColin Cross 
15*304664eaSThierry Reding #include <soc/tegra/fuse.h>
16*304664eaSThierry Reding 
1759b0f682SJoseph Lo #include <asm/smp_plat.h>
181cea7326SColin Cross 
1959b0f682SJoseph Lo #include "sleep.h"
201cea7326SColin Cross 
2159b0f682SJoseph Lo static void (*tegra_hotplug_shutdown)(void);
221cea7326SColin Cross 
23b8119431SJoseph Lo int tegra_cpu_kill(unsigned cpu)
24b8119431SJoseph Lo {
25b8119431SJoseph Lo 	cpu = cpu_logical_map(cpu);
26b8119431SJoseph Lo 
27b8119431SJoseph Lo 	/* Clock gate the CPU */
28b8119431SJoseph Lo 	tegra_wait_cpu_in_reset(cpu);
29b8119431SJoseph Lo 	tegra_disable_cpu_clock(cpu);
30b8119431SJoseph Lo 
31b8119431SJoseph Lo 	return 1;
32b8119431SJoseph Lo }
33b8119431SJoseph Lo 
341cea7326SColin Cross /*
351cea7326SColin Cross  * platform-specific code to shutdown a CPU
361cea7326SColin Cross  *
371cea7326SColin Cross  * Called with IRQs disabled
381cea7326SColin Cross  */
39a1725732SMarc Zyngier void __ref tegra_cpu_die(unsigned int cpu)
401cea7326SColin Cross {
4157886616SJoseph Lo 	/* Clean L1 data cache */
42ac2527bfSJoseph Lo 	tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
431cea7326SColin Cross 
4459b0f682SJoseph Lo 	/* Shut down the current CPU. */
4559b0f682SJoseph Lo 	tegra_hotplug_shutdown();
46d4450261SRussell King 
4759b0f682SJoseph Lo 	/* Should never return here. */
4859b0f682SJoseph Lo 	BUG();
491cea7326SColin Cross }
501cea7326SColin Cross 
517469688eSHiroshi Doyu void __init tegra_hotplug_init(void)
52453689e4SJoseph Lo {
537469688eSHiroshi Doyu 	if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
547469688eSHiroshi Doyu 		return;
55453689e4SJoseph Lo 
56*304664eaSThierry Reding 	if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
577469688eSHiroshi Doyu 		tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
58*304664eaSThierry Reding 	if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
5959b0f682SJoseph Lo 		tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
60*304664eaSThierry Reding 	if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
6133d5c019SJoseph Lo 		tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
62*304664eaSThierry Reding 	if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
639997e626SJoseph Lo 		tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
6459b0f682SJoseph Lo }
65