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