blob: ff26af26bd0ce7b15d7a9308f3a36d240ec0a8a1 [file] [log] [blame]
Colin Cross1cea7322010-02-21 17:46:23 -08001/*
Colin Cross1cea7322010-02-21 17:46:23 -08002 * Copyright (C) 2002 ARM Ltd.
3 * All Rights Reserved
Hiroshi Doyu74696882013-02-13 19:15:48 +02004 * Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved.
Colin Cross1cea7322010-02-21 17:46:23 -08005 *
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#include <linux/kernel.h>
Colin Cross1cea7322010-02-21 17:46:23 -080011#include <linux/smp.h>
Prashant Gaikwad89572c72013-01-11 13:16:21 +053012#include <linux/clk/tegra.h>
Colin Cross1cea7322010-02-21 17:46:23 -080013
Joseph Lo59b0f682012-08-16 17:31:51 +080014#include <asm/smp_plat.h>
Colin Cross1cea7322010-02-21 17:46:23 -080015
Hiroshi Doyu74696882013-02-13 19:15:48 +020016#include "fuse.h"
Joseph Lo59b0f682012-08-16 17:31:51 +080017#include "sleep.h"
Colin Cross1cea7322010-02-21 17:46:23 -080018
Joseph Lo59b0f682012-08-16 17:31:51 +080019static void (*tegra_hotplug_shutdown)(void);
Colin Cross1cea7322010-02-21 17:46:23 -080020
Joseph Lob8119432013-01-03 14:43:00 +080021int tegra_cpu_kill(unsigned cpu)
22{
23 cpu = cpu_logical_map(cpu);
24
25 /* Clock gate the CPU */
26 tegra_wait_cpu_in_reset(cpu);
27 tegra_disable_cpu_clock(cpu);
28
29 return 1;
30}
31
Colin Cross1cea7322010-02-21 17:46:23 -080032/*
33 * platform-specific code to shutdown a CPU
34 *
35 * Called with IRQs disabled
36 */
Marc Zyngiera1725732011-09-08 13:15:22 +010037void __ref tegra_cpu_die(unsigned int cpu)
Colin Cross1cea7322010-02-21 17:46:23 -080038{
Joseph Lo57886612013-01-03 14:42:59 +080039 /* Clean L1 data cache */
Joseph Loac2527b2013-07-03 17:50:38 +080040 tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
Colin Cross1cea7322010-02-21 17:46:23 -080041
Joseph Lo59b0f682012-08-16 17:31:51 +080042 /* Shut down the current CPU. */
43 tegra_hotplug_shutdown();
Russell Kingd4450262010-12-19 11:30:43 +000044
Joseph Lo59b0f682012-08-16 17:31:51 +080045 /* Should never return here. */
46 BUG();
Colin Cross1cea7322010-02-21 17:46:23 -080047}
48
Hiroshi Doyu74696882013-02-13 19:15:48 +020049void __init tegra_hotplug_init(void)
Joseph Lo453689e2012-08-16 17:31:52 +080050{
Hiroshi Doyu74696882013-02-13 19:15:48 +020051 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
52 return;
Joseph Lo453689e2012-08-16 17:31:52 +080053
Hiroshi Doyu74696882013-02-13 19:15:48 +020054 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_chip_id == TEGRA20)
55 tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
56 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_chip_id == TEGRA30)
57 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
Joseph Lo33d5c012013-05-20 18:39:29 +080058 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_chip_id == TEGRA114)
59 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
Joseph Lo9997e622013-10-11 17:57:30 +080060 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_chip_id == TEGRA124)
61 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
Joseph Lo59b0f682012-08-16 17:31:51 +080062}