diff options
author | Paul Mundt <lethal@linux-sh.org> | 2011-01-07 10:51:35 +0900 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-01-07 10:51:35 +0900 |
commit | e9d728f528f9548c8dd013899b23e662fa7b6bca (patch) | |
tree | d88a5df6e5a2b33ebe088ad0223fe54679a59df3 /arch/arm/mach-shmobile/platsmp.c | |
parent | 018a3fc7e3824ffcc80ad0160f9782c7d577c0c1 (diff) | |
parent | 6155f77d09b968f591876f368d4843168910449e (diff) | |
download | blackbird-op-linux-e9d728f528f9548c8dd013899b23e662fa7b6bca.tar.gz blackbird-op-linux-e9d728f528f9548c8dd013899b23e662fa7b6bca.zip |
Merge branch 'rmobile/smp' into rmobile-latest
Conflicts:
arch/arm/Kconfig
arch/arm/mach-shmobile/include/mach/entry-macro-intc.S
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/platsmp.c')
-rw-r--r-- | arch/arm/mach-shmobile/platsmp.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/platsmp.c b/arch/arm/mach-shmobile/platsmp.c new file mode 100644 index 000000000000..3c2c0f49073e --- /dev/null +++ b/arch/arm/mach-shmobile/platsmp.c @@ -0,0 +1,85 @@ +/* + * SMP support for R-Mobile / SH-Mobile + * + * Copyright (C) 2010 Magnus Damm + * + * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include <linux/init.h> +#include <linux/errno.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/smp.h> +#include <linux/io.h> +#include <asm/localtimer.h> +#include <asm/mach-types.h> +#include <mach/common.h> + +static unsigned int __init shmobile_smp_get_core_count(void) +{ + if (machine_is_ag5evm()) + return sh73a0_get_core_count(); + + return 1; +} + +static void __init shmobile_smp_prepare_cpus(void) +{ + if (machine_is_ag5evm()) + sh73a0_smp_prepare_cpus(); +} + + +void __cpuinit platform_secondary_init(unsigned int cpu) +{ + trace_hardirqs_off(); + + if (machine_is_ag5evm()) + sh73a0_secondary_init(cpu); +} + +int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) +{ + if (machine_is_ag5evm()) + return sh73a0_boot_secondary(cpu); + + return -ENOSYS; +} + +void __init smp_init_cpus(void) +{ + unsigned int ncores = shmobile_smp_get_core_count(); + unsigned int i; + + for (i = 0; i < ncores; i++) + set_cpu_possible(i, true); +} + +void __init smp_prepare_cpus(unsigned int max_cpus) +{ + unsigned int ncores = shmobile_smp_get_core_count(); + unsigned int cpu = smp_processor_id(); + int i; + + smp_store_cpu_info(cpu); + + if (max_cpus > ncores) + max_cpus = ncores; + + for (i = 0; i < max_cpus; i++) + set_cpu_present(i, true); + + if (max_cpus > 1) { + shmobile_smp_prepare_cpus(); + + /* + * Enable the local timer or broadcast device for the + * boot CPU, but only if we have more than one CPU. + */ + percpu_timer_setup(); + } +} |