blob: d60339c996cbdf645f715ac52319c98dfc932094 [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 */
Thierry Redinga0524ac2014-07-11 09:44:49 +020010
11#include <linux/clk/tegra.h>
Colin Cross1cea7322010-02-21 17:46:23 -080012#include <linux/kernel.h>
Colin Cross1cea7322010-02-21 17:46:23 -080013#include <linux/smp.h>
Colin Cross1cea7322010-02-21 17:46:23 -080014
Thierry Reding304664e2014-07-11 09:52:41 +020015#include <soc/tegra/fuse.h>
16
Joseph Lo59b0f682012-08-16 17:31:51 +080017#include <asm/smp_plat.h>
Colin Cross1cea7322010-02-21 17:46:23 -080018
Joseph Lo59b0f682012-08-16 17:31:51 +080019#include "sleep.h"
Colin Cross1cea7322010-02-21 17:46:23 -080020
Joseph Lo59b0f682012-08-16 17:31:51 +080021static void (*tegra_hotplug_shutdown)(void);
Colin Cross1cea7322010-02-21 17:46:23 -080022
Joseph Lob8119432013-01-03 14:43:00 +080023int tegra_cpu_kill(unsigned cpu)
24{
25 cpu = cpu_logical_map(cpu);
26
27 /* Clock gate the CPU */
28 tegra_wait_cpu_in_reset(cpu);
29 tegra_disable_cpu_clock(cpu);
30
31 return 1;
32}
33
Colin Cross1cea7322010-02-21 17:46:23 -080034/*
35 * platform-specific code to shutdown a CPU
36 *
37 * Called with IRQs disabled
38 */
Marc Zyngiera1725732011-09-08 13:15:22 +010039void __ref tegra_cpu_die(unsigned int cpu)
Colin Cross1cea7322010-02-21 17:46:23 -080040{
Joseph Lo57886612013-01-03 14:42:59 +080041 /* Clean L1 data cache */
Joseph Loac2527b2013-07-03 17:50:38 +080042 tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
Colin Cross1cea7322010-02-21 17:46:23 -080043
Joseph Lo59b0f682012-08-16 17:31:51 +080044 /* Shut down the current CPU. */
45 tegra_hotplug_shutdown();
Russell Kingd4450262010-12-19 11:30:43 +000046
Joseph Lo59b0f682012-08-16 17:31:51 +080047 /* Should never return here. */
48 BUG();
Colin Cross1cea7322010-02-21 17:46:23 -080049}
50
Hiroshi Doyu74696882013-02-13 19:15:48 +020051void __init tegra_hotplug_init(void)
Joseph Lo453689e2012-08-16 17:31:52 +080052{
Hiroshi Doyu74696882013-02-13 19:15:48 +020053 if (!IS_ENABLED(CONFIG_HOTPLUG_CPU))
54 return;
Joseph Lo453689e2012-08-16 17:31:52 +080055
Thierry Reding304664e2014-07-11 09:52:41 +020056 if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20)
Hiroshi Doyu74696882013-02-13 19:15:48 +020057 tegra_hotplug_shutdown = tegra20_hotplug_shutdown;
Thierry Reding304664e2014-07-11 09:52:41 +020058 if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30)
Hiroshi Doyu74696882013-02-13 19:15:48 +020059 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
Thierry Reding304664e2014-07-11 09:52:41 +020060 if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114)
Joseph Lo33d5c012013-05-20 18:39:29 +080061 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
Thierry Reding304664e2014-07-11 09:52:41 +020062 if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124)
Joseph Lo9997e622013-10-11 17:57:30 +080063 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
Joseph Lo59b0f682012-08-16 17:31:51 +080064}