Update from product codes
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / platform / sprd / headsmp.S
1 /*
2  *  linux/arch/arm/mach-sc/headsmp.S
3  *
4  *
5  *  Copyright (c) 2003 ARM Limited
6  *  All Rights Reserved
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12 #include <linux/linkage.h>
13 #include <linux/init.h>
14
15         __CPUINIT
16
17 /*
18  * sci smp specific entry point for secondary CPUs.
19  * This provides a "holding pen" into which all secondary cores are held
20  * until we're ready for them to initialise.
21  */
22 ENTRY(sci_secondary_startup)
23         mrc     p15, 0, r0, c0, c0, 5
24 #ifndef CONFIG_OF
25         and     r0, r0, #15
26 #else
27         /*and   r0, r0, #0xFFFFFF*/ /* mpidr is 0xf00 0xf01, 0xf02, 0xf03 */
28         and     r0, r0, #15 /* mpidr is 0xf00 0xf01, 0xf02, 0xf03 */
29 #endif
30         adr     r4, 1f
31         ldmia   r4, {r5, r6}
32         sub     r4, r4, r5
33         add     r6, r6, r4
34 pen:    ldr     r7, [r6]
35         and     r7, r7, #15/* mpidr is 0xf00 0xf01, 0xf02, 0xf03 */
36         cmp     r7, r0
37         bne     pen
38
39         /*
40          * we've been released from the holding pen: secondary_stack
41          * should now contain the SVC stack for this core
42          */
43         b       secondary_startup
44
45         .align
46 1:      .long   .
47         .long   pen_release
48
49 ENTRY(sci_shark_enter_lowpower)
50         stmfd   sp!, {r4-r12, lr}
51
52         mrc     p15, 0, r1, c1, c0, 0
53         bic     r0, r1, #(1 << 2)               @disable d-cache
54         mcr     p15, 0, r0, c1, c0, 0
55
56         bl      v7_flush_dcache_louis
57
58         clrex
59
60         mrc     p15, 0, r1, c1, c0, 1
61         bic     r1, r1, #(1 << 6)
62         mcr     p15, 0, r1, c1, c0, 1
63
64         isb
65         dsb
66         nop
67         nop
68         nop
69         nop
70         nop
71         nop
72
73 2:      wfi
74         wfi
75         wfi
76         wfi
77         wfi
78         wfi
79         wfi
80         wfi
81         wfi
82         wfi
83         wfi
84         wfi
85         wfi
86         wfi
87         wfi
88         wfi
89         b 2b
90
91         nop
92         nop
93         nop
94         nop
95         nop
96         nop
97         nop
98 1:      b 1b
99         ldmfd   sp!, {r4-r12, pc}
100 ENDPROC(sci_shark_enter_lowpower)