2 * arch/arm/mach-tegra/hotplug.c
4 * Copyright (C) 2010-2011 NVIDIA Corporation
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.
10 #include <linux/kernel.h>
12 #include <linux/smp.h>
13 #include <linux/cpu_pm.h>
15 #include <asm/cacheflush.h>
17 #include <mach/iomap.h>
22 #define CPU_CLOCK(cpu) (0x1<<(8+cpu))
24 #define CLK_RST_CONTROLLER_CLK_CPU_CMPLX \
25 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x4c)
26 #define CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET \
27 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x340)
28 #define CLK_RST_CONTROLLER_RST_CPU_CMPLX_CLR \
29 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x344)
31 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
32 /* For Tegra2 use the software-written value of the reset register for status.*/
33 #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS CLK_RST_CONTROLLER_RST_CPU_CMPLX_SET
35 #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS \
36 (IO_ADDRESS(TEGRA_CLK_RESET_BASE) + 0x470)
39 int platform_cpu_kill(unsigned int cpu)
44 reg = readl(CLK_RST_CONTROLLER_CPU_CMPLX_STATUS);
46 } while (!(reg & (1<<cpu)));
48 reg = readl(CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
49 writel(reg | CPU_CLOCK(cpu), CLK_RST_CONTROLLER_CLK_CPU_CMPLX);
54 void platform_cpu_die(unsigned int cpu)
56 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
57 /* Flush the L1 data cache. */
60 /* Place the current CPU in reset. */
61 tegra2_hotplug_shutdown();
63 /* Disable GIC CPU interface for this CPU. */
64 tegra_gic_cpu_disable();
66 /* Tegra3 enters LPx states via WFI - do not propagate legacy IRQs
67 to CPU core to avoid fall through WFI; then GIC output will be
68 enabled, however at this time - CPU is dying - no interrupt should
69 have affinity to this CPU. */
70 tegra_gic_pass_through_disable();
72 /* Flush the L1 data cache. */
75 /* Shut down the current CPU. */
76 tegra3_hotplug_shutdown();
79 /* Should never return here. */
83 int platform_cpu_disable(unsigned int cpu)
86 * we don't allow CPU 0 to be shutdown (it is still too special
87 * e.g. clock tick interrupts)
89 return cpu == 0 ? -EPERM : 0;