2 * HNDRTE ARM boot code for standalone apps.
4 * Code should be position-independent until it copies itself to SRAM.
6 * Copyright (C) 2013, Broadcom Corporation. All Rights Reserved.
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
15 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
17 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
18 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 * $Id: bootarm.S,v 1.18 2008-04-03 18:30:21 $
31 #if defined(__ARM_ARCH_7R__)
36 /* In the cr4 we don't have the luxury of multiple windows into ram/rom,
37 * when the rom is remapped to address 0, the ram shadowed by the rom is
38 * simply not available
40 * So the boot process is going to be:
41 * 1) Jump to the rom's real address
43 * 3) Copy image to ram
51 /* 1) Jump to the rom's real address */
61 mov r2,r9 /* Get arm wrapper */
64 ldr r4,=SICF_REMAP_MSK
66 ldr r4,=SICF_REMAP_NONE
69 ldr r3,[r2,r5] /* read back to wait for the posted write */
71 /* 3) Copy image to ram */
73 /* install the exception handler in RAM */
76 ldr r2,=disable_arm_irq
82 /* Just copy the data segment */
87 /* Copy entire image */
91 #endif /* CONFIG_XIP */
93 #else /* FLOPS_SUPPORT */
94 /* for case where flops is supported, there is no need to remap
95 * or copy the image/vectors to ram. Just copying the data
96 * segment would be enough.
101 #endif /* FLOPS_SUPPORT */
111 #elif defined(__ARM_ARCH_7A__)
114 #else /* !__ARM_ARCH_7R__ && !__ARM_ARCH_7A__ */
117 * Copy data and code into RAM depending on where it's booted.
120 * r7 - (chip type << CID_TYPE_SHIFT)
121 * r11 - socram wrapper
123 * r0, r1, r2, r3, r4, r5
126 /* Don't reset SOCRAM if running from ROM */
127 ldr r0,=SICF_REMAP_ROM
131 /* Initialize SOCRAM */
137 /* Do a core reset in SB chips */
138 ldr r1,=(((SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT) | SBTML_RESET)
141 /* Read back and delay */
146 ldr r1,=((SICF_FGC | SICF_CLOCK_EN) << SBTML_SICF_SHIFT)
148 /* Read back and delay */
152 /* Leave clock enabled */
153 ldr r1,=(SICF_CLOCK_EN << SBTML_SICF_SHIFT)
155 /* Read back and delay */
162 /* Do a core reset in AI chips */
164 /* Set reset while enabling the clock */
165 ldr r1,=(SICF_FGC | SICF_CLOCK_EN)
171 /* Read back and delay */
179 /* Read back and delay */
184 /* Clear Force Gated Clock */
186 ldr r2,=AI_IOCTRLCLEAR
188 /* Read back and delay */
194 /* Copy data or self to SRAM */
197 /* Just copy the data segment */
207 /* Copy entire image */
209 ldr r2,=SICF_REMAP_ROM
213 1: ldr r1,=text_start
215 /* Copy upto donecopy and then run docopy from SRAM */
223 /* Now change RAM mapping to NONE/SRAM */
225 mov r2,r9 /* Get arm wrapper */
229 /* For SB chips, get sbtmstatelow and shift it */
232 ldr r6,=SBTML_SICF_SHIFT
236 /* For AI chips, just get ioctrl register */
241 2: ldr r4,=SICF_REMAP_MSK
243 ldr r4,=SICF_REMAP_NONE
247 /* read back to wait for the posted write */
252 /* Copy after donecopy using docopy in SRAM */
265 /* Make sure any literals needed by the code above are "close" and
266 * have been copied to ram before we switch:
270 #endif /* CONFIG_XIP */
271 #endif /* __ARM_ARCH_7R__ */