Commit | Line | Data |
---|---|---|
72f4d579 MD |
1 | /* |
2 | * SMP support for R-Mobile / SH-Mobile - sh73a0 portion | |
3 | * | |
4 | * Copyright (C) 2010 Magnus Damm | |
5 | * Copyright (C) 2010 Takashi Yoshii | |
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. | |
72f4d579 MD |
15 | */ |
16 | #include <linux/kernel.h> | |
17 | #include <linux/init.h> | |
18 | #include <linux/smp.h> | |
72f4d579 | 19 | #include <linux/io.h> |
a62580e5 | 20 | #include <linux/delay.h> |
ded59d6d | 21 | |
352e57a3 | 22 | #include <asm/smp_plat.h> |
72f4d579 | 23 | #include <asm/smp_twd.h> |
ded59d6d | 24 | |
fd44aa5e | 25 | #include "common.h" |
ded59d6d | 26 | #include "sh73a0.h" |
72f4d579 | 27 | |
a2a47ca3 RH |
28 | #define WUPCR IOMEM(0xe6151010) |
29 | #define SRESCR IOMEM(0xe6151018) | |
30 | #define PSTR IOMEM(0xe6151040) | |
31 | #define SBAR IOMEM(0xe6180020) | |
32 | #define APARMBAREA IOMEM(0xe6f10020) | |
72f4d579 | 33 | |
76853504 | 34 | #define SH73A0_SCU_BASE 0xf0000000 |
aa8d3bb1 | 35 | |
8bd26e3a | 36 | static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle) |
72f4d579 | 37 | { |
12eb8474 | 38 | unsigned int lcpu = cpu_logical_map(cpu); |
12eb8474 MD |
39 | |
40 | if (((__raw_readl(PSTR) >> (4 * lcpu)) & 3) == 3) | |
41 | __raw_writel(1 << lcpu, WUPCR); /* wake up */ | |
72f4d579 | 42 | else |
12eb8474 | 43 | __raw_writel(1 << lcpu, SRESCR); /* reset */ |
72f4d579 MD |
44 | |
45 | return 0; | |
46 | } | |
47 | ||
a62580e5 | 48 | static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus) |
72f4d579 | 49 | { |
12eb8474 | 50 | /* Map the reset vector (in headsmp.S) */ |
a2a47ca3 | 51 | __raw_writel(0, APARMBAREA); /* 4k */ |
abfa04eb | 52 | __raw_writel(__pa(shmobile_boot_vector), SBAR); |
72f4d579 | 53 | |
12eb8474 | 54 | /* setup sh73a0 specific SCU bits */ |
8701d808 | 55 | shmobile_smp_scu_prepare_cpus(SH73A0_SCU_BASE, max_cpus); |
72f4d579 | 56 | } |
a62580e5 | 57 | |
75305275 | 58 | const struct smp_operations sh73a0_smp_ops __initconst = { |
a62580e5 | 59 | .smp_prepare_cpus = sh73a0_smp_prepare_cpus, |
a62580e5 MZ |
60 | .smp_boot_secondary = sh73a0_boot_secondary, |
61 | #ifdef CONFIG_HOTPLUG_CPU | |
787047ee | 62 | .cpu_can_disable = shmobile_smp_cpu_can_disable, |
352e57a3 MD |
63 | .cpu_die = shmobile_smp_scu_cpu_die, |
64 | .cpu_kill = shmobile_smp_scu_cpu_kill, | |
a62580e5 MZ |
65 | #endif |
66 | }; |