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 */ 101cea7326SColin Cross #include <linux/kernel.h> 111cea7326SColin Cross #include <linux/smp.h> 1289572c77SPrashant Gaikwad #include <linux/clk/tegra.h> 131cea7326SColin Cross 1459b0f682SJoseph Lo #include <asm/smp_plat.h> 151cea7326SColin Cross 167469688eSHiroshi Doyu #include "fuse.h" 1759b0f682SJoseph Lo #include "sleep.h" 181cea7326SColin Cross 1959b0f682SJoseph Lo static void (*tegra_hotplug_shutdown)(void); 201cea7326SColin Cross 21b8119431SJoseph Lo int tegra_cpu_kill(unsigned cpu) 22b8119431SJoseph Lo { 23b8119431SJoseph Lo cpu = cpu_logical_map(cpu); 24b8119431SJoseph Lo 25b8119431SJoseph Lo /* Clock gate the CPU */ 26b8119431SJoseph Lo tegra_wait_cpu_in_reset(cpu); 27b8119431SJoseph Lo tegra_disable_cpu_clock(cpu); 28b8119431SJoseph Lo 29b8119431SJoseph Lo return 1; 30b8119431SJoseph Lo } 31b8119431SJoseph Lo 321cea7326SColin Cross /* 331cea7326SColin Cross * platform-specific code to shutdown a CPU 341cea7326SColin Cross * 351cea7326SColin Cross * Called with IRQs disabled 361cea7326SColin Cross */ 37a1725732SMarc Zyngier void __ref tegra_cpu_die(unsigned int cpu) 381cea7326SColin Cross { 3957886616SJoseph Lo /* Clean L1 data cache */ 40*ac2527bfSJoseph Lo tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS); 411cea7326SColin Cross 4259b0f682SJoseph Lo /* Shut down the current CPU. */ 4359b0f682SJoseph Lo tegra_hotplug_shutdown(); 44d4450261SRussell King 4559b0f682SJoseph Lo /* Should never return here. */ 4659b0f682SJoseph Lo BUG(); 471cea7326SColin Cross } 481cea7326SColin Cross 497469688eSHiroshi Doyu void __init tegra_hotplug_init(void) 50453689e4SJoseph Lo { 517469688eSHiroshi Doyu if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) 527469688eSHiroshi Doyu return; 53453689e4SJoseph Lo 547469688eSHiroshi Doyu if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20) 557469688eSHiroshi Doyu tegra_hotplug_shutdown = tegra20_hotplug_shutdown; 567469688eSHiroshi Doyu if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30) 5759b0f682SJoseph Lo tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 5833d5c019SJoseph Lo if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114) 5933d5c019SJoseph Lo tegra_hotplug_shutdown = tegra30_hotplug_shutdown; 6059b0f682SJoseph Lo } 61