blob: 3853ecea44ca021c533c0168ce38d0889dfe412c [file] [log] [blame]
Wolfram Sangc44e1822018-06-14 10:56:06 +09001// SPDX-License-Identifier: GPL-2.0
Magnus Dammbd5a8752012-05-16 15:45:25 +09002/*
3 * SMP support for Emma Mobile EV2
4 *
5 * Copyright (C) 2012 Renesas Solutions Corp.
6 * Copyright (C) 2012 Magnus Damm
Magnus Dammbd5a8752012-05-16 15:45:25 +09007 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/smp.h>
11#include <linux/spinlock.h>
12#include <linux/io.h>
13#include <linux/delay.h>
Magnus Dammbd5a8752012-05-16 15:45:25 +090014#include <asm/smp_plat.h>
15#include <asm/smp_scu.h>
Geert Uytterhoevenc58b31a2016-01-28 16:20:49 +010016
Magnus Dammfd44aa52014-06-17 16:47:37 +090017#include "common.h"
Geert Uytterhoevenc58b31a2016-01-28 16:20:49 +010018#include "emev2.h"
Magnus Dammbd5a8752012-05-16 15:45:25 +090019
20#define EMEV2_SCU_BASE 0x1e000000
Magnus Damm8d7217e2013-07-02 18:28:30 +090021#define EMEV2_SMU_BASE 0xe0110000
22#define SMU_GENERAL_REG0 0x7c0
Magnus Dammbd5a8752012-05-16 15:45:25 +090023
Paul Gortmaker8bd26e32013-06-17 15:43:14 -040024static int emev2_boot_secondary(unsigned int cpu, struct task_struct *idle)
Magnus Dammbd5a8752012-05-16 15:45:25 +090025{
Magnus Damm1af4b3f2013-02-13 22:47:27 +090026 arch_send_wakeup_ipi_mask(cpumask_of(cpu_logical_map(cpu)));
Magnus Dammbd5a8752012-05-16 15:45:25 +090027 return 0;
28}
29
Marc Zyngiera62580e2011-09-08 13:15:22 +010030static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
Magnus Dammbd5a8752012-05-16 15:45:25 +090031{
Magnus Damm8d7217e2013-07-02 18:28:30 +090032 void __iomem *smu;
33
Magnus Damm0da60222013-07-31 16:07:40 +090034 /* Tell ROM loader about our vector (in headsmp.S) */
Magnus Damm8d7217e2013-07-02 18:28:30 +090035 smu = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
36 if (smu) {
37 iowrite32(__pa(shmobile_boot_vector), smu + SMU_GENERAL_REG0);
38 iounmap(smu);
39 }
Magnus Dammda252b82013-02-13 00:45:06 +090040
Magnus Damm0da60222013-07-31 16:07:40 +090041 /* setup EMEV2 specific SCU bits */
Geert Uytterhoeven8701d802016-01-28 16:13:32 +010042 shmobile_smp_scu_prepare_cpus(EMEV2_SCU_BASE, max_cpus);
Magnus Dammbd5a8752012-05-16 15:45:25 +090043}
Marc Zyngiera62580e2011-09-08 13:15:22 +010044
Masahiro Yamada75305272015-11-15 10:39:53 +090045const struct smp_operations emev2_smp_ops __initconst = {
Marc Zyngiera62580e2011-09-08 13:15:22 +010046 .smp_prepare_cpus = emev2_smp_prepare_cpus,
Marc Zyngiera62580e2011-09-08 13:15:22 +010047 .smp_boot_secondary = emev2_boot_secondary,
Marc Zyngiera62580e2011-09-08 13:15:22 +010048};