Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 1 | /* |
| 2 | * SMP support for R-Mobile / SH-Mobile |
| 3 | * |
| 4 | * Copyright (C) 2010 Magnus Damm |
Paul Mundt | c413521 | 2011-01-07 12:03:22 +0900 | [diff] [blame^] | 5 | * Copyright (C) 2011 Paul Mundt |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 6 | * |
| 7 | * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | */ |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/errno.h> |
| 15 | #include <linux/delay.h> |
| 16 | #include <linux/device.h> |
| 17 | #include <linux/smp.h> |
| 18 | #include <linux/io.h> |
| 19 | #include <asm/localtimer.h> |
Magnus Damm | 72f4d57 | 2010-12-14 16:57:11 +0900 | [diff] [blame] | 20 | #include <asm/mach-types.h> |
| 21 | #include <mach/common.h> |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 22 | |
| 23 | static unsigned int __init shmobile_smp_get_core_count(void) |
| 24 | { |
Magnus Damm | 72f4d57 | 2010-12-14 16:57:11 +0900 | [diff] [blame] | 25 | if (machine_is_ag5evm()) |
| 26 | return sh73a0_get_core_count(); |
| 27 | |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 28 | return 1; |
| 29 | } |
| 30 | |
| 31 | static void __init shmobile_smp_prepare_cpus(void) |
| 32 | { |
Magnus Damm | 72f4d57 | 2010-12-14 16:57:11 +0900 | [diff] [blame] | 33 | if (machine_is_ag5evm()) |
| 34 | sh73a0_smp_prepare_cpus(); |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 35 | } |
| 36 | |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 37 | void __cpuinit platform_secondary_init(unsigned int cpu) |
| 38 | { |
| 39 | trace_hardirqs_off(); |
Magnus Damm | 72f4d57 | 2010-12-14 16:57:11 +0900 | [diff] [blame] | 40 | |
| 41 | if (machine_is_ag5evm()) |
| 42 | sh73a0_secondary_init(cpu); |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) |
| 46 | { |
Magnus Damm | 72f4d57 | 2010-12-14 16:57:11 +0900 | [diff] [blame] | 47 | if (machine_is_ag5evm()) |
| 48 | return sh73a0_boot_secondary(cpu); |
| 49 | |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 50 | return -ENOSYS; |
| 51 | } |
| 52 | |
| 53 | void __init smp_init_cpus(void) |
| 54 | { |
| 55 | unsigned int ncores = shmobile_smp_get_core_count(); |
| 56 | unsigned int i; |
| 57 | |
| 58 | for (i = 0; i < ncores; i++) |
| 59 | set_cpu_possible(i, true); |
| 60 | } |
| 61 | |
Paul Mundt | c413521 | 2011-01-07 12:03:22 +0900 | [diff] [blame^] | 62 | void __init platform_smp_prepare_cpus(unsigned int max_cpus) |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 63 | { |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 64 | int i; |
| 65 | |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 66 | for (i = 0; i < max_cpus; i++) |
| 67 | set_cpu_present(i, true); |
| 68 | |
Paul Mundt | c413521 | 2011-01-07 12:03:22 +0900 | [diff] [blame^] | 69 | shmobile_smp_prepare_cpus(); |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 70 | } |