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/common.h> 16#include <soc/tegra/fuse.h> 17 18#include <asm/smp_plat.h> 19 20#include "sleep.h" 21 22static void (*tegra_hotplug_shutdown)(void); 23 24int 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 35/* 36 * platform-specific code to shutdown a CPU 37 * 38 * Called with IRQs disabled 39 */ 40void tegra_cpu_die(unsigned int cpu) 41{ 42 if (!tegra_hotplug_shutdown) { 43 WARN(1, "hotplug is not yet initialized\n"); 44 return; 45 } 46 47 /* Clean L1 data cache */ 48 tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS); 49 50 /* Shut down the current CPU. */ 51 tegra_hotplug_shutdown(); 52 53 /* Should never return here. */ 54 BUG(); 55} 56 57static int __init tegra_hotplug_init(void) 58{ 59 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) 60 return 0; 61 62 if (!soc_is_tegra()) 63 return 0; 64 65 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20) 66 tegra_hotplug_shutdown = tegra20_hotplug_shutdown; 67 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30) 68 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 69 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114) 70 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 71 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124) 72 tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 73 74 return 0; 75} 76pure_initcall(tegra_hotplug_init); 77