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 |
| 5 | * |
| 6 | * Based on vexpress, Copyright (C) 2002 ARM Ltd, All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as |
| 10 | * published by the Free Software Foundation. |
| 11 | */ |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/errno.h> |
| 14 | #include <linux/delay.h> |
| 15 | #include <linux/device.h> |
| 16 | #include <linux/smp.h> |
| 17 | #include <linux/io.h> |
| 18 | #include <asm/localtimer.h> |
| 19 | |
| 20 | static unsigned int __init shmobile_smp_get_core_count(void) |
| 21 | { |
| 22 | return 1; |
| 23 | } |
| 24 | |
| 25 | static void __init shmobile_smp_prepare_cpus(void) |
| 26 | { |
| 27 | /* do nothing for now */ |
| 28 | } |
| 29 | |
| 30 | |
| 31 | void __cpuinit platform_secondary_init(unsigned int cpu) |
| 32 | { |
| 33 | trace_hardirqs_off(); |
| 34 | } |
| 35 | |
| 36 | int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) |
| 37 | { |
| 38 | return -ENOSYS; |
| 39 | } |
| 40 | |
| 41 | void __init smp_init_cpus(void) |
| 42 | { |
| 43 | unsigned int ncores = shmobile_smp_get_core_count(); |
| 44 | unsigned int i; |
| 45 | |
| 46 | for (i = 0; i < ncores; i++) |
| 47 | set_cpu_possible(i, true); |
| 48 | } |
| 49 | |
| 50 | void __init smp_prepare_cpus(unsigned int max_cpus) |
| 51 | { |
| 52 | unsigned int ncores = shmobile_smp_get_core_count(); |
| 53 | unsigned int cpu = smp_processor_id(); |
| 54 | int i; |
| 55 | |
| 56 | smp_store_cpu_info(cpu); |
| 57 | |
| 58 | if (max_cpus > ncores) |
| 59 | max_cpus = ncores; |
| 60 | |
| 61 | for (i = 0; i < max_cpus; i++) |
| 62 | set_cpu_present(i, true); |
| 63 | |
| 64 | if (max_cpus > 1) { |
| 65 | shmobile_smp_prepare_cpus(); |
| 66 | |
| 67 | /* |
| 68 | * Enable the local timer or broadcast device for the |
| 69 | * boot CPU, but only if we have more than one CPU. |
| 70 | */ |
| 71 | percpu_timer_setup(); |
| 72 | } |
| 73 | } |