Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 1 | /* |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 2 | * Copyright (C) 2002 ARM Ltd. |
| 3 | * All Rights Reserved |
Hiroshi Doyu | 7469688 | 2013-02-13 19:15:48 +0200 | [diff] [blame] | 4 | * Copyright (c) 2010, 2012-2013, NVIDIA Corporation. All rights reserved. |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 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 | */ |
Thierry Reding | a0524ac | 2014-07-11 09:44:49 +0200 | [diff] [blame] | 10 | |
| 11 | #include <linux/clk/tegra.h> |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 12 | #include <linux/kernel.h> |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 13 | #include <linux/smp.h> |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 14 | |
Thierry Reding | 304664e | 2014-07-11 09:52:41 +0200 | [diff] [blame^] | 15 | #include <soc/tegra/fuse.h> |
| 16 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame] | 17 | #include <asm/smp_plat.h> |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 18 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame] | 19 | #include "sleep.h" |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 20 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame] | 21 | static void (*tegra_hotplug_shutdown)(void); |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 22 | |
Joseph Lo | b811943 | 2013-01-03 14:43:00 +0800 | [diff] [blame] | 23 | int 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 Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 34 | /* |
| 35 | * platform-specific code to shutdown a CPU |
| 36 | * |
| 37 | * Called with IRQs disabled |
| 38 | */ |
Marc Zyngier | a172573 | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 39 | void __ref tegra_cpu_die(unsigned int cpu) |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 40 | { |
Joseph Lo | 5788661 | 2013-01-03 14:42:59 +0800 | [diff] [blame] | 41 | /* Clean L1 data cache */ |
Joseph Lo | ac2527b | 2013-07-03 17:50:38 +0800 | [diff] [blame] | 42 | tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS); |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 43 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame] | 44 | /* Shut down the current CPU. */ |
| 45 | tegra_hotplug_shutdown(); |
Russell King | d445026 | 2010-12-19 11:30:43 +0000 | [diff] [blame] | 46 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame] | 47 | /* Should never return here. */ |
| 48 | BUG(); |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 49 | } |
| 50 | |
Hiroshi Doyu | 7469688 | 2013-02-13 19:15:48 +0200 | [diff] [blame] | 51 | void __init tegra_hotplug_init(void) |
Joseph Lo | 453689e | 2012-08-16 17:31:52 +0800 | [diff] [blame] | 52 | { |
Hiroshi Doyu | 7469688 | 2013-02-13 19:15:48 +0200 | [diff] [blame] | 53 | if (!IS_ENABLED(CONFIG_HOTPLUG_CPU)) |
| 54 | return; |
Joseph Lo | 453689e | 2012-08-16 17:31:52 +0800 | [diff] [blame] | 55 | |
Thierry Reding | 304664e | 2014-07-11 09:52:41 +0200 | [diff] [blame^] | 56 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_2x_SOC) && tegra_get_chip_id() == TEGRA20) |
Hiroshi Doyu | 7469688 | 2013-02-13 19:15:48 +0200 | [diff] [blame] | 57 | tegra_hotplug_shutdown = tegra20_hotplug_shutdown; |
Thierry Reding | 304664e | 2014-07-11 09:52:41 +0200 | [diff] [blame^] | 58 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_3x_SOC) && tegra_get_chip_id() == TEGRA30) |
Hiroshi Doyu | 7469688 | 2013-02-13 19:15:48 +0200 | [diff] [blame] | 59 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; |
Thierry Reding | 304664e | 2014-07-11 09:52:41 +0200 | [diff] [blame^] | 60 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_114_SOC) && tegra_get_chip_id() == TEGRA114) |
Joseph Lo | 33d5c01 | 2013-05-20 18:39:29 +0800 | [diff] [blame] | 61 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; |
Thierry Reding | 304664e | 2014-07-11 09:52:41 +0200 | [diff] [blame^] | 62 | if (IS_ENABLED(CONFIG_ARCH_TEGRA_124_SOC) && tegra_get_chip_id() == TEGRA124) |
Joseph Lo | 9997e62 | 2013-10-11 17:57:30 +0800 | [diff] [blame] | 63 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame] | 64 | } |