mtd: nand: omap: Fix comment in platform data using wrong Kconfig symbol
[linux/fpc-iii.git] / arch / arm / mach-oxnas / platsmp.c
blob735141c0e3a377275f3c241f8dc181edee2c2c98
1 /*
2 * Copyright (C) 2016 Neil Armstrong <narmstrong@baylibre.com>
3 * Copyright (C) 2013 Ma Haijun <mahaijuns@gmail.com>
4 * Copyright (C) 2002 ARM Ltd.
5 * All Rights Reserved
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #include <linux/io.h>
12 #include <linux/delay.h>
13 #include <linux/of.h>
14 #include <linux/of_address.h>
16 #include <asm/cacheflush.h>
17 #include <asm/cp15.h>
18 #include <asm/smp_plat.h>
19 #include <asm/smp_scu.h>
21 extern void ox820_secondary_startup(void);
23 static void __iomem *cpu_ctrl;
24 static void __iomem *gic_cpu_ctrl;
26 #define HOLDINGPEN_CPU_OFFSET 0xc8
27 #define HOLDINGPEN_LOCATION_OFFSET 0xc4
29 #define GIC_NCPU_OFFSET(cpu) (0x100 + (cpu)*0x100)
30 #define GIC_CPU_CTRL 0x00
31 #define GIC_CPU_CTRL_ENABLE 1
33 int __init ox820_boot_secondary(unsigned int cpu, struct task_struct *idle)
36 * Write the address of secondary startup into the
37 * system-wide flags register. The BootMonitor waits
38 * until it receives a soft interrupt, and then the
39 * secondary CPU branches to this address.
41 writel(virt_to_phys(ox820_secondary_startup),
42 cpu_ctrl + HOLDINGPEN_LOCATION_OFFSET);
44 writel(cpu, cpu_ctrl + HOLDINGPEN_CPU_OFFSET);
47 * Enable GIC cpu interface in CPU Interface Control Register
49 writel(GIC_CPU_CTRL_ENABLE,
50 gic_cpu_ctrl + GIC_NCPU_OFFSET(cpu) + GIC_CPU_CTRL);
53 * Send the secondary CPU a soft interrupt, thereby causing
54 * the boot monitor to read the system wide flags register,
55 * and branch to the address found there.
57 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
59 return 0;
62 static void __init ox820_smp_prepare_cpus(unsigned int max_cpus)
64 struct device_node *np;
65 void __iomem *scu_base;
67 np = of_find_compatible_node(NULL, NULL, "arm,arm11mp-scu");
68 scu_base = of_iomap(np, 0);
69 of_node_put(np);
70 if (!scu_base)
71 return;
73 /* Remap CPU Interrupt Interface Registers */
74 np = of_find_compatible_node(NULL, NULL, "arm,arm11mp-gic");
75 gic_cpu_ctrl = of_iomap(np, 1);
76 of_node_put(np);
77 if (!gic_cpu_ctrl)
78 goto unmap_scu;
80 np = of_find_compatible_node(NULL, NULL, "oxsemi,ox820-sys-ctrl");
81 cpu_ctrl = of_iomap(np, 0);
82 of_node_put(np);
83 if (!cpu_ctrl)
84 goto unmap_scu;
86 scu_enable(scu_base);
87 flush_cache_all();
89 unmap_scu:
90 iounmap(scu_base);
93 static const struct smp_operations ox820_smp_ops __initconst = {
94 .smp_prepare_cpus = ox820_smp_prepare_cpus,
95 .smp_boot_secondary = ox820_boot_secondary,
98 CPU_METHOD_OF_DECLARE(ox820_smp, "oxsemi,ox820-smp", &ox820_smp_ops);