xref: /openbmc/u-boot/include/init.h (revision d6f8771239b15e8a68b38fcde96977db212887bd)
1dafa84d2SPatrick Delaunay /*
2dafa84d2SPatrick Delaunay  * (C) Copyright 2000-2009
3dafa84d2SPatrick Delaunay  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4dafa84d2SPatrick Delaunay  *
5dafa84d2SPatrick Delaunay  * Copy the startup prototype, previously defined in common.h
6dafa84d2SPatrick Delaunay  * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
7dafa84d2SPatrick Delaunay  *
8dafa84d2SPatrick Delaunay  * SPDX-License-Identifier:	GPL-2.0+
9dafa84d2SPatrick Delaunay  */
10dafa84d2SPatrick Delaunay 
11dafa84d2SPatrick Delaunay #ifndef __INIT_H_
12dafa84d2SPatrick Delaunay #define __INIT_H_	1
13dafa84d2SPatrick Delaunay 
14dafa84d2SPatrick Delaunay #ifndef __ASSEMBLY__		/* put C only stuff in this section */
15dafa84d2SPatrick Delaunay 
16dafa84d2SPatrick Delaunay /*
17dafa84d2SPatrick Delaunay  * Function Prototypes
18dafa84d2SPatrick Delaunay  */
19dafa84d2SPatrick Delaunay 
20dafa84d2SPatrick Delaunay /* common/board_f.c */
21*d6f87712SPatrick Delaunay void board_init_f(ulong dummy);
22dafa84d2SPatrick Delaunay 
23dafa84d2SPatrick Delaunay /**
24dafa84d2SPatrick Delaunay  * arch_cpu_init() - basic cpu-dependent setup for an architecture
25dafa84d2SPatrick Delaunay  *
26dafa84d2SPatrick Delaunay  * This is called after early malloc is available. It should handle any
27dafa84d2SPatrick Delaunay  * CPU- or SoC- specific init needed to continue the init sequence. See
28dafa84d2SPatrick Delaunay  * board_f.c for where it is called. If this is not provided, a default
29dafa84d2SPatrick Delaunay  * version (which does nothing) will be used.
30dafa84d2SPatrick Delaunay  *
31dafa84d2SPatrick Delaunay  * @return: 0 on success, otherwise error
32dafa84d2SPatrick Delaunay  */
33dafa84d2SPatrick Delaunay int arch_cpu_init(void);
34dafa84d2SPatrick Delaunay 
35dafa84d2SPatrick Delaunay /**
36*d6f87712SPatrick Delaunay  * arch_cpu_init_dm() - init CPU after driver model is available
37*d6f87712SPatrick Delaunay  *
38*d6f87712SPatrick Delaunay  * This is called immediately after driver model is available before
39*d6f87712SPatrick Delaunay  * relocation. This is similar to arch_cpu_init() but is able to reference
40*d6f87712SPatrick Delaunay  * devices
41*d6f87712SPatrick Delaunay  *
42*d6f87712SPatrick Delaunay  * @return 0 if OK, -ve on error
43*d6f87712SPatrick Delaunay  */
44*d6f87712SPatrick Delaunay int arch_cpu_init_dm(void);
45*d6f87712SPatrick Delaunay 
46*d6f87712SPatrick Delaunay /**
47dafa84d2SPatrick Delaunay  * mach_cpu_init() - SoC/machine dependent CPU setup
48dafa84d2SPatrick Delaunay  *
49dafa84d2SPatrick Delaunay  * This is called after arch_cpu_init(). It should handle any
50dafa84d2SPatrick Delaunay  * SoC or machine specific init needed to continue the init sequence. See
51dafa84d2SPatrick Delaunay  * board_f.c for where it is called. If this is not provided, a default
52dafa84d2SPatrick Delaunay  * version (which does nothing) will be used.
53dafa84d2SPatrick Delaunay  *
54dafa84d2SPatrick Delaunay  * @return: 0 on success, otherwise error
55dafa84d2SPatrick Delaunay  */
56dafa84d2SPatrick Delaunay int mach_cpu_init(void);
57dafa84d2SPatrick Delaunay 
58*d6f87712SPatrick Delaunay /**
59*d6f87712SPatrick Delaunay  * arch_fsp_init() - perform firmware support package init
60*d6f87712SPatrick Delaunay  *
61*d6f87712SPatrick Delaunay  * Where U-Boot relies on binary blobs to handle part of the system init, this
62*d6f87712SPatrick Delaunay  * function can be used to set up the blobs. This is used on some Intel
63*d6f87712SPatrick Delaunay  * platforms.
64*d6f87712SPatrick Delaunay  */
65*d6f87712SPatrick Delaunay int arch_fsp_init(void);
66*d6f87712SPatrick Delaunay 
67*d6f87712SPatrick Delaunay int dram_init(void);
68*d6f87712SPatrick Delaunay 
69*d6f87712SPatrick Delaunay /**
70*d6f87712SPatrick Delaunay  * dram_init_banksize() - Set up DRAM bank sizes
71*d6f87712SPatrick Delaunay  *
72*d6f87712SPatrick Delaunay  * This can be implemented by boards to set up the DRAM bank information in
73*d6f87712SPatrick Delaunay  * gd->bd->bi_dram(). It is called just before relocation, after dram_init()
74*d6f87712SPatrick Delaunay  * is called.
75*d6f87712SPatrick Delaunay  *
76*d6f87712SPatrick Delaunay  * If this is not provided, a default implementation will try to set up a
77*d6f87712SPatrick Delaunay  * single bank. It will do this if CONFIG_NR_DRAM_BANKS and
78*d6f87712SPatrick Delaunay  * CONFIG_SYS_SDRAM_BASE are set. The bank will have a start address of
79*d6f87712SPatrick Delaunay  * CONFIG_SYS_SDRAM_BASE and the size will be determined by a call to
80*d6f87712SPatrick Delaunay  * get_effective_memsize().
81*d6f87712SPatrick Delaunay  *
82*d6f87712SPatrick Delaunay  * @return 0 if OK, -ve on error
83*d6f87712SPatrick Delaunay  */
84*d6f87712SPatrick Delaunay int dram_init_banksize(void);
85*d6f87712SPatrick Delaunay 
86*d6f87712SPatrick Delaunay /**
87*d6f87712SPatrick Delaunay  * Reserve all necessary stacks
88*d6f87712SPatrick Delaunay  *
89*d6f87712SPatrick Delaunay  * This is used in generic board init sequence in common/board_f.c. Each
90*d6f87712SPatrick Delaunay  * architecture could provide this function to tailor the required stacks.
91*d6f87712SPatrick Delaunay  *
92*d6f87712SPatrick Delaunay  * On entry gd->start_addr_sp is pointing to the suggested top of the stack.
93*d6f87712SPatrick Delaunay  * The callee ensures gd->start_add_sp is 16-byte aligned, so architectures
94*d6f87712SPatrick Delaunay  * require only this can leave it untouched.
95*d6f87712SPatrick Delaunay  *
96*d6f87712SPatrick Delaunay  * On exit gd->start_addr_sp and gd->irq_sp should be set to the respective
97*d6f87712SPatrick Delaunay  * positions of the stack. The stack pointer(s) will be set to this later.
98*d6f87712SPatrick Delaunay  * gd->irq_sp is only required, if the architecture needs it.
99*d6f87712SPatrick Delaunay  *
100*d6f87712SPatrick Delaunay  * @return 0 if no error
101*d6f87712SPatrick Delaunay  */
102*d6f87712SPatrick Delaunay int arch_reserve_stacks(void);
103*d6f87712SPatrick Delaunay 
104*d6f87712SPatrick Delaunay int print_cpuinfo(void);
105*d6f87712SPatrick Delaunay int timer_init(void);
106*d6f87712SPatrick Delaunay int reserve_mmu(void);
107*d6f87712SPatrick Delaunay int misc_init_f(void);
108*d6f87712SPatrick Delaunay #if defined(CONFIG_DTB_RESELECT)
109*d6f87712SPatrick Delaunay int embedded_dtb_select(void);
110*d6f87712SPatrick Delaunay #endif
111*d6f87712SPatrick Delaunay 
112dafa84d2SPatrick Delaunay /* common/board_r.c */
113dafa84d2SPatrick Delaunay 
114dafa84d2SPatrick Delaunay #endif	/* __ASSEMBLY__ */
115dafa84d2SPatrick Delaunay /* Put only stuff here that the assembler can digest */
116dafa84d2SPatrick Delaunay 
117dafa84d2SPatrick Delaunay #endif	/* __INIT_H_ */
118