rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2012 Actions Semi Inc. |
| 3 | * Author: Actions Semi, Inc. |
| 4 | * |
| 5 | * Copyright (c) 2017 Andreas Färber |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the |
| 9 | * Free Software Foundation; either version 2 of the License, or (at your |
| 10 | * option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #include <linux/linkage.h> |
| 14 | #include <linux/init.h> |
| 15 | |
| 16 | ENTRY(owl_v7_invalidate_l1) |
| 17 | mov r0, #0 |
| 18 | mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache |
| 19 | mcr p15, 2, r0, c0, c0, 0 |
| 20 | mrc p15, 1, r0, c0, c0, 0 |
| 21 | |
| 22 | ldr r1, =0x7fff |
| 23 | and r2, r1, r0, lsr #13 |
| 24 | |
| 25 | ldr r1, =0x3ff |
| 26 | |
| 27 | and r3, r1, r0, lsr #3 @ NumWays - 1 |
| 28 | add r2, r2, #1 @ NumSets |
| 29 | |
| 30 | and r0, r0, #0x7 |
| 31 | add r0, r0, #4 @ SetShift |
| 32 | |
| 33 | clz r1, r3 @ WayShift |
| 34 | add r4, r3, #1 @ NumWays |
| 35 | 1: sub r2, r2, #1 @ NumSets-- |
| 36 | mov r3, r4 @ Temp = NumWays |
| 37 | 2: subs r3, r3, #1 @ Temp-- |
| 38 | mov r5, r3, lsl r1 |
| 39 | mov r6, r2, lsl r0 |
| 40 | orr r5, r5, r6 @ Reg = (Temp<<WayShift)|(NumSets<<SetShift) |
| 41 | mcr p15, 0, r5, c7, c6, 2 |
| 42 | bgt 2b |
| 43 | cmp r2, #0 |
| 44 | bgt 1b |
| 45 | dsb |
| 46 | isb |
| 47 | mov pc, lr |
| 48 | ENDPROC(owl_v7_invalidate_l1) |
| 49 | |
| 50 | ENTRY(owl_secondary_startup) |
| 51 | bl owl_v7_invalidate_l1 |
| 52 | b secondary_startup |