blob: be92d4c07606c21fbf4bfe795bed9df76f1ab80d [file] [log] [blame]
Colin Cross1cea7322010-02-21 17:46:23 -08001/*
Colin Cross1cea7322010-02-21 17:46:23 -08002 *
3 * Copyright (C) 2002 ARM Ltd.
4 * All Rights Reserved
Joseph Lo59b0f682012-08-16 17:31:51 +08005 * Copyright (c) 2010, 2012 NVIDIA Corporation. All rights reserved.
Colin Cross1cea7322010-02-21 17:46:23 -08006 *
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 Cross1cea7322010-02-21 17:46:23 -080012#include <linux/smp.h>
Colin Cross1cea7322010-02-21 17:46:23 -080013
14#include <asm/cacheflush.h>
Joseph Lo59b0f682012-08-16 17:31:51 +080015#include <asm/smp_plat.h>
Colin Cross1cea7322010-02-21 17:46:23 -080016
Joseph Lo59b0f682012-08-16 17:31:51 +080017#include "sleep.h"
18#include "tegra_cpu_car.h"
Colin Cross1cea7322010-02-21 17:46:23 -080019
Joseph Lo59b0f682012-08-16 17:31:51 +080020static void (*tegra_hotplug_shutdown)(void);
Colin Cross1cea7322010-02-21 17:46:23 -080021
22int platform_cpu_kill(unsigned int cpu)
23{
Russell King3c030be2010-11-30 11:07:35 +000024 return 1;
Colin Cross1cea7322010-02-21 17:46:23 -080025}
26
27/*
28 * platform-specific code to shutdown a CPU
29 *
30 * Called with IRQs disabled
31 */
32void platform_cpu_die(unsigned int cpu)
33{
Joseph Lo59b0f682012-08-16 17:31:51 +080034 cpu = cpu_logical_map(cpu);
Russell Kingd4450262010-12-19 11:30:43 +000035
Joseph Lo59b0f682012-08-16 17:31:51 +080036 /* Flush the L1 data cache. */
37 flush_cache_all();
Colin Cross1cea7322010-02-21 17:46:23 -080038
Joseph Lo59b0f682012-08-16 17:31:51 +080039 /* Shut down the current CPU. */
40 tegra_hotplug_shutdown();
Russell Kingd4450262010-12-19 11:30:43 +000041
Joseph Lo59b0f682012-08-16 17:31:51 +080042 /* 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 Cross1cea7322010-02-21 17:46:23 -080048}
49
50int 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 Lo59b0f682012-08-16 17:31:51 +080058
59#ifdef CONFIG_ARCH_TEGRA_3x_SOC
60extern void tegra30_hotplug_shutdown(void);
61void __init tegra30_hotplug_init(void)
62{
63 tegra_hotplug_shutdown = tegra30_hotplug_shutdown;
64}
65#endif