]> Git Repo - u-boot.git/blame - include/init.h
configs: j721e_evm_defconfig: Add HBMC related configs
[u-boot.git] / include / init.h
CommitLineData
83d290c5 1/* SPDX-License-Identifier: GPL-2.0+ */
dafa84d2
PD
2/*
3 * (C) Copyright 2000-2009
4 * Wolfgang Denk, DENX Software Engineering, [email protected].
5 *
6 * Copy the startup prototype, previously defined in common.h
7 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
dafa84d2
PD
8 */
9
10#ifndef __INIT_H_
11#define __INIT_H_ 1
12
13#ifndef __ASSEMBLY__ /* put C only stuff in this section */
14
401d1c4f
SG
15#include <linux/types.h>
16
90794864
SG
17/*
18 * In case of the EFI app the UEFI firmware provides the low-level
19 * initialisation.
20 */
21#ifdef CONFIG_EFI
35a3f871
SG
22#define ll_boot_init() false
23#else
401d1c4f
SG
24#include <asm/global_data.h>
25
ba974a01 26#define ll_boot_init() (!(gd->flags & GD_FLG_SKIP_LL_INIT))
35a3f871
SG
27#endif
28
dafa84d2
PD
29/*
30 * Function Prototypes
31 */
32
33/* common/board_f.c */
d6f87712 34void board_init_f(ulong dummy);
dafa84d2
PD
35
36/**
37 * arch_cpu_init() - basic cpu-dependent setup for an architecture
38 *
39 * This is called after early malloc is available. It should handle any
40 * CPU- or SoC- specific init needed to continue the init sequence. See
41 * board_f.c for where it is called. If this is not provided, a default
42 * version (which does nothing) will be used.
43 *
dc145a7b 44 * Return: 0 on success, otherwise error
dafa84d2
PD
45 */
46int arch_cpu_init(void);
47
48/**
49 * mach_cpu_init() - SoC/machine dependent CPU setup
50 *
51 * This is called after arch_cpu_init(). It should handle any
52 * SoC or machine specific init needed to continue the init sequence. See
53 * board_f.c for where it is called. If this is not provided, a default
54 * version (which does nothing) will be used.
55 *
dc145a7b 56 * Return: 0 on success, otherwise error
dafa84d2
PD
57 */
58int mach_cpu_init(void);
59
d6f87712
PD
60/**
61 * arch_fsp_init() - perform firmware support package init
62 *
63 * Where U-Boot relies on binary blobs to handle part of the system init, this
64 * function can be used to set up the blobs. This is used on some Intel
65 * platforms.
dc145a7b
MS
66 *
67 * Return: 0
d6f87712
PD
68 */
69int arch_fsp_init(void);
70
fe08d39d
SG
71/**
72 * arch_fsp_init() - perform post-relocation firmware support package init
73 *
74 * Where U-Boot relies on binary blobs to handle part of the system init, this
75 * function can be used to set up the blobs. This is used on some Intel
76 * platforms.
77 *
78 * Return: 0
79 */
80int arch_fsp_init_r(void);
81
d6f87712
PD
82int dram_init(void);
83
84/**
85 * dram_init_banksize() - Set up DRAM bank sizes
86 *
87 * This can be implemented by boards to set up the DRAM bank information in
88 * gd->bd->bi_dram(). It is called just before relocation, after dram_init()
89 * is called.
90 *
91 * If this is not provided, a default implementation will try to set up a
92 * single bank. It will do this if CONFIG_NR_DRAM_BANKS and
93 * CONFIG_SYS_SDRAM_BASE are set. The bank will have a start address of
94 * CONFIG_SYS_SDRAM_BASE and the size will be determined by a call to
95 * get_effective_memsize().
96 *
dc145a7b 97 * Return: 0 if OK, -ve on error
d6f87712
PD
98 */
99int dram_init_banksize(void);
100
9b4a205f
SG
101long get_ram_size(long *base, long size);
102phys_size_t get_effective_memsize(void);
103
49acd56e
SG
104int testdram(void);
105
d6f87712 106/**
dc145a7b 107 * arch_reserve_stacks() - Reserve all necessary stacks
d6f87712
PD
108 *
109 * This is used in generic board init sequence in common/board_f.c. Each
110 * architecture could provide this function to tailor the required stacks.
111 *
112 * On entry gd->start_addr_sp is pointing to the suggested top of the stack.
113 * The callee ensures gd->start_add_sp is 16-byte aligned, so architectures
114 * require only this can leave it untouched.
115 *
116 * On exit gd->start_addr_sp and gd->irq_sp should be set to the respective
117 * positions of the stack. The stack pointer(s) will be set to this later.
118 * gd->irq_sp is only required, if the architecture needs it.
119 *
dc145a7b 120 * Return: 0 if no error
d6f87712
PD
121 */
122int arch_reserve_stacks(void);
123
79926e4f
OP
124/**
125 * arch_reserve_mmu() - Reserve memory for MMU TLB table
126 *
127 * Architecture-specific routine for reserving memory for the MMU TLB table.
128 * This is used in generic board init sequence in common/board_f.c.
129 *
130 * If an implementation is not provided, it will just be a nop stub.
131 *
132 * Return: 0 if OK
133 */
134int arch_reserve_mmu(void);
135
81e7cb1e
OP
136/**
137 * arch_setup_bdinfo() - Architecture dependent boardinfo setup
138 *
139 * Architecture-specific routine for populating various boardinfo fields of
140 * gd->bd. It is called during the generic board init sequence.
141 *
142 * If an implementation is not provided, it will just be a nop stub.
143 *
144 * Return: 0 if OK
145 */
146int arch_setup_bdinfo(void);
147
ba743103
OP
148/**
149 * setup_bdinfo() - Generic boardinfo setup
150 *
151 * Routine for populating various generic boardinfo fields of
152 * gd->bd. It is called during the generic board init sequence.
153 *
154 * Return: 0 if OK
155 */
156int setup_bdinfo(void);
157
12a3e1ad
DS
158#if defined(CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR) || \
159defined(CONFIG_SAVE_PREV_BL_FDT_ADDR)
160/**
161 * save_prev_bl_data - Save prev bl data in env vars.
162 *
163 * When u-boot is chain-loaded, save previous bootloader data,
164 * like initramfs address to environment variables.
165 *
166 * Return: 0 if ok; -ENODATA on error
167 */
168int save_prev_bl_data(void);
169#endif
170
fb504b2c
OP
171/**
172 * cpu_secondary_init_r() - CPU-specific secondary initialization
173 *
174 * After non-volatile devices, environment and cpu code are setup, have
175 * another round to deal with any initialization that might require
176 * full access to the environment or loading of some image (firmware)
177 * from a non-volatile device.
178 *
179 * It is called during the generic post-relocation init sequence.
180 *
181 * Return: 0 if OK
182 */
183int cpu_secondary_init_r(void);
184
c343e8c0
OP
185/**
186 * pci_ep_init() - Initialize pci endpoint devices
187 *
188 * It is called during the generic post-relocation init sequence.
189 *
190 * Return: 0 if OK
191 */
192int pci_ep_init(void);
193
b9f6d0f7
OP
194/**
195 * pci_init() - Enumerate pci devices
196 *
197 * It is called during the generic post-relocation init sequence to enumerate
198 * pci buses. This is needed, for instance, in the case of DM PCI-based
199 * Ethernet devices, which will not be detected without having the enumeration
200 * performed earlier.
201 *
202 * Return: 0 if OK
203 */
204int pci_init(void);
205
b8aa55cb
PD
206/**
207 * init_cache_f_r() - Turn on the cache in preparation for relocation
208 *
dc145a7b 209 * Return: 0 if OK, -ve on error
b8aa55cb
PD
210 */
211int init_cache_f_r(void);
212
5d6c61ac
MS
213#if !CONFIG_IS_ENABLED(CPU)
214/**
215 * print_cpuinfo() - Display information about the CPU
216 *
217 * Return: 0 if OK, -ve on error
218 */
d6f87712 219int print_cpuinfo(void);
5d6c61ac 220#endif
d6f87712 221int timer_init(void);
dc145a7b 222
d6f87712
PD
223#if defined(CONFIG_DTB_RESELECT)
224int embedded_dtb_select(void);
225#endif
226
11f86cba
PD
227/* common/init/board_init.c */
228extern ulong monitor_flash_len;
229
230/**
231 * ulong board_init_f_alloc_reserve - allocate reserved area
dc145a7b 232 * @top: top of the reserve area, growing down.
11f86cba
PD
233 *
234 * This function is called by each architecture very early in the start-up
235 * code to allow the C runtime to reserve space on the stack for writable
236 * 'globals' such as GD and the malloc arena.
237 *
dc145a7b 238 * Return: bottom of reserved area
11f86cba
PD
239 */
240ulong board_init_f_alloc_reserve(ulong top);
241
242/**
243 * board_init_f_init_reserve - initialize the reserved area(s)
dc145a7b 244 * @base: top from which reservation was done
11f86cba
PD
245 *
246 * This function is called once the C runtime has allocated the reserved
247 * area on the stack. It must initialize the GD at the base of that area.
11f86cba
PD
248 */
249void board_init_f_init_reserve(ulong base);
250
67c4e9f8
SG
251struct global_data;
252
11f86cba
PD
253/**
254 * arch_setup_gd() - Set up the global_data pointer
dc145a7b 255 * @gd_ptr: Pointer to global data
11f86cba
PD
256 *
257 * This pointer is special in some architectures and cannot easily be assigned
258 * to. For example on x86 it is implemented by adding a specific record to its
259 * Global Descriptor Table! So we we provide a function to carry out this task.
260 * For most architectures this can simply be:
261 *
262 * gd = gd_ptr;
11f86cba 263 */
67c4e9f8 264void arch_setup_gd(struct global_data *gd_ptr);
11f86cba 265
dafa84d2 266/* common/board_r.c */
67c4e9f8
SG
267void board_init_r(struct global_data *id, ulong dest_addr)
268 __attribute__ ((noreturn));
e2c219cd
PD
269
270int cpu_init_r(void);
271int last_stage_init(void);
272int mac_read_from_eeprom(void);
273int set_cpu_clk_info(void);
274int update_flash_size(int flash_size);
275int arch_early_init_r(void);
e2c219cd
PD
276int misc_init_r(void);
277#if defined(CONFIG_VID)
278int init_func_vid(void);
279#endif
280
fc22ee21
PD
281/* common/board_info.c */
282int checkboard(void);
283int show_board_info(void);
dafa84d2 284
67c4e9f8
SG
285/**
286 * Get the uppermost pointer that is valid to access
287 *
288 * Some systems may not map all of their address space. This function allows
289 * boards to indicate what their highest support pointer value is for DRAM
290 * access.
291 *
292 * @param total_size Size of U-Boot (unused?)
293 */
294ulong board_get_usable_ram_top(ulong total_size);
295
5255932f
SG
296int board_early_init_f(void);
297
298/* manipulate the U-Boot fdt before its relocation */
299int board_fix_fdt(void *rw_fdt_blob);
300int board_late_init(void);
301int board_postclk_init(void); /* after clocks/timebase, before env/serial */
302int board_early_init_r(void);
303
130845ba
OP
304/**
305 * arch_initr_trap() - Init traps
306 *
307 * Arch specific routine for initializing traps. It is called during the
308 * generic board init sequence, after relocation.
309 *
310 * Return: 0 if OK
311 */
312int arch_initr_trap(void);
d67bdaa7 313
2fd81be1
OP
314/**
315 * init_addr_map()
316 *
317 * Initialize non-identity virtual-physical memory mappings for 32bit CPUs.
318 * It is called during the generic board init sequence, after relocation.
319 *
320 * Return: 0 if OK
321 */
322int init_addr_map(void);
323
6b8d3cea
SG
324/**
325 * main_loop() - Enter the main loop of U-Boot
326 *
327 * This normally runs the command line.
328 */
329void main_loop(void);
330
94133872
SG
331#if defined(CONFIG_ARM)
332void relocate_code(ulong addr_moni);
333#else
334void relocate_code(ulong start_addr_sp, struct global_data *new_gd,
335 ulong relocaddr)
336 __attribute__ ((noreturn));
337#endif
338
655f17ff 339/* Print a numeric value (for use in arch_print_bdinfo()) */
98592c75
BM
340void bdinfo_print_num_l(const char *name, ulong value);
341void bdinfo_print_num_ll(const char *name, unsigned long long value);
655f17ff
SG
342
343/* Print a clock speed in MHz */
344void bdinfo_print_mhz(const char *name, unsigned long hz);
345
59b0d7d8
SG
346/* Show arch-specific information for the 'bd' command */
347void arch_print_bdinfo(void);
348
4b32531b
AS
349int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
350
dafa84d2
PD
351#endif /* __ASSEMBLY__ */
352/* Put only stuff here that the assembler can digest */
353
354#endif /* __INIT_H_ */
This page took 0.254559 seconds and 4 git commands to generate.