aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-sti
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-sti')
-rw-r--r--arch/arm/mach-sti/Kconfig45
-rw-r--r--arch/arm/mach-sti/Makefile2
-rw-r--r--arch/arm/mach-sti/board-dt.c48
-rw-r--r--arch/arm/mach-sti/headsmp.S44
-rw-r--r--arch/arm/mach-sti/platsmp.c117
-rw-r--r--arch/arm/mach-sti/smp.h17
6 files changed, 273 insertions, 0 deletions
diff --git a/arch/arm/mach-sti/Kconfig b/arch/arm/mach-sti/Kconfig
new file mode 100644
index 000000000000..d04e3bfe1918
--- /dev/null
+++ b/arch/arm/mach-sti/Kconfig
@@ -0,0 +1,45 @@
1menuconfig ARCH_STI
2 bool "STMicroelectronics Consumer Electronics SOCs with Device Trees" if ARCH_MULTI_V7
3 select GENERIC_CLOCKEVENTS
4 select CLKDEV_LOOKUP
5 select ARM_GIC
6 select ARM_GLOBAL_TIMER
7 select PINCTRL
8 select PINCTRL_ST
9 select MFD_SYSCON
10 select MIGHT_HAVE_CACHE_L2X0
11 select HAVE_SMP
12 select HAVE_ARM_SCU if SMP
13 select ARCH_REQUIRE_GPIOLIB
14 select ARM_ERRATA_720789
15 select ARM_ERRATA_754322
16 select PL310_ERRATA_753970 if CACHE_PL310
17 select PL310_ERRATA_769419 if CACHE_PL310
18 help
19 Include support for STiH41x SOCs like STiH415/416 using the device tree
20 for discovery
21 More information at Documentation/arm/STiH41x and
22 at Documentation/devicetree
23
24
25if ARCH_STI
26
27config SOC_STIH415
28 bool "STiH415 STMicroelectronics Consumer Electronics family"
29 default y
30 help
31 This enables support for STMicroelectronics Digital Consumer
32 Electronics family StiH415 parts, primarily targetted at set-top-box
33 and other digital audio/video applications using Flattned Device
34 Trees.
35
36config SOC_STIH416
37 bool "STiH416 STMicroelectronics Consumer Electronics family"
38 default y
39 help
40 This enables support for STMicroelectronics Digital Consumer
41 Electronics family StiH416 parts, primarily targetted at set-top-box
42 and other digital audio/video applications using Flattened Device
43 Trees.
44
45endif
diff --git a/arch/arm/mach-sti/Makefile b/arch/arm/mach-sti/Makefile
new file mode 100644
index 000000000000..acb330916333
--- /dev/null
+++ b/arch/arm/mach-sti/Makefile
@@ -0,0 +1,2 @@
1obj-$(CONFIG_SMP) += platsmp.o headsmp.o
2obj-$(CONFIG_ARCH_STI) += board-dt.o
diff --git a/arch/arm/mach-sti/board-dt.c b/arch/arm/mach-sti/board-dt.c
new file mode 100644
index 000000000000..8fe6f0c46480
--- /dev/null
+++ b/arch/arm/mach-sti/board-dt.c
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
3 * Author(s): Srinivas Kandagatla <srinivas.kandagatla@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/clk-provider.h>
11#include <linux/clocksource.h>
12#include <linux/irq.h>
13#include <asm/hardware/cache-l2x0.h>
14#include <asm/mach/arch.h>
15
16#include "smp.h"
17
18void __init stih41x_l2x0_init(void)
19{
20 u32 way_size = 0x4;
21 u32 aux_ctrl;
22 /* may be this can be encoded in macros like BIT*() */
23 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) |
24 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) |
25 (0x1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) |
26 (way_size << L2X0_AUX_CTRL_WAY_SIZE_SHIFT);
27
28 l2x0_of_init(aux_ctrl, L2X0_AUX_CTRL_MASK);
29}
30
31static void __init stih41x_timer_init(void)
32{
33 of_clk_init(NULL);
34 clocksource_of_init();
35 stih41x_l2x0_init();
36}
37
38static const char *stih41x_dt_match[] __initdata = {
39 "st,stih415",
40 "st,stih416",
41 NULL
42};
43
44DT_MACHINE_START(STM, "STiH415/416 SoC with Flattened Device Tree")
45 .init_time = stih41x_timer_init,
46 .smp = smp_ops(sti_smp_ops),
47 .dt_compat = stih41x_dt_match,
48MACHINE_END
diff --git a/arch/arm/mach-sti/headsmp.S b/arch/arm/mach-sti/headsmp.S
new file mode 100644
index 000000000000..78ebc7559f53
--- /dev/null
+++ b/arch/arm/mach-sti/headsmp.S
@@ -0,0 +1,44 @@
1/*
2 * arch/arm/mach-sti/headsmp.S
3 *
4 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
5 * http://www.st.com
6 *
7 * Cloned from linux/arch/arm/mach-vexpress/headsmp.S
8 *
9 * Copyright (c) 2003 ARM Limited
10 * All Rights Reserved
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16#include <linux/linkage.h>
17#include <linux/init.h>
18
19 __INIT
20
21/*
22 * ST specific entry point for secondary CPUs. This provides
23 * a "holding pen" into which all secondary cores are held until we're
24 * ready for them to initialise.
25 */
26ENTRY(sti_secondary_startup)
27 mrc p15, 0, r0, c0, c0, 5
28 and r0, r0, #15
29 adr r4, 1f
30 ldmia r4, {r5, r6}
31 sub r4, r4, r5
32 add r6, r6, r4
33pen: ldr r7, [r6]
34 cmp r7, r0
35 bne pen
36
37 /*
38 * we've been released from the holding pen: secondary_stack
39 * should now contain the SVC stack for this core
40 */
41 b secondary_startup
42
431: .long .
44 .long pen_release
diff --git a/arch/arm/mach-sti/platsmp.c b/arch/arm/mach-sti/platsmp.c
new file mode 100644
index 000000000000..977a863468fc
--- /dev/null
+++ b/arch/arm/mach-sti/platsmp.c
@@ -0,0 +1,117 @@
1/*
2 * arch/arm/mach-sti/platsmp.c
3 *
4 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
5 * http://www.st.com
6 *
7 * Cloned from linux/arch/arm/mach-vexpress/platsmp.c
8 *
9 * Copyright (C) 2002 ARM Ltd.
10 * All Rights Reserved
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16#include <linux/init.h>
17#include <linux/errno.h>
18#include <linux/delay.h>
19#include <linux/smp.h>
20#include <linux/io.h>
21#include <linux/of.h>
22#include <linux/of_address.h>
23
24#include <asm/cacheflush.h>
25#include <asm/smp_plat.h>
26#include <asm/smp_scu.h>
27
28#include "smp.h"
29
30static void __cpuinit write_pen_release(int val)
31{
32 pen_release = val;
33 smp_wmb();
34 __cpuc_flush_dcache_area((void *)&pen_release, sizeof(pen_release));
35 outer_clean_range(__pa(&pen_release), __pa(&pen_release + 1));
36}
37
38static DEFINE_SPINLOCK(boot_lock);
39
40void __cpuinit sti_secondary_init(unsigned int cpu)
41{
42 trace_hardirqs_off();
43
44 /*
45 * let the primary processor know we're out of the
46 * pen, then head off into the C entry point
47 */
48 write_pen_release(-1);
49
50 /*
51 * Synchronise with the boot thread.
52 */
53 spin_lock(&boot_lock);
54 spin_unlock(&boot_lock);
55}
56
57int __cpuinit sti_boot_secondary(unsigned int cpu, struct task_struct *idle)
58{
59 unsigned long timeout;
60
61 /*
62 * set synchronisation state between this boot processor
63 * and the secondary one
64 */
65 spin_lock(&boot_lock);
66
67 /*
68 * The secondary processor is waiting to be released from
69 * the holding pen - release it, then wait for it to flag
70 * that it has been released by resetting pen_release.
71 *
72 * Note that "pen_release" is the hardware CPU ID, whereas
73 * "cpu" is Linux's internal ID.
74 */
75 write_pen_release(cpu_logical_map(cpu));
76
77 /*
78 * Send the secondary CPU a soft interrupt, thereby causing
79 * it to jump to the secondary entrypoint.
80 */
81 arch_send_wakeup_ipi_mask(cpumask_of(cpu));
82
83 timeout = jiffies + (1 * HZ);
84 while (time_before(jiffies, timeout)) {
85 smp_rmb();
86 if (pen_release == -1)
87 break;
88
89 udelay(10);
90 }
91
92 /*
93 * now the secondary core is starting up let it run its
94 * calibrations, then wait for it to finish
95 */
96 spin_unlock(&boot_lock);
97
98 return pen_release != -1 ? -ENOSYS : 0;
99}
100
101void __init sti_smp_prepare_cpus(unsigned int max_cpus)
102{
103 void __iomem *scu_base = NULL;
104 struct device_node *np = of_find_compatible_node(
105 NULL, NULL, "arm,cortex-a9-scu");
106 if (np) {
107 scu_base = of_iomap(np, 0);
108 scu_enable(scu_base);
109 of_node_put(np);
110 }
111}
112
113struct smp_operations __initdata sti_smp_ops = {
114 .smp_prepare_cpus = sti_smp_prepare_cpus,
115 .smp_secondary_init = sti_secondary_init,
116 .smp_boot_secondary = sti_boot_secondary,
117};
diff --git a/arch/arm/mach-sti/smp.h b/arch/arm/mach-sti/smp.h
new file mode 100644
index 000000000000..1871b72b1a7e
--- /dev/null
+++ b/arch/arm/mach-sti/smp.h
@@ -0,0 +1,17 @@
1/*
2 * arch/arm/mach-sti/smp.h
3 *
4 * Copyright (C) 2013 STMicroelectronics (R&D) Limited.
5 * http://www.st.com
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 version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __MACH_STI_SMP_H
13#define __MACH_STI_SMP_H
14
15extern struct smp_operations sti_smp_ops;
16
17#endif