blob: fc4bba2902ad3d29ae814f0060f3d7d7a26937a8 [file] [log] [blame]
Thomas Gleixnerc942fdd2019-05-27 08:55:06 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Tsahee Zidenberge9e06f22015-03-12 13:53:06 +02002/*
3 * SMP operations for Alpine platform.
4 *
5 * Copyright (C) 2015 Annapurna Labs Ltd.
Tsahee Zidenberge9e06f22015-03-12 13:53:06 +02006 */
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
17static int alpine_boot_secondary(unsigned int cpu, struct task_struct *idle)
18{
19 phys_addr_t addr;
20
Florian Fainelli64fc2a92017-01-15 03:59:29 +010021 addr = __pa_symbol(secondary_startup);
Tsahee Zidenberge9e06f22015-03-12 13:53:06 +020022
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
31static void __init alpine_smp_prepare_cpus(unsigned int max_cpus)
32{
33 alpine_cpu_pm_init();
34}
35
Masahiro Yamada75305272015-11-15 10:39:53 +090036static const struct smp_operations alpine_smp_ops __initconst = {
Tsahee Zidenberge9e06f22015-03-12 13:53:06 +020037 .smp_prepare_cpus = alpine_smp_prepare_cpus,
38 .smp_boot_secondary = alpine_boot_secondary,
39};
40CPU_METHOD_OF_DECLARE(alpine_smp, "al,alpine-smp", &alpine_smp_ops);