2 * Platform-specific assembly head
3 * intended to perform whatever fixup is needed
4 * adter the boot loader.
5 * Also includes the secondary entry point for SMP.
9 #include <linux/linkage.h>
10 #include <linux/init.h>
12 #include <asm/assembler.h>
13 #include <asm/system.h>
14 #include <asm/memory.h>
15 #include <asm/mach-types.h>
16 #include <plat/plat-bcm5301x.h>
17 #include <armca9_core.h>
19 #ifndef CONFIG_DEBUG_LL
30 * This is called from head.S at the beginning.
31 * If the boot monitor provides corect r1, r2 values
32 * then these need to be preserved.
34 * On return, the requirements are:
35 * MMU = off, D-cache = off, I-cache = dont care,
36 * r0 = 0, r1 = machine nr, r2 = atags pointer, or 0.
39 ENTRY(__mach_head_fixup)
40 mov r12,lr @ save return address
41 @ Disable d-chace and MMU for UART to work for sure
42 mrc p15, 0, r0, c1, c0, 0 @ Read SCTLR
44 mcr p15, 0, r0, c1, c0, 0 @ Write SCTLR
45 /* Clean up any residule in caches */
46 bl v7_all_dcache_invalidate
50 ldr r3, =L2CC_BASE_PA @ L2 cache controller, control reg
51 str r0, [r3, #0x100] @ Disable L2 cache
53 str r0, [r3, #0x77c] @ Invalidate by all Ways
57 /* fixup MaskROM LUT holding pen */
58 ldr r1, =SOC_ROM_BASE_PA
60 str r0, [r1, #SOC_ROM_LUT_OFF]
63 /* disable CCU clock gating */
64 ldr r0,=IHOST_PROC_CLK_CORE0_CLKGATE
67 ldr r0,=IHOST_PROC_CLK_CORE1_CLKGATE
70 ldr r0,=IHOST_PROC_CLK_ARM_SWITCH_CLKGATE
72 ldr r0,=IHOST_PROC_CLK_ARM_PERIPH_CLKGATE
74 ldr r0,=IHOST_PROC_CLK_APB0_CLKGATE
78 #ifndef CONFIG_XIP_KERNEL
79 /* Copy ourselves to RAM if loaded in wrong address */
90 mov r12, r9 @ start again in RAM
91 #ifdef CONFIG_SPARSEMEM
92 ldr r0, =(PAGE_OFFSET+SZ_128M)
101 ldr r0, =PHYS_OFFSET2
105 ldr r10, =__virt_to_phys(__bss_start)
123 ldmia r8!, { r0 - r7 }
124 stmia r9!, { r0 - r7 }
144 #endif /* !CONFIG_XIP_KERNEL */
150 ldr r6,[r3,#0x3c] /* Save the value in r6 */
157 ldr r7,[r4,#0x3c] /* Save the value in r7 */
159 ldr r1,[r4,#0x3c] /* Read back to ensure completion */
161 str r7,[r4,#0x3c] /* Restore the value from r7 */
169 /* Didn't find an alias, must be 128MB */
171 str r6,[r3,#0x3c] /* Restore the value from r6 */
172 adr r7,__mach_head_fixup
173 ldr r8,=__mach_head_fixup
179 @ Override machine type and atags pointers
180 ldr r1, =(machine_arch_type)
185 ENDPROC(__mach_head_fixup)
189 .type _memsize, %object
197 * Platform specific entry point for secondary CPUs. This
198 * provides a "holding pen" into which all secondary cores are held
199 * until we're ready for them to initialise.
202 ENTRY(platform_secondary_startup)
204 * Get hardware CPU id of ours
206 mrc p15, 0, r0, c0, c0, 5
209 * Wait on <pen_release> variable by physical address
210 * to contain our hardware CPU id
212 #ifdef CONFIG_SPARSEMEM
213 ldr r2, =(PAGE_OFFSET+SZ_128M)
222 ldr r2, =PHYS_OFFSET2
226 ldr r6, =__virt_to_phys(pen_release)
233 * In case L1 cache has unpredictable contents at power-up
234 * clean its contents without flushing.
236 bl v7_l1_cache_invalidate
239 * we've been released from the holding pen: secondary_stack
240 * should now contain the SVC stack for this core
244 ENDPROC(platform_secondary_startup)
246 #endif /* CONFIG_SMP */