xref: /linux/arch/arm/mach-tegra/hotplug.c (revision a0524acc94c91c72c2968a76eddc6f3afe82f9f2)
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  */
10*a0524accSThierry Reding 
11*a0524accSThierry Reding #include <linux/clk/tegra.h>
121cea7326SColin Cross #include <linux/kernel.h>
131cea7326SColin Cross #include <linux/smp.h>
141cea7326SColin Cross 
1559b0f682SJoseph Lo #include <asm/smp_plat.h>
161cea7326SColin Cross 
177469688eSHiroshi Doyu #include "fuse.h"
1859b0f682SJoseph Lo #include "sleep.h"
191cea7326SColin Cross 
2059b0f682SJoseph Lo static void (*tegra_hotplug_shutdown)(void);
211cea7326SColin Cross 
22b8119431SJoseph Lo int tegra_cpu_kill(unsigned cpu)
23b8119431SJoseph Lo {
24b8119431SJoseph Lo 	cpu = cpu_logical_map(cpu);
25b8119431SJoseph Lo 
26b8119431SJoseph Lo 	/* Clock gate the CPU */
27b8119431SJoseph Lo 	tegra_wait_cpu_in_reset(cpu);
28b8119431SJoseph Lo 	tegra_disable_cpu_clock(cpu);
29b8119431SJoseph Lo 
30b8119431SJoseph Lo 	return 1;
31b8119431SJoseph Lo }
32b8119431SJoseph Lo 
331cea7326SColin Cross /*
341cea7326SColin Cross  * platform-specific code to shutdown a CPU
351cea7326SColin Cross  *
361cea7326SColin Cross  * Called with IRQs disabled
371cea7326SColin Cross  */
38a1725732SMarc Zyngier void __ref tegra_cpu_die(unsigned int cpu)
391cea7326SColin Cross {
4057886616SJoseph Lo 	/* Clean L1 data cache */
41ac2527bfSJoseph Lo 	tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
421cea7326SColin Cross 
4359b0f682SJoseph Lo 	/* Shut down the current CPU. */
4459b0f682SJoseph Lo 	tegra_hotplug_shutdown();
45d4450261SRussell King 
4659b0f682SJoseph Lo 	/* Should never return here. */
4759b0f682SJoseph Lo 	BUG();
481cea7326SColin Cross }
491cea7326SColin Cross 
507469688eSHiroshi Doyu void __init tegra_hotplug_init(void)
51453689e4SJoseph Lo {
527469688eSHiroshi Doyu 	if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
537469688eSHiroshi Doyu 		return;
54453689e4SJoseph Lo 
557469688eSHiroshi Doyu 	if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20)
567469688eSHiroshi Doyu 		tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
577469688eSHiroshi Doyu 	if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30)
5859b0f682SJoseph Lo 		tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
5933d5c019SJoseph Lo 	if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114)
6033d5c019SJoseph Lo 		tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
619997e626SJoseph Lo 	if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_chip_id == TEGRA124)
629997e626SJoseph Lo 		tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
6359b0f682SJoseph Lo }
64