Blame view

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

d6f877123   Patrick Delaunay   common: move boar...
121
122
123
  #if defined(CONFIG_DTB_RESELECT)
  int embedded_dtb_select(void);
  #endif
11f86cbaf   Patrick Delaunay   common: move boar...
124
125
126
127
128
  /* common/init/board_init.c */
  extern ulong monitor_flash_len;
  
  /**
   * ulong board_init_f_alloc_reserve - allocate reserved area
dc145a7be   Mario Six   init: Fix documen...
129
   * @top: top of the reserve area, growing down.
11f86cbaf   Patrick Delaunay   common: move boar...
130
131
132
133
134
   *
   * This function is called by each architecture very early in the start-up
   * code to allow the C runtime to reserve space on the stack for writable
   * 'globals' such as GD and the malloc arena.
   *
dc145a7be   Mario Six   init: Fix documen...
135
   * Return: bottom of reserved area
11f86cbaf   Patrick Delaunay   common: move boar...
136
137
138
139
140
   */
  ulong board_init_f_alloc_reserve(ulong top);
  
  /**
   * board_init_f_init_reserve - initialize the reserved area(s)
dc145a7be   Mario Six   init: Fix documen...
141
   * @base:	top from which reservation was done
11f86cbaf   Patrick Delaunay   common: move boar...
142
143
144
   *
   * This function is called once the C runtime has allocated the reserved
   * area on the stack. It must initialize the GD at the base of that area.
11f86cbaf   Patrick Delaunay   common: move boar...
145
146
147
148
149
   */
  void board_init_f_init_reserve(ulong base);
  
  /**
   * arch_setup_gd() - Set up the global_data pointer
dc145a7be   Mario Six   init: Fix documen...
150
   * @gd_ptr: Pointer to global data
11f86cbaf   Patrick Delaunay   common: move boar...
151
152
153
154
155
156
157
   *
   * This pointer is special in some architectures and cannot easily be assigned
   * to. For example on x86 it is implemented by adding a specific record to its
   * Global Descriptor Table! So we we provide a function to carry out this task.
   * For most architectures this can simply be:
   *
   *    gd = gd_ptr;
11f86cbaf   Patrick Delaunay   common: move boar...
158
159
   */
  void arch_setup_gd(gd_t *gd_ptr);
dafa84d27   Patrick Delaunay   common: add a pro...
160
  /* common/board_r.c */
e2c219cd7   Patrick Delaunay   common: move boar...
161
162
163
164
165
166
167
168
169
170
171
172
173
  void board_init_r(gd_t *id, ulong dest_addr) __attribute__ ((noreturn));
  
  int cpu_init_r(void);
  int last_stage_init(void);
  int mac_read_from_eeprom(void);
  int set_cpu_clk_info(void);
  int update_flash_size(int flash_size);
  int arch_early_init_r(void);
  void pci_init(void);
  int misc_init_r(void);
  #if defined(CONFIG_VID)
  int init_func_vid(void);
  #endif
fc22ee215   Patrick Delaunay   common: move boar...
174
175
176
  /* common/board_info.c */
  int checkboard(void);
  int show_board_info(void);
dafa84d27   Patrick Delaunay   common: add a pro...
177
178
179
180
181
  
  #endif	/* __ASSEMBLY__ */
  /* Put only stuff here that the assembler can digest */
  
  #endif	/* __INIT_H_ */