Merge branches 'for-4.16/upstream' and 'for-4.15/upstream-fixes' into for-linus
[sfrench/cifs-2.6.git] / arch / arm / mach-shmobile / headsmp-apmu.S
1 /*
2  * SMP support for APMU based systems with Cortex A7/A15
3  *
4  * Copyright (C) 2014  Renesas Electronics Corporation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #include <linux/linkage.h>
12 #include <asm/assembler.h>
13
14 ENTRY(shmobile_init_cntvoff)
15         /*
16          * CNTVOFF has to be initialized either from non-secure Hypervisor
17          * mode or secure Monitor mode with SCR.NS==1. If TrustZone is enabled
18          * then it should be handled by the secure code
19          */
20         cps     #MON_MODE
21         mrc     p15, 0, r1, c1, c1, 0           /* Get Secure Config */
22         orr     r0, r1, #1
23         mcr     p15, 0, r0, c1, c1, 0           /* Set Non Secure bit */
24         instr_sync
25         mov     r0, #0
26         mcrr    p15, 4, r0, r0, c14             /* CNTVOFF = 0 */
27         instr_sync
28         mcr     p15, 0, r1, c1, c1, 0           /* Set Secure bit */
29         instr_sync
30         cps     #SVC_MODE
31         ret     lr
32 ENDPROC(shmobile_init_cntvoff)
33
34 #ifdef CONFIG_SMP
35 ENTRY(shmobile_boot_apmu)
36         bl      shmobile_init_cntvoff
37         b       secondary_startup
38 ENDPROC(shmobile_boot_apmu)
39 #endif