Commit a1725732 authored by Marc Zyngier's avatar Marc Zyngier Committed by Arnd Bergmann

ARM: SoC: convert Tegra to SMP operations

Convert Tegra to use struct smp_operations to provide its SMP
and CPU hotplug operations.

Tested on Harmony.
Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
Acked-by: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarOlof Johansson <olof@lixom.net>
Acked-by: default avatarNicolas Pitre <nico@linaro.org>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent 06915321
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "board-harmony.h" #include "board-harmony.h"
#include "clock.h" #include "clock.h"
#include "devices.h" #include "devices.h"
#include "common.h"
struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = { struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL), OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL),
...@@ -166,6 +167,7 @@ static const char *tegra20_dt_board_compat[] = { ...@@ -166,6 +167,7 @@ static const char *tegra20_dt_board_compat[] = {
DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)") DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
.map_io = tegra_map_common_io, .map_io = tegra_map_common_io,
.smp = smp_ops(tegra_smp_ops),
.init_early = tegra20_init_early, .init_early = tegra20_init_early,
.init_irq = tegra_dt_init_irq, .init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq, .handle_irq = gic_handle_irq,
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "board.h" #include "board.h"
#include "clock.h" #include "clock.h"
#include "common.h"
struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = { struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000000, "sdhci-tegra.0", NULL), OF_DEV_AUXDATA("nvidia,tegra20-sdhci", 0x78000000, "sdhci-tegra.0", NULL),
...@@ -83,6 +84,7 @@ static const char *tegra30_dt_board_compat[] = { ...@@ -83,6 +84,7 @@ static const char *tegra30_dt_board_compat[] = {
}; };
DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)") DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
.smp = smp_ops(tegra_smp_ops),
.map_io = tegra_map_common_io, .map_io = tegra_map_common_io,
.init_early = tegra30_init_early, .init_early = tegra30_init_early,
.init_irq = tegra_dt_init_irq, .init_irq = tegra_dt_init_irq,
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "clock.h" #include "clock.h"
#include "devices.h" #include "devices.h"
#include "gpio-names.h" #include "gpio-names.h"
#include "common.h"
static struct plat_serial8250_port debug_uart_platform_data[] = { static struct plat_serial8250_port debug_uart_platform_data[] = {
{ {
...@@ -185,6 +186,7 @@ static void __init tegra_harmony_init(void) ...@@ -185,6 +186,7 @@ static void __init tegra_harmony_init(void)
MACHINE_START(HARMONY, "harmony") MACHINE_START(HARMONY, "harmony")
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(tegra_smp_ops),
.fixup = tegra_harmony_fixup, .fixup = tegra_harmony_fixup,
.map_io = tegra_map_common_io, .map_io = tegra_map_common_io,
.init_early = tegra20_init_early, .init_early = tegra20_init_early,
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "clock.h" #include "clock.h"
#include "devices.h" #include "devices.h"
#include "gpio-names.h" #include "gpio-names.h"
#include "common.h"
static struct plat_serial8250_port debug_uart_platform_data[] = { static struct plat_serial8250_port debug_uart_platform_data[] = {
{ {
...@@ -223,6 +224,7 @@ static void __init tegra_paz00_init(void) ...@@ -223,6 +224,7 @@ static void __init tegra_paz00_init(void)
MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ") MACHINE_START(PAZ00, "Toshiba AC100 / Dynabook AZ")
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(tegra_smp_ops),
.fixup = tegra_paz00_fixup, .fixup = tegra_paz00_fixup,
.map_io = tegra_map_common_io, .map_io = tegra_map_common_io,
.init_early = tegra20_init_early, .init_early = tegra20_init_early,
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "clock.h" #include "clock.h"
#include "devices.h" #include "devices.h"
#include "gpio-names.h" #include "gpio-names.h"
#include "common.h"
#include "board-trimslice.h" #include "board-trimslice.h"
...@@ -171,6 +172,7 @@ static void __init tegra_trimslice_init(void) ...@@ -171,6 +172,7 @@ static void __init tegra_trimslice_init(void)
MACHINE_START(TRIMSLICE, "trimslice") MACHINE_START(TRIMSLICE, "trimslice")
.atag_offset = 0x100, .atag_offset = 0x100,
.smp = smp_ops(tegra_smp_ops),
.fixup = tegra_trimslice_fixup, .fixup = tegra_trimslice_fixup,
.map_io = tegra_map_common_io, .map_io = tegra_map_common_io,
.init_early = tegra20_init_early, .init_early = tegra20_init_early,
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "board.h" #include "board.h"
#include "clock.h" #include "clock.h"
#include "common.h"
#include "fuse.h" #include "fuse.h"
#include "pmc.h" #include "pmc.h"
#include "apbio.h" #include "apbio.h"
......
extern struct smp_operations tegra_smp_ops;
extern void tegra_cpu_die(unsigned int cpu);
...@@ -87,17 +87,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) ...@@ -87,17 +87,12 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
} }
} }
int platform_cpu_kill(unsigned int cpu)
{
return 1;
}
/* /*
* platform-specific code to shutdown a CPU * platform-specific code to shutdown a CPU
* *
* Called with IRQs disabled * Called with IRQs disabled
*/ */
void platform_cpu_die(unsigned int cpu) void __ref tegra_cpu_die(unsigned int cpu)
{ {
int spurious = 0; int spurious = 0;
...@@ -116,12 +111,3 @@ void platform_cpu_die(unsigned int cpu) ...@@ -116,12 +111,3 @@ void platform_cpu_die(unsigned int cpu)
if (spurious) if (spurious)
pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious); pr_warn("CPU%u: %u spurious wakeup calls\n", cpu, spurious);
} }
int platform_cpu_disable(unsigned int cpu)
{
/*
* we don't allow CPU 0 to be shutdown (it is still too special
* e.g. clock tick interrupts)
*/
return cpu == 0 ? -EPERM : 0;
}
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include "flowctrl.h" #include "flowctrl.h"
#include "reset.h" #include "reset.h"
#include "common.h"
extern void tegra_secondary_startup(void); extern void tegra_secondary_startup(void);
static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE); static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
...@@ -50,7 +52,7 @@ static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE); ...@@ -50,7 +52,7 @@ static void __iomem *scu_base = IO_ADDRESS(TEGRA_ARM_PERIF_BASE);
#define CPU_CLOCK(cpu) (0x1<<(8+cpu)) #define CPU_CLOCK(cpu) (0x1<<(8+cpu))
#define CPU_RESET(cpu) (0x1111ul<<(cpu)) #define CPU_RESET(cpu) (0x1111ul<<(cpu))
void __cpuinit platform_secondary_init(unsigned int cpu) static void __cpuinit tegra_secondary_init(unsigned int cpu)
{ {
/* /*
* if any interrupts are already enabled for the primary * if any interrupts are already enabled for the primary
...@@ -117,7 +119,7 @@ static int tegra30_power_up_cpu(unsigned int cpu) ...@@ -117,7 +119,7 @@ static int tegra30_power_up_cpu(unsigned int cpu)
return 0; return 0;
} }
int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) static int __cpuinit tegra_boot_secondary(unsigned int cpu, struct task_struct *idle)
{ {
int status; int status;
...@@ -165,7 +167,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) ...@@ -165,7 +167,7 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
* Initialise the CPU possible map early - this describes the CPUs * Initialise the CPU possible map early - this describes the CPUs
* which may be present or become present in the system. * which may be present or become present in the system.
*/ */
void __init smp_init_cpus(void) static void __init tegra_smp_init_cpus(void)
{ {
unsigned int i, ncores = scu_get_core_count(scu_base); unsigned int i, ncores = scu_get_core_count(scu_base);
...@@ -181,8 +183,18 @@ void __init smp_init_cpus(void) ...@@ -181,8 +183,18 @@ void __init smp_init_cpus(void)
set_smp_cross_call(gic_raise_softirq); set_smp_cross_call(gic_raise_softirq);
} }
void __init platform_smp_prepare_cpus(unsigned int max_cpus) static void __init tegra_smp_prepare_cpus(unsigned int max_cpus)
{ {
tegra_cpu_reset_handler_init(); tegra_cpu_reset_handler_init();
scu_enable(scu_base); scu_enable(scu_base);
} }
struct smp_operations tegra_smp_ops __initdata = {
.smp_init_cpus = tegra_smp_init_cpus,
.smp_prepare_cpus = tegra_smp_prepare_cpus,
.smp_secondary_init = tegra_secondary_init,
.smp_boot_secondary = tegra_boot_secondary,
#ifdef CONFIG_HOTPLUG_CPU
.cpu_die = tegra_cpu_die,
#endif
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment