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 | * |
| 3 | * Copyright (C) 2002 ARM Ltd. |
| 4 | * All Rights Reserved |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 5 | * Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved. |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | #include <linux/kernel.h> |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 12 | #include <linux/smp.h> |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 13 | |
| 14 | #include <asm/cacheflush.h> |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 15 | #include <asm/smp_plat.h> |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 16 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 17 | #include "sleep.h" |
| 18 | #include "tegra_cpu_car.h" |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 19 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 20 | static void (*tegra_hotplug_shutdown)(void); |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 21 | |
| 22 | int platform_cpu_kill(unsigned int cpu) |
| 23 | { |
Russell King | 3c030be | 2010-11-30 11:07:35 +0000 | [diff] [blame] | 24 | return 1; |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | /* |
| 28 | * platform-specific code to shutdown a CPU |
| 29 | * |
| 30 | * Called with IRQs disabled |
| 31 | */ |
| 32 | void platform_cpu_die(unsigned int cpu) |
| 33 | { |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 34 | cpu = cpu_logical_map(cpu); |
Russell King | d445026 | 2010-12-19 11:30:43 +0000 | [diff] [blame] | 35 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 36 | /* Flush the L1 data cache. */ |
| 37 | flush_cache_all(); |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 38 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 39 | /* Shut down the current CPU. */ |
| 40 | tegra_hotplug_shutdown(); |
Russell King | d445026 | 2010-12-19 11:30:43 +0000 | [diff] [blame] | 41 | |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 42 | /* Clock gate the CPU */ |
| 43 | tegra_wait_cpu_in_reset(cpu); |
| 44 | tegra_disable_cpu_clock(cpu); |
| 45 | |
| 46 | /* Should never return here. */ |
| 47 | BUG(); |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | int platform_cpu_disable(unsigned int cpu) |
| 51 | { |
| 52 | /* |
| 53 | * we don't allow CPU 0 to be shutdown (it is still too special |
| 54 | * e.g. clock tick interrupts) |
| 55 | */ |
| 56 | return cpu == 0 ? -EPERM : 0; |
| 57 | } |
Joseph Lo | 59b0f68 | 2012-08-16 17:31:51 +0800 | [diff] [blame^] | 58 | |
| 59 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC |
| 60 | extern void tegra30_hotplug_shutdown(void); |
| 61 | void __init tegra30_hotplug_init(void) |
| 62 | { |
| 63 | tegra_hotplug_shutdown = tegra30_hotplug_shutdown; |
| 64 | } |
| 65 | #endif |