Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 1 | #include <linux/linkage.h> |
| 2 | #include <linux/init.h> |
| 3 | |
Joseph Lo | c2be5bf | 2012-08-16 17:31:50 +0800 | [diff] [blame] | 4 | #include "sleep.h" |
Peter De Schrijver | b36ab97 | 2012-02-10 01:47:45 +0200 | [diff] [blame] | 5 | |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 6 | .section ".text.head", "ax" |
Joseph Lo | 9e32366 | 2013-01-04 17:32:22 +0800 | [diff] [blame^] | 7 | |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 8 | /* |
| 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 | */ |
| 18 | ENTRY(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 |
| 36 | 1: sub r2, r2, #1 @ NumSets-- |
| 37 | mov r3, r4 @ Temp = NumWays |
| 38 | 2: 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 |
| 49 | ENDPROC(v7_invalidate_l1) |
| 50 | |
| 51 | ENTRY(tegra_secondary_startup) |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 52 | bl v7_invalidate_l1 |
Peter De Schrijver | b36ab97 | 2012-02-10 01:47:45 +0200 | [diff] [blame] | 53 | /* Enable coresight */ |
| 54 | mov32 r0, 0xC5ACCE55 |
| 55 | mcr p14, 0, r0, c7, c12, 6 |
Colin Cross | 1cea732 | 2010-02-21 17:46:23 -0800 | [diff] [blame] | 56 | b secondary_startup |
| 57 | ENDPROC(tegra_secondary_startup) |