1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * armboot - Startup Code for ARM1176 CPU-core
5 * Copyright (c) 2007 Samsung Electronics
8 * Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
10 * 2007-09-21 - Restructured codes by jsgood (jsgood.yang@samsung.com)
11 * 2007-09-21 - Added MoviNAND and OneNAND boot codes by
12 * jsgood (jsgood.yang@samsung.com)
13 * Base codes by scsuh (sc.suh)
16 #include <asm-offsets.h>
18 #include <linux/linkage.h>
20 #ifndef CONFIG_SYS_PHY_UBOOT_BASE
21 #define CONFIG_SYS_PHY_UBOOT_BASE CONFIG_SYS_UBOOT_BASE
25 *************************************************************************
27 * Startup Code (reset vector)
29 * do important init only if we don't start from memory!
30 * setup Memory and board specific bits prior to relocation.
31 * relocate armboot to ram
34 *************************************************************************
40 /* Allow the board to save important registers */
42 .globl save_boot_params_ret
46 * set the cpu to SVC32 mode
54 *************************************************************************
56 * CPU_init_critical registers
58 * setup important registers
61 *************************************************************************
64 * we do sys-critical inits only at reboot,
65 * not when booting from ram!
69 * When booting from NAND - it has definitely been a reset, so, no need
70 * to flush caches and disable the MMU
72 #ifndef CONFIG_SPL_BUILD
77 mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
78 mcr p15, 0, r0, c8, c7, 0 /* flush v4 TLB */
81 * disable MMU stuff and caches
83 mrc p15, 0, r0, c1, c0, 0
84 bic r0, r0, #0x00002300 @ clear bits 13, 9:8 (--V- --RS)
85 bic r0, r0, #0x00000087 @ clear bits 7, 2:0 (B--- -CAM)
86 orr r0, r0, #0x00000002 @ set bit 1 (A) Align
87 orr r0, r0, #0x00001000 @ set bit 12 (I) I-Cache
89 /* Prepare to disable the MMU */
90 adr r2, mmu_disable_phys
91 sub r2, r2, #(CONFIG_SYS_PHY_UBOOT_BASE - CONFIG_SYS_TEXT_BASE)
95 /* Run in a single cache-line */
97 mcr p15, 0, r0, c1, c0, 0
106 * Go setup Memory and board specific bits prior to relocation.
108 bl lowlevel_init /* go setup pll,mux,memory */
112 /*------------------------------------------------------------------------------*/
114 .globl c_runtime_cpu_setup
119 WEAK(save_boot_params)
120 b save_boot_params_ret /* back to my caller */
121 ENDPROC(save_boot_params)