aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-04-05 06:39:57 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-05-29 19:49:01 -0400
commitde7e75326c05c10ebd96aed9440c870f0ff1e34f (patch)
treeab355bd6cbca63d6e0eccb565485e6fff24762b9 /arch/arm/mm
parent805604ef8596968e5f251c69fd92bd3b8f466317 (diff)
ARM: l2c: provide common PL310 early resume code
Provide a common assembly implementation for PL310 resume code. Certain platforms need to re-initialise the L2C cache early as it may preserve data across a S2RAM cycle, and therefore must be enabled along with the L1 cache and MMU. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/Makefile2
-rw-r--r--arch/arm/mm/l2c-l2x0-resume.S58
2 files changed, 59 insertions, 1 deletions
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index de5a6a27081b..91da64de440f 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -97,6 +97,6 @@ AFLAGS_proc-v7.o :=-Wa,-march=armv7-a
97 97
98obj-$(CONFIG_OUTER_CACHE) += l2c-common.o 98obj-$(CONFIG_OUTER_CACHE) += l2c-common.o
99obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o 99obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o
100obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 100obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o l2c-l2x0-resume.o
101obj-$(CONFIG_CACHE_XSC3L2) += cache-xsc3l2.o 101obj-$(CONFIG_CACHE_XSC3L2) += cache-xsc3l2.o
102obj-$(CONFIG_CACHE_TAUROS2) += cache-tauros2.o 102obj-$(CONFIG_CACHE_TAUROS2) += cache-tauros2.o
diff --git a/arch/arm/mm/l2c-l2x0-resume.S b/arch/arm/mm/l2c-l2x0-resume.S
new file mode 100644
index 000000000000..99b05f21a59a
--- /dev/null
+++ b/arch/arm/mm/l2c-l2x0-resume.S
@@ -0,0 +1,58 @@
1/*
2 * L2C-310 early resume code. This can be used by platforms to restore
3 * the settings of their L2 cache controller before restoring the
4 * processor state.
5 *
6 * This code can only be used to if you are running in the secure world.
7 */
8#include <linux/linkage.h>
9#include <asm/hardware/cache-l2x0.h>
10
11 .text
12
13ENTRY(l2c310_early_resume)
14 adr r0, 1f
15 ldr r2, [r0]
16 add r0, r2, r0
17
18 ldmia r0, {r1, r2, r3, r4, r5, r6, r7, r8}
19 @ r1 = phys address of L2C-310 controller
20 @ r2 = aux_ctrl
21 @ r3 = tag_latency
22 @ r4 = data_latency
23 @ r5 = filter_start
24 @ r6 = filter_end
25 @ r7 = prefetch_ctrl
26 @ r8 = pwr_ctrl
27
28 @ Check that the address has been initialised
29 teq r1, #0
30 moveq pc, lr
31
32 @ The prefetch and power control registers are revision dependent
33 @ and can be written whether or not the L2 cache is enabled
34 ldr r0, [r1, #L2X0_CACHE_ID]
35 and r0, r0, #L2X0_CACHE_ID_RTL_MASK
36 cmp r0, #L310_CACHE_ID_RTL_R2P0
37 strcs r7, [r1, #L310_PREFETCH_CTRL]
38 cmp r0, #L310_CACHE_ID_RTL_R3P0
39 strcs r8, [r1, #L310_POWER_CTRL]
40
41 @ Don't setup the L2 cache if it is already enabled
42 ldr r0, [r1, #L2X0_CTRL]
43 tst r0, #L2X0_CTRL_EN
44 movne pc, lr
45
46 str r3, [r1, #L310_TAG_LATENCY_CTRL]
47 str r4, [r1, #L310_DATA_LATENCY_CTRL]
48 str r6, [r1, #L310_ADDR_FILTER_END]
49 str r5, [r1, #L310_ADDR_FILTER_START]
50
51 str r2, [r1, #L2X0_AUX_CTRL]
52 mov r9, #L2X0_CTRL_EN
53 str r9, [r1, #L2X0_CTRL]
54 mov pc, lr
55ENDPROC(l2c310_early_resume)
56
57 .align
581: .long l2x0_saved_regs - .