Thomas Gleixner | c942fdd | 2019-05-27 08:55:06 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Tsahee Zidenberg | e9e06f2 | 2015-03-12 13:53:06 +0200 | [diff] [blame] | 2 | /* |
| 3 | * SMP operations for Alpine platform. |
| 4 | * |
| 5 | * Copyright (C) 2015 Annapurna Labs Ltd. |
Tsahee Zidenberg | e9e06f2 | 2015-03-12 13:53:06 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <linux/init.h> |
| 9 | #include <linux/errno.h> |
| 10 | #include <linux/io.h> |
| 11 | #include <linux/of.h> |
| 12 | |
| 13 | #include <asm/smp_plat.h> |
| 14 | |
| 15 | #include "alpine_cpu_pm.h" |
| 16 | |
| 17 | static int alpine_boot_secondary(unsigned int cpu, struct task_struct *idle) |
| 18 | { |
| 19 | phys_addr_t addr; |
| 20 | |
Florian Fainelli | 64fc2a9 | 2017-01-15 03:59:29 +0100 | [diff] [blame] | 21 | addr = __pa_symbol(secondary_startup); |
Tsahee Zidenberg | e9e06f2 | 2015-03-12 13:53:06 +0200 | [diff] [blame] | 22 | |
| 23 | if (addr > (phys_addr_t)(uint32_t)(-1)) { |
| 24 | pr_err("FAIL: resume address over 32bit (%pa)", &addr); |
| 25 | return -EINVAL; |
| 26 | } |
| 27 | |
| 28 | return alpine_cpu_wakeup(cpu_logical_map(cpu), (uint32_t)addr); |
| 29 | } |
| 30 | |
| 31 | static void __init alpine_smp_prepare_cpus(unsigned int max_cpus) |
| 32 | { |
| 33 | alpine_cpu_pm_init(); |
| 34 | } |
| 35 | |
Masahiro Yamada | 7530527 | 2015-11-15 10:39:53 +0900 | [diff] [blame] | 36 | static const struct smp_operations alpine_smp_ops __initconst = { |
Tsahee Zidenberg | e9e06f2 | 2015-03-12 13:53:06 +0200 | [diff] [blame] | 37 | .smp_prepare_cpus = alpine_smp_prepare_cpus, |
| 38 | .smp_boot_secondary = alpine_boot_secondary, |
| 39 | }; |
| 40 | CPU_METHOD_OF_DECLARE(alpine_smp, "al,alpine-smp", &alpine_smp_ops); |