ARM: shmobile: Separate APMU resource data into CPU dependant part
[deliverable/linux.git] / arch / arm / mach-shmobile / smp-r8a7791.c
CommitLineData
687c27b0
MD
1/*
2 * SMP support for r8a7791
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/io.h>
5201b5a7 20
687c27b0 21#include <asm/smp_plat.h>
5201b5a7 22
fd44aa5e 23#include "common.h"
a8d2ff39 24#include "platsmp-apmu.h"
5201b5a7 25#include "r8a7791.h"
62872989 26#include "rcar-gen2.h"
687c27b0 27
a8d2ff39
HN
28static struct rcar_apmu_config r8a7791_apmu_config[] = {
29 {
30 .iomem = DEFINE_RES_MEM(0xe6152000, 0x88),
31 .cpus = { 0, 1, 2, 3 },
32 },
33 {
34 .iomem = DEFINE_RES_MEM(0xe6151000, 0x88),
35 .cpus = { 0x100, 0x0101, 0x102, 0x103 },
36 }
37};
38
687c27b0
MD
39static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
40{
687c27b0 41 /* let APMU code install data related to shmobile_boot_vector */
a8d2ff39
HN
42 shmobile_smp_apmu_prepare_cpus(max_cpus,
43 r8a7791_apmu_config,
44 ARRAY_SIZE(r8a7791_apmu_config));
687c27b0 45
5f6108bb 46 r8a7791_pm_init();
687c27b0
MD
47}
48
277efd30
MD
49static int r8a7791_smp_boot_secondary(unsigned int cpu,
50 struct task_struct *idle)
51{
52 /* Error out when hardware debug mode is enabled */
53 if (rcar_gen2_read_mode_pins() & BIT(21)) {
54 pr_warn("Unable to boot CPU%u when MD21 is set\n", cpu);
55 return -ENOTSUPP;
56 }
57
58 return shmobile_smp_apmu_boot_secondary(cpu, idle);
59}
60
687c27b0
MD
61struct smp_operations r8a7791_smp_ops __initdata = {
62 .smp_prepare_cpus = r8a7791_smp_prepare_cpus,
277efd30 63 .smp_boot_secondary = r8a7791_smp_boot_secondary,
687c27b0
MD
64#ifdef CONFIG_HOTPLUG_CPU
65 .cpu_disable = shmobile_smp_cpu_disable,
66 .cpu_die = shmobile_smp_apmu_cpu_die,
67 .cpu_kill = shmobile_smp_apmu_cpu_kill,
68#endif
69};
This page took 0.125715 seconds and 5 git commands to generate.