1
2
3
4
5
6
7
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/smp.h>
11#include <linux/io.h>
12#include <linux/delay.h>
13
14#include <asm/smp_plat.h>
15
16#include "common.h"
17#include "sh73a0.h"
18
19#define CPG_BASE2 0xe6151000
20#define WUPCR 0x10
21#define SRESCR 0x18
22#define PSTR 0x40
23
24#define SYSC_BASE 0xe6180000
25#define SBAR 0x20
26
27#define AP_BASE 0xe6f10000
28#define APARMBAREA 0x20
29
30#define SH73A0_SCU_BASE 0xf0000000
31
32static int sh73a0_boot_secondary(unsigned int cpu, struct task_struct *idle)
33{
34 unsigned int lcpu = cpu_logical_map(cpu);
35 void __iomem *cpg2 = ioremap(CPG_BASE2, PAGE_SIZE);
36
37 if (((readl(cpg2 + PSTR) >> (4 * lcpu)) & 3) == 3)
38 writel(1 << lcpu, cpg2 + WUPCR);
39 else
40 writel(1 << lcpu, cpg2 + SRESCR);
41 iounmap(cpg2);
42 return 0;
43}
44
45static void __init sh73a0_smp_prepare_cpus(unsigned int max_cpus)
46{
47 void __iomem *ap = ioremap(AP_BASE, PAGE_SIZE);
48 void __iomem *sysc = ioremap(SYSC_BASE, PAGE_SIZE);
49
50
51 writel(0, ap + APARMBAREA);
52 writel(__pa(shmobile_boot_vector), sysc + SBAR);
53 iounmap(sysc);
54 iounmap(ap);
55
56
57 shmobile_smp_scu_prepare_cpus(SH73A0_SCU_BASE, max_cpus);
58}
59
60const struct smp_operations sh73a0_smp_ops __initconst = {
61 .smp_prepare_cpus = sh73a0_smp_prepare_cpus,
62 .smp_boot_secondary = sh73a0_boot_secondary,
63#ifdef CONFIG_HOTPLUG_CPU
64 .cpu_can_disable = shmobile_smp_cpu_can_disable,
65 .cpu_die = shmobile_smp_scu_cpu_die,
66 .cpu_kill = shmobile_smp_scu_cpu_kill,
67#endif
68};
69