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> |
Magnus Damm | cc61591 | 2013-08-01 03:38:18 +0900 | [diff] [blame] | 14 | #include <asm/cacheflush.h> |
| 15 | #include <asm/smp_plat.h> |
Magnus Damm | fd44aa5 | 2014-06-17 16:47:37 +0900 | [diff] [blame] | 16 | #include "common.h" |
Magnus Damm | 1c51ed4 | 2010-12-14 16:56:55 +0900 | [diff] [blame] | 17 | |
Magnus Damm | cc61591 | 2013-08-01 03:38:18 +0900 | [diff] [blame] | 18 | extern unsigned long shmobile_smp_fn[]; |
| 19 | extern unsigned long shmobile_smp_arg[]; |
| 20 | extern unsigned long shmobile_smp_mpidr[]; |
| 21 | |
| 22 | void shmobile_smp_hook(unsigned int cpu, unsigned long fn, unsigned long arg) |
| 23 | { |
| 24 | shmobile_smp_fn[cpu] = 0; |
| 25 | flush_cache_all(); |
| 26 | |
| 27 | shmobile_smp_mpidr[cpu] = cpu_logical_map(cpu); |
| 28 | shmobile_smp_fn[cpu] = fn; |
| 29 | shmobile_smp_arg[cpu] = arg; |
| 30 | flush_cache_all(); |
| 31 | } |
Magnus Damm | 5c4dfcd | 2013-08-08 07:13:30 +0900 | [diff] [blame] | 32 | |
| 33 | #ifdef CONFIG_HOTPLUG_CPU |
Stephen Boyd | 787047e | 2015-07-29 00:34:48 +0100 | [diff] [blame] | 34 | bool shmobile_smp_cpu_can_disable(unsigned int cpu) |
Magnus Damm | 5c4dfcd | 2013-08-08 07:13:30 +0900 | [diff] [blame] | 35 | { |
Stephen Boyd | 787047e | 2015-07-29 00:34:48 +0100 | [diff] [blame] | 36 | return true; /* Hotplug of any CPU is supported */ |
Magnus Damm | 5c4dfcd | 2013-08-08 07:13:30 +0900 | [diff] [blame] | 37 | } |
| 38 | #endif |
Magnus Damm | c21af44 | 2016-06-28 16:10:37 +0200 | [diff] [blame] | 39 | |
| 40 | bool __init shmobile_smp_init_fallback_ops(void) |
| 41 | { |
| 42 | /* fallback on PSCI/smp_ops if no other DT based method is detected */ |
| 43 | return platform_can_secondary_boot() ? true : false; |
| 44 | } |