blob: 147ae6bb8e75133702c8b70436de963de03aeaae [file] [log] [blame]
Patrick Delaunayc6bfcd52018-03-09 18:28:12 +01001/*
2 * (C) Copyright 2000-2009
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * Copy the startup prototype, previously defined in common.h
6 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
7 *
8 * SPDX-License-Identifier: GPL-2.0+
9 */
10
11#ifndef __INIT_H_
12#define __INIT_H_ 1
13
14#ifndef __ASSEMBLY__ /* put C only stuff in this section */
15
16/*
17 * Function Prototypes
18 */
19
20/* common/board_f.c */
Patrick Delaunaya0a2b212018-03-13 13:57:00 +010021void board_init_f(ulong dummy);
Patrick Delaunayc6bfcd52018-03-09 18:28:12 +010022
23/**
24 * arch_cpu_init() - basic cpu-dependent setup for an architecture
25 *
26 * This is called after early malloc is available. It should handle any
27 * CPU- or SoC- specific init needed to continue the init sequence. See
28 * board_f.c for where it is called. If this is not provided, a default
29 * version (which does nothing) will be used.
30 *
31 * @return: 0 on success, otherwise error
32 */
33int arch_cpu_init(void);
34
35/**
Patrick Delaunaya0a2b212018-03-13 13:57:00 +010036 * arch_cpu_init_dm() - init CPU after driver model is available
37 *
38 * This is called immediately after driver model is available before
39 * relocation. This is similar to arch_cpu_init() but is able to reference
40 * devices
41 *
42 * @return 0 if OK, -ve on error
43 */
44int arch_cpu_init_dm(void);
45
46/**
Patrick Delaunayc6bfcd52018-03-09 18:28:12 +010047 * mach_cpu_init() - SoC/machine dependent CPU setup
48 *
49 * This is called after arch_cpu_init(). It should handle any
50 * SoC or machine specific init needed to continue the init sequence. See
51 * board_f.c for where it is called. If this is not provided, a default
52 * version (which does nothing) will be used.
53 *
54 * @return: 0 on success, otherwise error
55 */
56int mach_cpu_init(void);
57
Patrick Delaunaya0a2b212018-03-13 13:57:00 +010058/**
59 * arch_fsp_init() - perform firmware support package init
60 *
61 * Where U-Boot relies on binary blobs to handle part of the system init, this
62 * function can be used to set up the blobs. This is used on some Intel
63 * platforms.
64 */
65int arch_fsp_init(void);
66
67int dram_init(void);
68
69/**
70 * dram_init_banksize() - Set up DRAM bank sizes
71 *
72 * This can be implemented by boards to set up the DRAM bank information in
73 * gd->bd->bi_dram(). It is called just before relocation, after dram_init()
74 * is called.
75 *
76 * If this is not provided, a default implementation will try to set up a
77 * single bank. It will do this if CONFIG_NR_DRAM_BANKS and
78 * CONFIG_SYS_SDRAM_BASE are set. The bank will have a start address of
79 * CONFIG_SYS_SDRAM_BASE and the size will be determined by a call to
80 * get_effective_memsize().
81 *
82 * @return 0 if OK, -ve on error
83 */
84int dram_init_banksize(void);
85
86/**
87 * Reserve all necessary stacks
88 *
89 * This is used in generic board init sequence in common/board_f.c. Each
90 * architecture could provide this function to tailor the required stacks.
91 *
92 * On entry gd->start_addr_sp is pointing to the suggested top of the stack.
93 * The callee ensures gd->start_add_sp is 16-byte aligned, so architectures
94 * require only this can leave it untouched.
95 *
96 * On exit gd->start_addr_sp and gd->irq_sp should be set to the respective
97 * positions of the stack. The stack pointer(s) will be set to this later.
98 * gd->irq_sp is only required, if the architecture needs it.
99 *
100 * @return 0 if no error
101 */
102int arch_reserve_stacks(void);
103
Patrick Delaunay18c50642018-03-13 13:57:04 +0100104/**
105 * init_cache_f_r() - Turn on the cache in preparation for relocation
106 *
107 * @return 0 if OK, -ve on error
108 */
109int init_cache_f_r(void);
110
Patrick Delaunaya0a2b212018-03-13 13:57:00 +0100111int print_cpuinfo(void);
112int timer_init(void);
113int reserve_mmu(void);
114int misc_init_f(void);
115#if defined(CONFIG_DTB_RESELECT)
116int embedded_dtb_select(void);
117#endif
118
Patrick Delaunay98c8bbc2018-03-13 13:57:01 +0100119/* common/init/board_init.c */
120extern ulong monitor_flash_len;
121
122/**
123 * ulong board_init_f_alloc_reserve - allocate reserved area
124 *
125 * This function is called by each architecture very early in the start-up
126 * code to allow the C runtime to reserve space on the stack for writable
127 * 'globals' such as GD and the malloc arena.
128 *
129 * @top: top of the reserve area, growing down.
130 * @return: bottom of reserved area
131 */
132ulong board_init_f_alloc_reserve(ulong top);
133
134/**
135 * board_init_f_init_reserve - initialize the reserved area(s)
136 *
137 * This function is called once the C runtime has allocated the reserved
138 * area on the stack. It must initialize the GD at the base of that area.
139 *
140 * @base: top from which reservation was done
141 */
142void board_init_f_init_reserve(ulong base);
143
144/**
145 * arch_setup_gd() - Set up the global_data pointer
146 *
147 * This pointer is special in some architectures and cannot easily be assigned
148 * to. For example on x86 it is implemented by adding a specific record to its
149 * Global Descriptor Table! So we we provide a function to carry out this task.
150 * For most architectures this can simply be:
151 *
152 * gd = gd_ptr;
153 *
154 * @gd_ptr: Pointer to global data
155 */
156void arch_setup_gd(gd_t *gd_ptr);
157
Patrick Delaunayc6bfcd52018-03-09 18:28:12 +0100158/* common/board_r.c */
Patrick Delaunayb76e7cf2018-03-13 13:57:02 +0100159void board_init_r(gd_t *id, ulong dest_addr) __attribute__ ((noreturn));
160
161int cpu_init_r(void);
162int last_stage_init(void);
163int mac_read_from_eeprom(void);
164int set_cpu_clk_info(void);
165int update_flash_size(int flash_size);
166int arch_early_init_r(void);
167void pci_init(void);
168int misc_init_r(void);
169#if defined(CONFIG_VID)
170int init_func_vid(void);
171#endif
172
Patrick Delaunayb1d23442018-03-13 13:57:03 +0100173/* common/board_info.c */
174int checkboard(void);
175int show_board_info(void);
Patrick Delaunayc6bfcd52018-03-09 18:28:12 +0100176
177#endif /* __ASSEMBLY__ */
178/* Put only stuff here that the assembler can digest */
179
180#endif /* __INIT_H_ */