blob: b2834810b02b4bd3a6eea454c433b7fabab24523 [file] [log] [blame]
Colin Cross1cea7322010-02-21 17:46:23 -08001#include <linux/linkage.h>
2#include <linux/init.h>
3
Joseph Loc2be5bf2012-08-16 17:31:50 +08004#include "sleep.h"
Peter De Schrijverb36ab972012-02-10 01:47:45 +02005
Colin Cross1cea7322010-02-21 17:46:23 -08006 .section ".text.head", "ax"
Joseph Lo9e323662013-01-04 17:32:22 +08007
Colin Cross1cea7322010-02-21 17:46:23 -08008/*
9 * Tegra specific entry point for secondary CPUs.
10 * The secondary kernel init calls v7_flush_dcache_all before it enables
11 * the L1; however, the L1 comes out of reset in an undefined state, so
12 * the clean + invalidate performed by v7_flush_dcache_all causes a bunch
13 * of cache lines with uninitialized data and uninitialized tags to get
14 * written out to memory, which does really unpleasant things to the main
15 * processor. We fix this by performing an invalidate, rather than a
16 * clean + invalidate, before jumping into the kernel.
17 */
18ENTRY(v7_invalidate_l1)
19 mov r0, #0
20 mcr p15, 2, r0, c0, c0, 0
21 mrc p15, 1, r0, c0, c0, 0
22
23 ldr r1, =0x7fff
24 and r2, r1, r0, lsr #13
25
26 ldr r1, =0x3ff
27
28 and r3, r1, r0, lsr #3 @ NumWays - 1
29 add r2, r2, #1 @ NumSets
30
31 and r0, r0, #0x7
32 add r0, r0, #4 @ SetShift
33
34 clz r1, r3 @ WayShift
35 add r4, r3, #1 @ NumWays
361: sub r2, r2, #1 @ NumSets--
37 mov r3, r4 @ Temp = NumWays
382: subs r3, r3, #1 @ Temp--
39 mov r5, r3, lsl r1
40 mov r6, r2, lsl r0
41 orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift)
42 mcr p15, 0, r5, c7, c6, 2
43 bgt 2b
44 cmp r2, #0
45 bgt 1b
46 dsb
47 isb
48 mov pc, lr
49ENDPROC(v7_invalidate_l1)
50
51ENTRY(tegra_secondary_startup)
Colin Cross1cea7322010-02-21 17:46:23 -080052 bl v7_invalidate_l1
Peter De Schrijverb36ab972012-02-10 01:47:45 +020053 /* Enable coresight */
54 mov32 r0, 0xC5ACCE55
55 mcr p14, 0, r0, c7, c12, 6
Colin Cross1cea7322010-02-21 17:46:23 -080056 b secondary_startup
57ENDPROC(tegra_secondary_startup)