1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * (C) Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 * Copy the startup prototype, previously defined in common.h
7 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
13 #include <linux/types.h>
17 #ifndef __ASSEMBLY__ /* put C only stuff in this section */
23 /* common/board_f.c */
24 void board_init_f(ulong dummy);
27 * arch_cpu_init() - basic cpu-dependent setup for an architecture
29 * This is called after early malloc is available. It should handle any
30 * CPU- or SoC- specific init needed to continue the init sequence. See
31 * board_f.c for where it is called. If this is not provided, a default
32 * version (which does nothing) will be used.
34 * Return: 0 on success, otherwise error
36 int arch_cpu_init(void);
39 * arch_cpu_init_dm() - init CPU after driver model is available
41 * This is called immediately after driver model is available before
42 * relocation. This is similar to arch_cpu_init() but is able to reference
45 * Return: 0 if OK, -ve on error
47 int arch_cpu_init_dm(void);
50 * mach_cpu_init() - SoC/machine dependent CPU setup
52 * This is called after arch_cpu_init(). It should handle any
53 * SoC or machine specific init needed to continue the init sequence. See
54 * board_f.c for where it is called. If this is not provided, a default
55 * version (which does nothing) will be used.
57 * Return: 0 on success, otherwise error
59 int mach_cpu_init(void);
62 * arch_fsp_init() - perform firmware support package init
64 * Where U-Boot relies on binary blobs to handle part of the system init, this
65 * function can be used to set up the blobs. This is used on some Intel
70 int arch_fsp_init(void);
73 * arch_fsp_init() - perform post-relocation firmware support package init
75 * Where U-Boot relies on binary blobs to handle part of the system init, this
76 * function can be used to set up the blobs. This is used on some Intel
81 int arch_fsp_init_r(void);
86 * dram_init_banksize() - Set up DRAM bank sizes
88 * This can be implemented by boards to set up the DRAM bank information in
89 * gd->bd->bi_dram(). It is called just before relocation, after dram_init()
92 * If this is not provided, a default implementation will try to set up a
93 * single bank. It will do this if CONFIG_NR_DRAM_BANKS and
94 * CONFIG_SYS_SDRAM_BASE are set. The bank will have a start address of
95 * CONFIG_SYS_SDRAM_BASE and the size will be determined by a call to
96 * get_effective_memsize().
98 * Return: 0 if OK, -ve on error
100 int dram_init_banksize(void);
103 * arch_reserve_stacks() - Reserve all necessary stacks
105 * This is used in generic board init sequence in common/board_f.c. Each
106 * architecture could provide this function to tailor the required stacks.
108 * On entry gd->start_addr_sp is pointing to the suggested top of the stack.
109 * The callee ensures gd->start_add_sp is 16-byte aligned, so architectures
110 * require only this can leave it untouched.
112 * On exit gd->start_addr_sp and gd->irq_sp should be set to the respective
113 * positions of the stack. The stack pointer(s) will be set to this later.
114 * gd->irq_sp is only required, if the architecture needs it.
116 * Return: 0 if no error
118 int arch_reserve_stacks(void);
121 * init_cache_f_r() - Turn on the cache in preparation for relocation
123 * Return: 0 if OK, -ve on error
125 int init_cache_f_r(void);
127 #if !CONFIG_IS_ENABLED(CPU)
129 * print_cpuinfo() - Display information about the CPU
131 * Return: 0 if OK, -ve on error
133 int print_cpuinfo(void);
135 int timer_init(void);
136 int reserve_mmu(void);
137 int misc_init_f(void);
139 #if defined(CONFIG_DTB_RESELECT)
140 int embedded_dtb_select(void);
143 /* common/init/board_init.c */
144 extern ulong monitor_flash_len;
147 * ulong board_init_f_alloc_reserve - allocate reserved area
148 * @top: top of the reserve area, growing down.
150 * This function is called by each architecture very early in the start-up
151 * code to allow the C runtime to reserve space on the stack for writable
152 * 'globals' such as GD and the malloc arena.
154 * Return: bottom of reserved area
156 ulong board_init_f_alloc_reserve(ulong top);
159 * board_init_f_init_reserve - initialize the reserved area(s)
160 * @base: top from which reservation was done
162 * This function is called once the C runtime has allocated the reserved
163 * area on the stack. It must initialize the GD at the base of that area.
165 void board_init_f_init_reserve(ulong base);
170 * arch_setup_gd() - Set up the global_data pointer
171 * @gd_ptr: Pointer to global data
173 * This pointer is special in some architectures and cannot easily be assigned
174 * to. For example on x86 it is implemented by adding a specific record to its
175 * Global Descriptor Table! So we we provide a function to carry out this task.
176 * For most architectures this can simply be:
180 void arch_setup_gd(struct global_data *gd_ptr);
182 /* common/board_r.c */
183 void board_init_r(struct global_data *id, ulong dest_addr)
184 __attribute__ ((noreturn));
186 int cpu_init_r(void);
187 int last_stage_init(void);
188 int mac_read_from_eeprom(void);
189 int set_cpu_clk_info(void);
190 int update_flash_size(int flash_size);
191 int arch_early_init_r(void);
193 int misc_init_r(void);
194 #if defined(CONFIG_VID)
195 int init_func_vid(void);
198 /* common/board_info.c */
199 int checkboard(void);
200 int show_board_info(void);
203 * Get the uppermost pointer that is valid to access
205 * Some systems may not map all of their address space. This function allows
206 * boards to indicate what their highest support pointer value is for DRAM
209 * @param total_size Size of U-Boot (unused?)
211 ulong board_get_usable_ram_top(ulong total_size);
213 int board_early_init_f(void);
215 /* manipulate the U-Boot fdt before its relocation */
216 int board_fix_fdt(void *rw_fdt_blob);
217 int board_late_init(void);
218 int board_postclk_init(void); /* after clocks/timebase, before env/serial */
219 int board_early_init_r(void);
221 /* TODO(sjg@chromium.org): Drop this when DM_PCI migration is completed */
222 void pci_init_board(void);
224 void trap_init(unsigned long reloc_addr);
227 * main_loop() - Enter the main loop of U-Boot
229 * This normally runs the command line.
231 void main_loop(void);
233 #if defined(CONFIG_ARM)
234 void relocate_code(ulong addr_moni);
236 void relocate_code(ulong start_addr_sp, struct global_data *new_gd,
238 __attribute__ ((noreturn));
241 #endif /* __ASSEMBLY__ */
242 /* Put only stuff here that the assembler can digest */
244 #endif /* __INIT_H_ */