Blame view
common/board_f.c
25.1 KB
83d290c56 SPDX: Convert all... |
1 |
// SPDX-License-Identifier: GPL-2.0+ |
1938f4a5b Introduce generic... |
2 3 4 5 6 7 8 9 |
/* * Copyright (c) 2011 The Chromium OS Authors. * (C) Copyright 2002-2006 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * (C) Copyright 2002 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> * Marius Groeger <mgroeger@sysgo.de> |
1938f4a5b Introduce generic... |
10 11 12 |
*/ #include <common.h> |
f0293d33b bloblist: Locate ... |
13 |
#include <bloblist.h> |
d96c26040 common: Move cloc... |
14 |
#include <clock_legacy.h> |
24b852a7a Move console defi... |
15 |
#include <console.h> |
5d6c61ac4 board_f: Use stat... |
16 |
#include <cpu.h> |
30c7c4347 common: Move chec... |
17 |
#include <cpu_func.h> |
ab7cd6279 dm: Support drive... |
18 |
#include <dm.h> |
4bfd1f5d6 env: Move env_ini... |
19 |
#include <env.h> |
f3998fdc4 env: Rename envir... |
20 |
#include <env_internal.h> |
1938f4a5b Introduce generic... |
21 |
#include <fdtdec.h> |
f828bf25f sandbox: Add CONF... |
22 |
#include <fs.h> |
db41d65a9 common: Move hang... |
23 |
#include <hang.h> |
e4fef6cfc Adjust board_f.c ... |
24 |
#include <i2c.h> |
67c4e9f81 common: Move boar... |
25 |
#include <init.h> |
1938f4a5b Introduce generic... |
26 |
#include <initcall.h> |
3c1ecde40 common: Move lcd_... |
27 |
#include <lcd.h> |
fb5cf7f16 Move initf_malloc... |
28 |
#include <malloc.h> |
0eb25b619 common: Make sure... |
29 |
#include <mapmem.h> |
a733b06b6 sandbox: Switch o... |
30 |
#include <os.h> |
1938f4a5b Introduce generic... |
31 |
#include <post.h> |
e47b2d674 board_f: Make rel... |
32 |
#include <relocate.h> |
b03e0510d common: Move seri... |
33 |
#include <serial.h> |
b0edea3c2 spl: Add support ... |
34 35 36 |
#ifdef CONFIG_SPL #include <spl.h> #endif |
c5d4001a1 common: board_f: ... |
37 |
#include <status_led.h> |
23471aed5 board_f: Add rese... |
38 |
#include <sysreset.h> |
1057e6cfe timer: Set up the... |
39 |
#include <timer.h> |
71c52dba2 Add trace support... |
40 |
#include <trace.h> |
5a5419451 dm: common: Add m... |
41 |
#include <video.h> |
e4fef6cfc Adjust board_f.c ... |
42 |
#include <watchdog.h> |
b885d02e2 arm: Remove inclu... |
43 44 45 |
#ifdef CONFIG_MACH_TYPE #include <asm/mach-types.h> #endif |
1fbf97dc4 board_f: powerpc:... |
46 47 48 |
#if defined(CONFIG_MP) && defined(CONFIG_PPC) #include <asm/mp.h> #endif |
1938f4a5b Introduce generic... |
49 50 |
#include <asm/io.h> #include <asm/sections.h> |
ab7cd6279 dm: Support drive... |
51 |
#include <dm/root.h> |
056285fd4 board_f: Move err... |
52 |
#include <linux/errno.h> |
1938f4a5b Introduce generic... |
53 54 55 56 57 58 59 60 61 |
/* * Pointer to initial global data area * * Here we initialize it if needed. */ #ifdef XTRN_DECLARE_GLOBAL_DATA_PTR #undef XTRN_DECLARE_GLOBAL_DATA_PTR #define XTRN_DECLARE_GLOBAL_DATA_PTR /* empty = allocate here */ |
16ef14742 common: board_f: ... |
62 |
DECLARE_GLOBAL_DATA_PTR = (gd_t *)(CONFIG_SYS_INIT_GD_ADDR); |
1938f4a5b Introduce generic... |
63 64 65 66 67 |
#else DECLARE_GLOBAL_DATA_PTR; #endif /* |
4c509343a Fix comment nits ... |
68 |
* TODO(sjg@chromium.org): IMO this code should be |
1938f4a5b Introduce generic... |
69 70 71 72 73 74 75 76 77 |
* refactored to a single function, something like: * * void led_set_state(enum led_colour_t colour, int on); */ /************************************************************************ * Coloured LED functionality ************************************************************************ * May be supplied by boards if desired */ |
c5d4001a1 common: board_f: ... |
78 79 80 81 82 83 84 85 86 |
__weak void coloured_LED_init(void) {} __weak void red_led_on(void) {} __weak void red_led_off(void) {} __weak void green_led_on(void) {} __weak void green_led_off(void) {} __weak void yellow_led_on(void) {} __weak void yellow_led_off(void) {} __weak void blue_led_on(void) {} __weak void blue_led_off(void) {} |
1938f4a5b Introduce generic... |
87 88 89 90 91 92 93 94 95 96 97 |
/* * Why is gd allocated a register? Prior to reloc it might be better to * just pass it around to each function in this file? * * After reloc one could argue that it is hardly used and doesn't need * to be in a register. Or if it is it should perhaps hold pointers to all * global data for all modules, so that post-reloc we can avoid the massive * literal pool we get on ARM. Or perhaps just encourage each module to use * a structure... */ |
d54d7eb96 support blackfin ... |
98 |
#if defined(CONFIG_WATCHDOG) || defined(CONFIG_HW_WATCHDOG) |
e4fef6cfc Adjust board_f.c ... |
99 100 |
static int init_func_watchdog_init(void) { |
ea3310e8a Blackfin: Remove |
101 102 |
# if defined(CONFIG_HW_WATCHDOG) && \ (defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \ |
1473f6ac8 arm: at91: wdt: C... |
103 |
defined(CONFIG_SH) || \ |
46d7a3b3d board_f: init des... |
104 |
defined(CONFIG_DESIGNWARE_WATCHDOG) || \ |
14a380a8f common/board_f.c:... |
105 |
defined(CONFIG_IMX_WATCHDOG)) |
d54d7eb96 support blackfin ... |
106 |
hw_watchdog_init(); |
e4fef6cfc Adjust board_f.c ... |
107 108 |
puts(" Watchdog enabled "); |
ba169d981 board_f: prevent ... |
109 |
# endif |
e4fef6cfc Adjust board_f.c ... |
110 111 112 113 114 115 116 117 118 119 120 121 |
WATCHDOG_RESET(); return 0; } int init_func_watchdog_reset(void) { WATCHDOG_RESET(); return 0; } #endif /* CONFIG_WATCHDOG */ |
dd2a6cd0f common: board: us... |
122 |
__weak void board_add_ram_info(int use_default) |
e4fef6cfc Adjust board_f.c ... |
123 124 125 |
{ /* please define platform specific board_add_ram_info() */ } |
1938f4a5b Introduce generic... |
126 127 |
static int init_baud_rate(void) { |
bfebc8c96 env: Rename geten... |
128 |
gd->baudrate = env_get_ulong("baudrate", 10, CONFIG_BAUDRATE); |
1938f4a5b Introduce generic... |
129 130 131 132 133 |
return 0; } static int display_text_info(void) { |
9b2174984 efi: Avoid using ... |
134 |
#if !defined(CONFIG_SANDBOX) && !defined(CONFIG_EFI_APP) |
9fdee7d73 common/board_f: f... |
135 |
ulong bss_start, bss_end, text_base; |
1938f4a5b Introduce generic... |
136 |
|
632efa744 Add CONFIG_SYS_SY... |
137 138 |
bss_start = (ulong)&__bss_start; bss_end = (ulong)&__bss_end; |
b60eff31f arm: remove unnee... |
139 |
|
d54d7eb96 support blackfin ... |
140 |
#ifdef CONFIG_SYS_TEXT_BASE |
9fdee7d73 common/board_f: f... |
141 |
text_base = CONFIG_SYS_TEXT_BASE; |
d54d7eb96 support blackfin ... |
142 |
#else |
9fdee7d73 common/board_f: f... |
143 |
text_base = CONFIG_SYS_MONITOR_BASE; |
d54d7eb96 support blackfin ... |
144 |
#endif |
9fdee7d73 common/board_f: f... |
145 146 147 |
debug("U-Boot code: %08lX -> %08lX BSS: -> %08lX ", |
16ef14742 common: board_f: ... |
148 |
text_base, bss_start, bss_end); |
a733b06b6 sandbox: Switch o... |
149 |
#endif |
1938f4a5b Introduce generic... |
150 |
|
1938f4a5b Introduce generic... |
151 152 |
return 0; } |
23471aed5 board_f: Add rese... |
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
#ifdef CONFIG_SYSRESET static int print_resetinfo(void) { struct udevice *dev; char status[256]; int ret; ret = uclass_first_device_err(UCLASS_SYSRESET, &dev); if (ret) { debug("%s: No sysreset device found (error: %d) ", __func__, ret); /* Not all boards have sysreset drivers available during early * boot, so don't fail if one can't be found. */ return 0; } if (!sysreset_get_status(dev, status, sizeof(status))) printf("%s", status); return 0; } #endif |
5d6c61ac4 board_f: Use stat... |
177 178 179 180 181 182 |
#if defined(CONFIG_DISPLAY_CPUINFO) && CONFIG_IS_ENABLED(CPU) static int print_cpuinfo(void) { struct udevice *dev; char desc[512]; int ret; |
11a3c8271 MLK-21828-2 commo... |
183 184 185 186 187 188 |
dev = cpu_get_current_dev(); if (!dev) { debug("%s: Could not get CPU device ", __func__); return -ENODEV; |
5d6c61ac4 board_f: Use stat... |
189 190 191 192 193 194 195 196 197 |
} ret = cpu_get_desc(dev, desc, sizeof(desc)); if (ret) { debug("%s: Could not get CPU description (err = %d) ", dev->name, ret); return ret; } |
ecfe66330 dm: cpu: Fix prin... |
198 199 |
printf("CPU: %s ", desc); |
5d6c61ac4 board_f: Use stat... |
200 201 202 203 |
return 0; } #endif |
1938f4a5b Introduce generic... |
204 205 206 207 208 209 210 211 |
static int announce_dram_init(void) { puts("DRAM: "); return 0; } static int show_dram_config(void) { |
fa39ffe5d common/board_f: F... |
212 |
unsigned long long size; |
1938f4a5b Introduce generic... |
213 214 215 216 217 218 219 220 221 |
#ifdef CONFIG_NR_DRAM_BANKS int i; debug(" RAM Configuration: "); for (i = size = 0; i < CONFIG_NR_DRAM_BANKS; i++) { size += gd->bd->bi_dram[i].size; |
715f599f8 common: Display >... |
222 223 |
debug("Bank #%d: %llx ", i, (unsigned long long)(gd->bd->bi_dram[i].start)); |
1938f4a5b Introduce generic... |
224 225 226 227 228 229 230 231 232 233 |
#ifdef DEBUG print_size(gd->bd->bi_dram[i].size, " "); #endif } debug(" DRAM: "); #else size = gd->ram_size; #endif |
e4fef6cfc Adjust board_f.c ... |
234 235 236 237 |
print_size(size, ""); board_add_ram_info(0); putc(' '); |
1938f4a5b Introduce generic... |
238 239 240 |
return 0; } |
76b00aca4 board_f: Drop set... |
241 |
__weak int dram_init_banksize(void) |
1938f4a5b Introduce generic... |
242 243 244 245 246 |
{ #if defined(CONFIG_NR_DRAM_BANKS) && defined(CONFIG_SYS_SDRAM_BASE) gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE; gd->bd->bi_dram[0].size = get_effective_memsize(); #endif |
76b00aca4 board_f: Drop set... |
247 248 |
return 0; |
1938f4a5b Introduce generic... |
249 |
} |
69153988a i2c: Finish dropp... |
250 |
#if defined(CONFIG_SYS_I2C) |
e4fef6cfc Adjust board_f.c ... |
251 252 253 |
static int init_func_i2c(void) { puts("I2C: "); |
815a76f2e i2c: fix init on ... |
254 255 256 |
#ifdef CONFIG_SYS_I2C i2c_init_all(); #else |
e4fef6cfc Adjust board_f.c ... |
257 |
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); |
815a76f2e i2c: fix init on ... |
258 |
#endif |
e4fef6cfc Adjust board_f.c ... |
259 260 261 262 263 |
puts("ready "); return 0; } #endif |
1fab98fb9 common: board_f: ... |
264 265 266 267 268 269 |
#if defined(CONFIG_VID) __weak int init_func_vid(void) { return 0; } #endif |
1938f4a5b Introduce generic... |
270 271 |
static int setup_mon_len(void) { |
e945f6dc2 microblaze: Move ... |
272 |
#if defined(__ARM__) || defined(__MICROBLAZE__) |
b60eff31f arm: remove unnee... |
273 |
gd->mon_len = (ulong)&__bss_end - (ulong)_start; |
9b2174984 efi: Avoid using ... |
274 |
#elif defined(CONFIG_SANDBOX) || defined(CONFIG_EFI_APP) |
a733b06b6 sandbox: Switch o... |
275 |
gd->mon_len = (ulong)&_end - (ulong)_init; |
ea3310e8a Blackfin: Remove |
276 |
#elif defined(CONFIG_NIOS2) || defined(CONFIG_XTENSA) |
d54d7eb96 support blackfin ... |
277 |
gd->mon_len = CONFIG_SYS_MONITOR_LEN; |
068feb9b8 riscv: Modify gen... |
278 |
#elif defined(CONFIG_NDS32) || defined(CONFIG_SH) || defined(CONFIG_RISCV) |
2e88bb28d NDS32: Generic Bo... |
279 |
gd->mon_len = (ulong)(&__bss_end) - (ulong)(&_start); |
b0b359536 board_f: Don't re... |
280 |
#elif defined(CONFIG_SYS_MONITOR_BASE) |
e4fef6cfc Adjust board_f.c ... |
281 282 |
/* TODO: use (ulong)&__bss_end - (ulong)&__text_start; ? */ gd->mon_len = (ulong)&__bss_end - CONFIG_SYS_MONITOR_BASE; |
632efa744 Add CONFIG_SYS_SY... |
283 |
#endif |
1938f4a5b Introduce generic... |
284 285 |
return 0; } |
b0edea3c2 spl: Add support ... |
286 287 288 289 290 291 292 293 294 295 296 |
static int setup_spl_handoff(void) { #if CONFIG_IS_ENABLED(HANDOFF) gd->spl_handoff = bloblist_find(BLOBLISTT_SPL_HANDOFF, sizeof(struct spl_handoff)); debug("Found SPL hand-off info %p ", gd->spl_handoff); #endif return 0; } |
1938f4a5b Introduce generic... |
297 298 299 300 |
__weak int arch_cpu_init(void) { return 0; } |
8ebf50692 board_f: Add a ma... |
301 302 303 304 |
__weak int mach_cpu_init(void) { return 0; } |
1938f4a5b Introduce generic... |
305 306 307 |
/* Get the top of usable RAM */ __weak ulong board_get_usable_ram_top(ulong total_size) { |
1e4d11a58 common: board: su... |
308 309 |
#ifdef CONFIG_SYS_SDRAM_BASE /* |
4c509343a Fix comment nits ... |
310 |
* Detect whether we have so much RAM that it goes past the end of our |
1e4d11a58 common: board: su... |
311 312 313 314 315 316 317 318 319 |
* 32-bit address space. If so, clip the usable RAM so it doesn't. */ if (gd->ram_top < CONFIG_SYS_SDRAM_BASE) /* * Will wrap back to top of 32-bit space when reservations * are made. */ return 0; #endif |
1938f4a5b Introduce generic... |
320 321 322 323 324 325 326 327 328 329 330 331 |
return gd->ram_top; } static int setup_dest_addr(void) { debug("Monitor len: %08lX ", gd->mon_len); /* * Ram is setup, size stored in gd !! */ debug("Ram size: %08lX ", (ulong)gd->ram_size); |
36cc0de0b armv8: layerscape... |
332 |
#if defined(CONFIG_SYS_MEM_TOP_HIDE) |
1938f4a5b Introduce generic... |
333 334 335 336 |
/* * Subtract specified amount of memory to hide so that it won't * get "touched" at all by U-Boot. By fixing up gd->ram_size * the Linux kernel should now get passed the now "corrected" |
36cc0de0b armv8: layerscape... |
337 338 339 340 341 |
* memory size and won't touch it either. This should work * for arch/ppc and arch/powerpc. Only Linux board ports in * arch/powerpc with bootwrapper support, that recalculate the * memory size from the SDRAM controller setup will have to * get fixed. |
1938f4a5b Introduce generic... |
342 |
*/ |
36cc0de0b armv8: layerscape... |
343 344 |
gd->ram_size -= CONFIG_SYS_MEM_TOP_HIDE; #endif |
1938f4a5b Introduce generic... |
345 |
#ifdef CONFIG_SYS_SDRAM_BASE |
1473b12ad lib: fdtdec: Upda... |
346 |
gd->ram_base = CONFIG_SYS_SDRAM_BASE; |
1938f4a5b Introduce generic... |
347 |
#endif |
1473b12ad lib: fdtdec: Upda... |
348 |
gd->ram_top = gd->ram_base + get_effective_memsize(); |
1938f4a5b Introduce generic... |
349 |
gd->ram_top = board_get_usable_ram_top(gd->mon_len); |
a0ba279ac generic_board: re... |
350 |
gd->relocaddr = gd->ram_top; |
1938f4a5b Introduce generic... |
351 352 |
debug("Ram top: %08lX ", (ulong)gd->ram_top); |
ec3b48201 common: fix inclu... |
353 |
#if defined(CONFIG_MP) && (defined(CONFIG_MPC86xx) || defined(CONFIG_E500)) |
e4fef6cfc Adjust board_f.c ... |
354 355 356 357 |
/* * We need to make sure the location we intend to put secondary core * boot code is reserved and not used by any part of u-boot */ |
a0ba279ac generic_board: re... |
358 359 360 361 |
if (gd->relocaddr > determine_mp_bootpg(NULL)) { gd->relocaddr = determine_mp_bootpg(NULL); debug("Reserving MP boot page to %08lx ", gd->relocaddr); |
e4fef6cfc Adjust board_f.c ... |
362 363 |
} #endif |
1938f4a5b Introduce generic... |
364 365 |
return 0; } |
1938f4a5b Introduce generic... |
366 367 368 369 370 |
#ifdef CONFIG_PRAM /* reserve protected RAM */ static int reserve_pram(void) { ulong reg; |
bfebc8c96 env: Rename geten... |
371 |
reg = env_get_ulong("pram", 10, CONFIG_PRAM); |
a0ba279ac generic_board: re... |
372 |
gd->relocaddr -= (reg << 10); /* size is in kB */ |
1938f4a5b Introduce generic... |
373 374 |
debug("Reserving %ldk for protected RAM at %08lx ", reg, |
a0ba279ac generic_board: re... |
375 |
gd->relocaddr); |
1938f4a5b Introduce generic... |
376 377 378 379 380 381 382 |
return 0; } #endif /* CONFIG_PRAM */ /* Round memory pointer down to next 4 kB limit */ static int reserve_round_4k(void) { |
a0ba279ac generic_board: re... |
383 |
gd->relocaddr &= ~(4096 - 1); |
1938f4a5b Introduce generic... |
384 385 |
return 0; } |
80d4bcd3e board_f: Move the... |
386 |
#ifdef CONFIG_ARM |
60873f736 common: board_f: ... |
387 |
__weak int reserve_mmu(void) |
1938f4a5b Introduce generic... |
388 |
{ |
100150254 CONFIG_SPL_SYS_[D... |
389 |
#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) |
1938f4a5b Introduce generic... |
390 |
/* reserve TLB table */ |
cce6be7f0 arm64: generic bo... |
391 |
gd->arch.tlb_size = PGTABLE_SIZE; |
a0ba279ac generic_board: re... |
392 |
gd->relocaddr -= gd->arch.tlb_size; |
1938f4a5b Introduce generic... |
393 394 |
/* round down to next 64 kB limit */ |
a0ba279ac generic_board: re... |
395 |
gd->relocaddr &= ~(0x10000 - 1); |
1938f4a5b Introduce generic... |
396 |
|
a0ba279ac generic_board: re... |
397 |
gd->arch.tlb_addr = gd->relocaddr; |
1938f4a5b Introduce generic... |
398 399 400 |
debug("TLB table from %08lx to %08lx ", gd->arch.tlb_addr, gd->arch.tlb_addr + gd->arch.tlb_size); |
50e93b956 armv8: Add tlb_al... |
401 402 403 404 405 406 407 408 |
#ifdef CONFIG_SYS_MEM_RESERVE_SECURE /* * Record allocated tlb_addr in case gd->tlb_addr to be overwritten * with location within secure ram. */ gd->arch.tlb_allocated = gd->arch.tlb_addr; #endif |
80d4bcd3e board_f: Move the... |
409 |
#endif |
50e93b956 armv8: Add tlb_al... |
410 |
|
1938f4a5b Introduce generic... |
411 412 413 |
return 0; } #endif |
5a5419451 dm: common: Add m... |
414 415 |
static int reserve_video(void) { |
0f079eb51 board_f: Put vide... |
416 |
#ifdef CONFIG_DM_VIDEO |
5a5419451 dm: common: Add m... |
417 418 419 420 421 422 423 424 |
ulong addr; int ret; addr = gd->relocaddr; ret = video_reserve(&addr); if (ret) return ret; gd->relocaddr = addr; |
0f079eb51 board_f: Put vide... |
425 |
#elif defined(CONFIG_LCD) |
5a5419451 dm: common: Add m... |
426 |
# ifdef CONFIG_FB_ADDR |
1938f4a5b Introduce generic... |
427 |
gd->fb_base = CONFIG_FB_ADDR; |
5a5419451 dm: common: Add m... |
428 |
# else |
1938f4a5b Introduce generic... |
429 |
/* reserve memory for LCD display (always full pages) */ |
a0ba279ac generic_board: re... |
430 431 |
gd->relocaddr = lcd_setmem(gd->relocaddr); gd->fb_base = gd->relocaddr; |
5a5419451 dm: common: Add m... |
432 |
# endif /* CONFIG_FB_ADDR */ |
0f079eb51 board_f: Put vide... |
433 |
#endif |
e4fef6cfc Adjust board_f.c ... |
434 435 436 |
return 0; } |
e4fef6cfc Adjust board_f.c ... |
437 |
|
8703ef3fd common: Move LCD ... |
438 439 440 441 442 |
static int reserve_trace(void) { #ifdef CONFIG_TRACE gd->relocaddr -= CONFIG_TRACE_BUFFER_SIZE; gd->trace_buff = map_sysmem(gd->relocaddr, CONFIG_TRACE_BUFFER_SIZE); |
7ea335795 trace: trace buff... |
443 444 445 |
debug("Reserving %luk for trace data at: %08lx ", (unsigned long)CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr); |
8703ef3fd common: Move LCD ... |
446 447 448 449 |
#endif return 0; } |
1938f4a5b Introduce generic... |
450 451 |
static int reserve_uboot(void) { |
ff2b2ba84 board_f: Only res... |
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
if (!(gd->flags & GD_FLG_SKIP_RELOC)) { /* * reserve memory for U-Boot code, data & bss * round down to next 4 kB limit */ gd->relocaddr -= gd->mon_len; gd->relocaddr &= ~(4096 - 1); #if defined(CONFIG_E500) || defined(CONFIG_MIPS) /* round down to next 64 kB limit so that IVPR stays aligned */ gd->relocaddr &= ~(65536 - 1); #endif debug("Reserving %ldk for U-Boot at: %08lx ", gd->mon_len >> 10, gd->relocaddr); } |
a0ba279ac generic_board: re... |
468 469 |
gd->start_addr_sp = gd->relocaddr; |
1938f4a5b Introduce generic... |
470 471 |
return 0; } |
5f7adb5b1 board_f: reserve ... |
472 473 474 |
#ifdef CONFIG_SYS_NONCACHED_MEMORY static int reserve_noncached(void) { |
5e0404ff8 board_f: fix nonc... |
475 476 477 478 479 480 481 482 483 484 485 486 |
/* * The value of gd->start_addr_sp must match the value of malloc_start * calculated in boatrd_f.c:initr_malloc(), which is passed to * board_r.c:mem_malloc_init() and then used by * cache.c:noncached_init() * * These calculations must match the code in cache.c:noncached_init() */ gd->start_addr_sp = ALIGN(gd->start_addr_sp, MMU_SECTION_SIZE) - MMU_SECTION_SIZE; gd->start_addr_sp -= ALIGN(CONFIG_SYS_NONCACHED_MEMORY, MMU_SECTION_SIZE); |
5f7adb5b1 board_f: reserve ... |
487 488 489 490 491 492 493 |
debug("Reserving %dM for noncached_alloc() at: %08lx ", CONFIG_SYS_NONCACHED_MEMORY >> 20, gd->start_addr_sp); return 0; } #endif |
1938f4a5b Introduce generic... |
494 495 496 |
/* reserve memory for malloc() area */ static int reserve_malloc(void) { |
a0ba279ac generic_board: re... |
497 |
gd->start_addr_sp = gd->start_addr_sp - TOTAL_MALLOC_LEN; |
1938f4a5b Introduce generic... |
498 499 |
debug("Reserving %dk for malloc() at: %08lx ", |
16ef14742 common: board_f: ... |
500 |
TOTAL_MALLOC_LEN >> 10, gd->start_addr_sp); |
5f7adb5b1 board_f: reserve ... |
501 502 503 |
#ifdef CONFIG_SYS_NONCACHED_MEMORY reserve_noncached(); #endif |
1938f4a5b Introduce generic... |
504 505 506 507 508 509 |
return 0; } /* (permanently) allocate a Board Info struct */ static int reserve_board(void) { |
d54d7eb96 support blackfin ... |
510 511 512 513 514 515 516 517 |
if (!gd->bd) { gd->start_addr_sp -= sizeof(bd_t); gd->bd = (bd_t *)map_sysmem(gd->start_addr_sp, sizeof(bd_t)); memset(gd->bd, '\0', sizeof(bd_t)); debug("Reserving %zu Bytes for Board Info at: %08lx ", sizeof(bd_t), gd->start_addr_sp); } |
1938f4a5b Introduce generic... |
518 519 520 521 522 523 524 525 526 527 528 529 530 |
return 0; } static int setup_machine(void) { #ifdef CONFIG_MACH_TYPE gd->bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */ #endif return 0; } static int reserve_global_data(void) { |
a0ba279ac generic_board: re... |
531 532 |
gd->start_addr_sp -= sizeof(gd_t); gd->new_gd = (gd_t *)map_sysmem(gd->start_addr_sp, sizeof(gd_t)); |
1938f4a5b Introduce generic... |
533 534 |
debug("Reserving %zu Bytes for Global Data at: %08lx ", |
16ef14742 common: board_f: ... |
535 |
sizeof(gd_t), gd->start_addr_sp); |
1938f4a5b Introduce generic... |
536 537 538 539 540 |
return 0; } static int reserve_fdt(void) { |
e9acb9ea4 common: board: Do... |
541 |
#ifndef CONFIG_OF_EMBED |
1938f4a5b Introduce generic... |
542 |
/* |
4c509343a Fix comment nits ... |
543 |
* If the device tree is sitting immediately above our image then we |
1938f4a5b Introduce generic... |
544 545 546 547 548 |
* must relocate it. If it is embedded in the data section, then it * will be relocated with other data. */ if (gd->fdt_blob) { gd->fdt_size = ALIGN(fdt_totalsize(gd->fdt_blob) + 0x1000, 32); |
a0ba279ac generic_board: re... |
549 550 |
gd->start_addr_sp -= gd->fdt_size; gd->new_fdt = map_sysmem(gd->start_addr_sp, gd->fdt_size); |
a733b06b6 sandbox: Switch o... |
551 552 |
debug("Reserving %lu Bytes for FDT at: %08lx ", |
a0ba279ac generic_board: re... |
553 |
gd->fdt_size, gd->start_addr_sp); |
1938f4a5b Introduce generic... |
554 |
} |
e9acb9ea4 common: board: Do... |
555 |
#endif |
1938f4a5b Introduce generic... |
556 557 558 |
return 0; } |
25e7dc6a6 bootstage: Suppor... |
559 560 561 562 563 564 565 566 567 568 569 570 571 572 |
static int reserve_bootstage(void) { #ifdef CONFIG_BOOTSTAGE int size = bootstage_get_size(); gd->start_addr_sp -= size; gd->new_bootstage = map_sysmem(gd->start_addr_sp, size); debug("Reserving %#x Bytes for bootstage at: %08lx ", size, gd->start_addr_sp); #endif return 0; } |
d6f877123 common: move boar... |
573 |
__weak int arch_reserve_stacks(void) |
1938f4a5b Introduce generic... |
574 |
{ |
68145d4c7 common/board_f: f... |
575 576 |
return 0; } |
8cae8a68e Add spl load feature |
577 |
|
68145d4c7 common/board_f: f... |
578 579 580 |
static int reserve_stacks(void) { /* make stack pointer 16-byte aligned */ |
a0ba279ac generic_board: re... |
581 582 |
gd->start_addr_sp -= 16; gd->start_addr_sp &= ~0xf; |
1938f4a5b Introduce generic... |
583 584 |
/* |
4c509343a Fix comment nits ... |
585 |
* let the architecture-specific code tailor gd->start_addr_sp and |
68145d4c7 common/board_f: f... |
586 |
* gd->irq_sp |
1938f4a5b Introduce generic... |
587 |
*/ |
68145d4c7 common/board_f: f... |
588 |
return arch_reserve_stacks(); |
1938f4a5b Introduce generic... |
589 |
} |
f0293d33b bloblist: Locate ... |
590 591 592 |
static int reserve_bloblist(void) { #ifdef CONFIG_BLOBLIST |
5074a8a3c bloblist: Reserve... |
593 |
gd->start_addr_sp &= ~0xf; |
f0293d33b bloblist: Locate ... |
594 595 596 597 598 599 |
gd->start_addr_sp -= CONFIG_BLOBLIST_SIZE; gd->new_bloblist = map_sysmem(gd->start_addr_sp, CONFIG_BLOBLIST_SIZE); #endif return 0; } |
1938f4a5b Introduce generic... |
600 601 |
static int display_new_sp(void) { |
a0ba279ac generic_board: re... |
602 603 |
debug("New Stack Pointer is: %08lx ", gd->start_addr_sp); |
1938f4a5b Introduce generic... |
604 605 606 |
return 0; } |
e2099d78c common: sh: add n... |
607 608 |
#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ defined(CONFIG_SH) |
e4fef6cfc Adjust board_f.c ... |
609 610 611 612 613 614 615 |
static int setup_board_part1(void) { bd_t *bd = gd->bd; /* * Save local variables to board info struct */ |
e4fef6cfc Adjust board_f.c ... |
616 617 618 619 620 621 622 |
bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; /* start of memory */ bd->bi_memsize = gd->ram_size; /* size in bytes */ #ifdef CONFIG_SYS_SRAM_BASE bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */ bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM */ #endif |
502589777 powerpc, 5xx: rem... |
623 |
#if defined(CONFIG_E500) || defined(CONFIG_MPC86xx) |
e4fef6cfc Adjust board_f.c ... |
624 625 |
bd->bi_immr_base = CONFIG_SYS_IMMR; /* base of IMMR register */ #endif |
064b55cfc powerpc, 5xxx, 51... |
626 |
#if defined(CONFIG_M68K) |
e4fef6cfc Adjust board_f.c ... |
627 628 629 630 631 |
bd->bi_mbar_base = CONFIG_SYS_MBAR; /* base of internal registers */ #endif #if defined(CONFIG_MPC83xx) bd->bi_immrbar = CONFIG_SYS_IMMR; #endif |
e4fef6cfc Adjust board_f.c ... |
632 633 634 |
return 0; } |
fb3db6357 common/board_f: e... |
635 |
#endif |
e4fef6cfc Adjust board_f.c ... |
636 |
|
fb3db6357 common/board_f: e... |
637 |
#if defined(CONFIG_PPC) || defined(CONFIG_M68K) |
e4fef6cfc Adjust board_f.c ... |
638 639 640 641 642 643 644 645 646 647 648 649 |
static int setup_board_part2(void) { bd_t *bd = gd->bd; bd->bi_intfreq = gd->cpu_clk; /* Internal Freq, in Hz */ bd->bi_busfreq = gd->bus_clk; /* Bus Freq, in Hz */ #if defined(CONFIG_CPM2) bd->bi_cpmfreq = gd->arch.cpm_clk; bd->bi_brgfreq = gd->arch.brg_clk; bd->bi_sccfreq = gd->arch.scc_clk; bd->bi_vco = gd->arch.vco_out; #endif /* CONFIG_CPM2 */ |
1313db48e m68k: Add generic... |
650 651 652 653 654 655 656 657 |
#if defined(CONFIG_M68K) && defined(CONFIG_PCI) bd->bi_pcifreq = gd->pci_clk; #endif #if defined(CONFIG_EXTRA_CLOCK) bd->bi_inpfreq = gd->arch.inp_clk; /* input Freq in Hz */ bd->bi_vcofreq = gd->arch.vco_clk; /* vco Freq in Hz */ bd->bi_flbfreq = gd->arch.flb_clk; /* flexbus Freq in Hz */ #endif |
e4fef6cfc Adjust board_f.c ... |
658 659 660 661 |
return 0; } #endif |
1938f4a5b Introduce generic... |
662 663 664 665 666 667 668 669 670 |
#ifdef CONFIG_POST static int init_post(void) { post_bootmode_init(); post_run(NULL, POST_ROM | post_bootmode_get(0)); return 0; } #endif |
1938f4a5b Introduce generic... |
671 672 |
static int reloc_fdt(void) { |
e9acb9ea4 common: board: Do... |
673 |
#ifndef CONFIG_OF_EMBED |
f05ad9ba4 Add a way to skip... |
674 675 |
if (gd->flags & GD_FLG_SKIP_RELOC) return 0; |
1938f4a5b Introduce generic... |
676 677 678 679 |
if (gd->new_fdt) { memcpy(gd->new_fdt, gd->fdt_blob, gd->fdt_size); gd->fdt_blob = gd->new_fdt; } |
e9acb9ea4 common: board: Do... |
680 |
#endif |
1938f4a5b Introduce generic... |
681 682 683 |
return 0; } |
25e7dc6a6 bootstage: Suppor... |
684 685 686 687 688 689 690 691 692 693 694 695 696 |
static int reloc_bootstage(void) { #ifdef CONFIG_BOOTSTAGE if (gd->flags & GD_FLG_SKIP_RELOC) return 0; if (gd->new_bootstage) { int size = bootstage_get_size(); debug("Copying bootstage from %p to %p, size %x ", gd->bootstage, gd->new_bootstage, size); memcpy(gd->new_bootstage, gd->bootstage, size); gd->bootstage = gd->new_bootstage; |
ac9cd4805 bootstage: Correc... |
697 |
bootstage_relocate(); |
25e7dc6a6 bootstage: Suppor... |
698 699 700 701 702 |
} #endif return 0; } |
f0293d33b bloblist: Locate ... |
703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 |
static int reloc_bloblist(void) { #ifdef CONFIG_BLOBLIST if (gd->flags & GD_FLG_SKIP_RELOC) return 0; if (gd->new_bloblist) { int size = CONFIG_BLOBLIST_SIZE; debug("Copying bloblist from %p to %p, size %x ", gd->bloblist, gd->new_bloblist, size); memcpy(gd->new_bloblist, gd->bloblist, size); gd->bloblist = gd->new_bloblist; } #endif return 0; } |
1938f4a5b Introduce generic... |
721 722 |
static int setup_reloc(void) { |
f05ad9ba4 Add a way to skip... |
723 724 725 726 727 |
if (gd->flags & GD_FLG_SKIP_RELOC) { debug("Skipping relocation due to flag "); return 0; } |
d54d7eb96 support blackfin ... |
728 |
#ifdef CONFIG_SYS_TEXT_BASE |
53207bfd7 board_f: fix calc... |
729 730 731 |
#ifdef ARM gd->reloc_off = gd->relocaddr - (unsigned long)__image_copy_start; #elif defined(CONFIG_M68K) |
e310b93ec m68k: add generic... |
732 733 734 735 736 |
/* * On all ColdFire arch cpu, monitor code starts always * just after the default vector table location, so at 0x400 */ gd->reloc_off = gd->relocaddr - (CONFIG_SYS_TEXT_BASE + 0x400); |
001d1885f sandbox: Improve ... |
737 |
#elif !defined(CONFIG_SANDBOX) |
53207bfd7 board_f: fix calc... |
738 |
gd->reloc_off = gd->relocaddr - CONFIG_SYS_TEXT_BASE; |
e310b93ec m68k: add generic... |
739 |
#endif |
d54d7eb96 support blackfin ... |
740 |
#endif |
1938f4a5b Introduce generic... |
741 742 743 744 |
memcpy(gd->new_gd, (char *)gd, sizeof(gd_t)); debug("Relocation Offset is: %08lx ", gd->reloc_off); |
a733b06b6 sandbox: Switch o... |
745 746 |
debug("Relocating to %08lx, new gd at %08lx, sp at %08lx ", |
a0ba279ac generic_board: re... |
747 748 |
gd->relocaddr, (ulong)map_to_sysmem(gd->new_gd), gd->start_addr_sp); |
1938f4a5b Introduce generic... |
749 750 751 |
return 0; } |
2a792753d dm: Add callback ... |
752 753 754 755 756 757 |
#ifdef CONFIG_OF_BOARD_FIXUP static int fix_fdt(void) { return board_fix_fdt((void *)gd->fdt_blob); } #endif |
1938f4a5b Introduce generic... |
758 |
/* ARM calls relocate_code from its crt0.S */ |
530f27eab x86: board_f: Upd... |
759 760 |
#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \ !CONFIG_IS_ENABLED(X86_64) |
1938f4a5b Introduce generic... |
761 762 763 |
static int jump_to_copy(void) { |
f05ad9ba4 Add a way to skip... |
764 765 |
if (gd->flags & GD_FLG_SKIP_RELOC) return 0; |
48a338067 x86: Adjust board... |
766 767 768 769 770 771 772 773 |
/* * x86 is special, but in a nice way. It uses a trampoline which * enables the dcache if possible. * * For now, other archs use relocate_code(), which is implemented * similarly for all archs. When we do generic relocation, hopefully * we can make all archs enable the dcache prior to relocation. */ |
3fb801636 arc: clean-up ini... |
774 |
#if defined(CONFIG_X86) || defined(CONFIG_ARC) |
48a338067 x86: Adjust board... |
775 776 777 778 779 780 |
/* * SDRAM and console are now initialised. The final stack can now * be setup in SDRAM. Code execution will continue in Flash, but * with the stack in SDRAM and Global Data in temporary memory * (CPU cache) */ |
f0c7d9c74 x86: Switch to us... |
781 |
arch_setup_gd(gd->new_gd); |
48a338067 x86: Adjust board... |
782 783 |
board_init_f_r_trampoline(gd->start_addr_sp); #else |
a0ba279ac generic_board: re... |
784 |
relocate_code(gd->start_addr_sp, gd->new_gd, gd->relocaddr); |
48a338067 x86: Adjust board... |
785 |
#endif |
1938f4a5b Introduce generic... |
786 787 788 789 790 791 |
return 0; } #endif /* Record the board_init_f() bootstage (after arch_cpu_init()) */ |
b383d6c05 bootstage: Conver... |
792 |
static int initf_bootstage(void) |
1938f4a5b Introduce generic... |
793 |
{ |
baa7d345f board_f: Use IS_E... |
794 795 |
bool from_spl = IS_ENABLED(CONFIG_SPL_BOOTSTAGE) && IS_ENABLED(CONFIG_BOOTSTAGE_STASH); |
b383d6c05 bootstage: Conver... |
796 |
int ret; |
824bb1b45 bootstage: Suppor... |
797 |
ret = bootstage_init(!from_spl); |
b383d6c05 bootstage: Conver... |
798 799 |
if (ret) return ret; |
824bb1b45 bootstage: Suppor... |
800 801 802 803 804 805 806 807 808 809 810 |
if (from_spl) { const void *stash = map_sysmem(CONFIG_BOOTSTAGE_STASH_ADDR, CONFIG_BOOTSTAGE_STASH_SIZE); ret = bootstage_unstash(stash, CONFIG_BOOTSTAGE_STASH_SIZE); if (ret && ret != -ENOENT) { debug("Failed to unstash bootstage: err=%d ", ret); return ret; } } |
b383d6c05 bootstage: Conver... |
811 |
|
1938f4a5b Introduce generic... |
812 813 814 815 |
bootstage_mark_name(BOOTSTAGE_ID_START_UBOOT_F, "board_init_f"); return 0; } |
9854a8748 console: Add a co... |
816 817 |
static int initf_console_record(void) { |
f1896c45c spl: make SPL and... |
818 |
#if defined(CONFIG_CONSOLE_RECORD) && CONFIG_VAL(SYS_MALLOC_F_LEN) |
9854a8748 console: Add a co... |
819 820 821 822 823 |
return console_record_init(); #else return 0; #endif } |
ab7cd6279 dm: Support drive... |
824 825 |
static int initf_dm(void) { |
f1896c45c spl: make SPL and... |
826 |
#if defined(CONFIG_DM) && CONFIG_VAL(SYS_MALLOC_F_LEN) |
ab7cd6279 dm: Support drive... |
827 |
int ret; |
63c5bf48d bootstage: Record... |
828 |
bootstage_start(BOOTSTATE_ID_ACCUM_DM_F, "dm_f"); |
ab7cd6279 dm: Support drive... |
829 |
ret = dm_init_and_scan(true); |
63c5bf48d bootstage: Record... |
830 |
bootstage_accum(BOOTSTATE_ID_ACCUM_DM_F); |
ab7cd6279 dm: Support drive... |
831 832 833 |
if (ret) return ret; #endif |
1057e6cfe timer: Set up the... |
834 835 836 837 838 |
#ifdef CONFIG_TIMER_EARLY ret = dm_timer_init(); if (ret) return ret; #endif |
ab7cd6279 dm: Support drive... |
839 840 841 |
return 0; } |
146251f87 Allow architectur... |
842 843 844 845 846 |
/* Architecture-specific memory reservation */ __weak int reserve_arch(void) { return 0; } |
d4c671cc2 dm: Add a new CPU... |
847 848 849 850 |
__weak int arch_cpu_init_dm(void) { return 0; } |
016e4ae7e common/board_f.c:... |
851 852 853 854 |
__weak int checkcpu(void) { return 0; } |
fbf9c154a board_f: Make cle... |
855 856 857 858 |
__weak int clear_bss(void) { return 0; } |
4acff4524 board_f/r: Use st... |
859 |
static const init_fnc_t init_sequence_f[] = { |
1938f4a5b Introduce generic... |
860 |
setup_mon_len, |
b45122fdf fdt: sandbox: Mov... |
861 |
#ifdef CONFIG_OF_CONTROL |
0879361fd fdt: Rename setup... |
862 |
fdtdec_setup, |
b45122fdf fdt: sandbox: Mov... |
863 |
#endif |
7ef8e9b09 trace: undefined ... |
864 |
#ifdef CONFIG_TRACE_EARLY |
71c52dba2 Add trace support... |
865 |
trace_early_init, |
d210718d9 common/board_f.c:... |
866 |
#endif |
768e0f52f Move early malloc... |
867 |
initf_malloc, |
af1bc0cf4 log: Plumb loggin... |
868 |
log_init, |
5ac44a554 bootstage: Init a... |
869 |
initf_bootstage, /* uses its own timer, so does not need DM */ |
f0293d33b bloblist: Locate ... |
870 871 872 |
#ifdef CONFIG_BLOBLIST bloblist_init, #endif |
b0edea3c2 spl: Add support ... |
873 |
setup_spl_handoff, |
9854a8748 console: Add a co... |
874 |
initf_console_record, |
671549e5b board_f: x86: Ren... |
875 876 |
#if defined(CONFIG_HAVE_FSP) arch_fsp_init, |
a52a068eb x86: fsp: Delay x... |
877 |
#endif |
1938f4a5b Introduce generic... |
878 |
arch_cpu_init, /* basic arch cpu dependent setup */ |
8ebf50692 board_f: Add a ma... |
879 |
mach_cpu_init, /* SoC/machine dependent CPU setup */ |
3ea0953d3 dm: Move pre-relo... |
880 |
initf_dm, |
d4c671cc2 dm: Add a new CPU... |
881 |
arch_cpu_init_dm, |
1938f4a5b Introduce generic... |
882 883 884 |
#if defined(CONFIG_BOARD_EARLY_INIT_F) board_early_init_f, #endif |
727e94a4a powerpc: freescal... |
885 |
#if defined(CONFIG_PPC) || defined(CONFIG_SYS_FSL_CLK) || defined(CONFIG_M68K) |
c252c0685 board_f: powerpc:... |
886 |
/* get CPU and bus clocks according to the environment variable */ |
e4fef6cfc Adjust board_f.c ... |
887 |
get_clocks, /* get CPU and bus clocks (etc.) */ |
1793e7822 board_f: powerpc:... |
888 |
#endif |
0ce452872 board_f: skip tim... |
889 |
#if !defined(CONFIG_M68K) |
1938f4a5b Introduce generic... |
890 |
timer_init, /* initialize timer */ |
0ce452872 board_f: skip tim... |
891 |
#endif |
e4fef6cfc Adjust board_f.c ... |
892 893 894 |
#if defined(CONFIG_BOARD_POSTCLK_INIT) board_postclk_init, #endif |
1938f4a5b Introduce generic... |
895 896 |
env_init, /* initialize environment */ init_baud_rate, /* initialze baudrate settings */ |
370241a1a MA-12973 [AUTO] S... |
897 |
#ifndef CONFIG_ANDROID_AUTO_SUPPORT |
1938f4a5b Introduce generic... |
898 |
serial_init, /* serial communications setup */ |
370241a1a MA-12973 [AUTO] S... |
899 |
#endif |
1938f4a5b Introduce generic... |
900 901 902 |
console_init_f, /* stage 1 init of console */ display_options, /* say that we are here */ display_text_info, /* show debugging info if required */ |
e4fef6cfc Adjust board_f.c ... |
903 |
checkcpu, |
23471aed5 board_f: Add rese... |
904 905 906 |
#if defined(CONFIG_SYSRESET) print_resetinfo, #endif |
cc664000c Drop the static i... |
907 |
#if defined(CONFIG_DISPLAY_CPUINFO) |
1938f4a5b Introduce generic... |
908 |
print_cpuinfo, /* display cpu info (and speed) */ |
cc664000c Drop the static i... |
909 |
#endif |
af9e6ad4a board_f: Add new ... |
910 911 912 |
#if defined(CONFIG_DTB_RESELECT) embedded_dtb_select, #endif |
1938f4a5b Introduce generic... |
913 |
#if defined(CONFIG_DISPLAY_BOARDINFO) |
0365ffcc0 generic-board: sh... |
914 |
show_board_info, |
1938f4a5b Introduce generic... |
915 |
#endif |
e4fef6cfc Adjust board_f.c ... |
916 917 918 919 920 |
INIT_FUNC_WATCHDOG_INIT #if defined(CONFIG_MISC_INIT_F) misc_init_f, #endif INIT_FUNC_WATCHDOG_RESET |
69153988a i2c: Finish dropp... |
921 |
#if defined(CONFIG_SYS_I2C) |
e4fef6cfc Adjust board_f.c ... |
922 923 |
init_func_i2c, #endif |
1fab98fb9 common: board_f: ... |
924 925 926 |
#if defined(CONFIG_VID) && !defined(CONFIG_SPL) init_func_vid, #endif |
1938f4a5b Introduce generic... |
927 |
announce_dram_init, |
1938f4a5b Introduce generic... |
928 |
dram_init, /* configure available RAM banks */ |
e4fef6cfc Adjust board_f.c ... |
929 930 931 932 933 934 935 936 |
#ifdef CONFIG_POST post_init_f, #endif INIT_FUNC_WATCHDOG_RESET #if defined(CONFIG_SYS_DRAM_TEST) testdram, #endif /* CONFIG_SYS_DRAM_TEST */ INIT_FUNC_WATCHDOG_RESET |
1938f4a5b Introduce generic... |
937 938 939 |
#ifdef CONFIG_POST init_post, #endif |
e4fef6cfc Adjust board_f.c ... |
940 |
INIT_FUNC_WATCHDOG_RESET |
1938f4a5b Introduce generic... |
941 942 943 944 945 946 947 948 949 950 951 952 953 |
/* * Now that we have DRAM mapped and working, we can * relocate the code and continue running from DRAM. * * Reserve memory at end of RAM for (top down in that order): * - area that won't get touched by U-Boot and Linux (optional) * - kernel log buffer * - protected RAM * - LCD framebuffer * - monitor code * - board info struct */ setup_dest_addr, |
1938f4a5b Introduce generic... |
954 955 956 957 |
#ifdef CONFIG_PRAM reserve_pram, #endif reserve_round_4k, |
80d4bcd3e board_f: Move the... |
958 |
#ifdef CONFIG_ARM |
1938f4a5b Introduce generic... |
959 960 |
reserve_mmu, #endif |
5a5419451 dm: common: Add m... |
961 |
reserve_video, |
8703ef3fd common: Move LCD ... |
962 |
reserve_trace, |
1938f4a5b Introduce generic... |
963 964 965 966 967 968 |
reserve_uboot, reserve_malloc, reserve_board, setup_machine, reserve_global_data, reserve_fdt, |
25e7dc6a6 bootstage: Suppor... |
969 |
reserve_bootstage, |
f0293d33b bloblist: Locate ... |
970 |
reserve_bloblist, |
146251f87 Allow architectur... |
971 |
reserve_arch, |
1938f4a5b Introduce generic... |
972 |
reserve_stacks, |
76b00aca4 board_f: Drop set... |
973 |
dram_init_banksize, |
1938f4a5b Introduce generic... |
974 |
show_dram_config, |
e2099d78c common: sh: add n... |
975 976 |
#if defined(CONFIG_M68K) || defined(CONFIG_MIPS) || defined(CONFIG_PPC) || \ defined(CONFIG_SH) |
e4fef6cfc Adjust board_f.c ... |
977 |
setup_board_part1, |
fb3db6357 common/board_f: e... |
978 979 |
#endif #if defined(CONFIG_PPC) || defined(CONFIG_M68K) |
e4fef6cfc Adjust board_f.c ... |
980 981 982 |
INIT_FUNC_WATCHDOG_RESET setup_board_part2, #endif |
1938f4a5b Introduce generic... |
983 |
display_new_sp, |
2a792753d dm: Add callback ... |
984 985 986 |
#ifdef CONFIG_OF_BOARD_FIXUP fix_fdt, #endif |
e4fef6cfc Adjust board_f.c ... |
987 |
INIT_FUNC_WATCHDOG_RESET |
1938f4a5b Introduce generic... |
988 |
reloc_fdt, |
25e7dc6a6 bootstage: Suppor... |
989 |
reloc_bootstage, |
f0293d33b bloblist: Locate ... |
990 |
reloc_bloblist, |
1938f4a5b Introduce generic... |
991 |
setup_reloc, |
3fb801636 arc: clean-up ini... |
992 |
#if defined(CONFIG_X86) || defined(CONFIG_ARC) |
313aef37a x86: board_f: Adj... |
993 |
copy_uboot_to_ram, |
313aef37a x86: board_f: Adj... |
994 995 |
do_elf_reloc_fixups, #endif |
de5e5cea0 xtensa: add suppo... |
996 |
clear_bss, |
530f27eab x86: board_f: Upd... |
997 998 |
#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \ !CONFIG_IS_ENABLED(X86_64) |
1938f4a5b Introduce generic... |
999 1000 1001 1002 1003 1004 1005 |
jump_to_copy, #endif NULL, }; void board_init_f(ulong boot_flags) { |
1938f4a5b Introduce generic... |
1006 |
gd->flags = boot_flags; |
9aed5a277 board_f: explicit... |
1007 |
gd->have_console = 0; |
1938f4a5b Introduce generic... |
1008 1009 1010 |
if (initcall_run_list(init_sequence_f)) hang(); |
9b2174984 efi: Avoid using ... |
1011 |
#if !defined(CONFIG_ARM) && !defined(CONFIG_SANDBOX) && \ |
264d298fd arc: Introduce a ... |
1012 1013 |
!defined(CONFIG_EFI_APP) && !CONFIG_IS_ENABLED(X86_64) && \ !defined(CONFIG_ARC) |
1938f4a5b Introduce generic... |
1014 1015 1016 1017 |
/* NOTREACHED - jump_to_copy() does not return */ hang(); #endif } |
3fb801636 arc: clean-up ini... |
1018 |
#if defined(CONFIG_X86) || defined(CONFIG_ARC) |
48a338067 x86: Adjust board... |
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 |
/* * For now this code is only used on x86. * * init_sequence_f_r is the list of init functions which are run when * U-Boot is executing from Flash with a semi-limited 'C' environment. * The following limitations must be considered when implementing an * '_f_r' function: * - 'static' variables are read-only * - Global Data (gd->xxx) is read/write * * The '_f_r' sequence must, as a minimum, copy U-Boot to RAM (if * supported). It _should_, if possible, copy global data to RAM and * initialise the CPU caches (to speed up the relocation process) * * NOTE: At present only x86 uses this route, but it is intended that * all archs will move to this when generic relocation is implemented. */ |
4acff4524 board_f/r: Use st... |
1036 |
static const init_fnc_t init_sequence_f_r[] = { |
530f27eab x86: board_f: Upd... |
1037 |
#if !CONFIG_IS_ENABLED(X86_64) |
48a338067 x86: Adjust board... |
1038 |
init_cache_f_r, |
530f27eab x86: board_f: Upd... |
1039 |
#endif |
48a338067 x86: Adjust board... |
1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 |
NULL, }; void board_init_f_r(void) { if (initcall_run_list(init_sequence_f_r)) hang(); /* |
e4d6ab0c2 x86: Allow use of... |
1050 1051 1052 |
* The pre-relocation drivers may be using memory that has now gone * away. Mark serial as unavailable - this will fall back to the debug * UART if available. |
af1bc0cf4 log: Plumb loggin... |
1053 1054 |
* * Do the same with log drivers since the memory may not be available. |
e4d6ab0c2 x86: Allow use of... |
1055 |
*/ |
af1bc0cf4 log: Plumb loggin... |
1056 |
gd->flags &= ~(GD_FLG_SERIAL_READY | GD_FLG_LOG_READY); |
5ee94b4f4 board_f: Drop the... |
1057 1058 1059 |
#ifdef CONFIG_TIMER gd->timer = NULL; #endif |
e4d6ab0c2 x86: Allow use of... |
1060 1061 |
/* |
48a338067 x86: Adjust board... |
1062 1063 1064 1065 |
* U-Boot has been copied into SDRAM, the BSS has been cleared etc. * Transfer execution from Flash to RAM by calculating the address * of the in-RAM copy of board_init_r() and calling it */ |
7bf9f20d0 common/board_f: i... |
1066 |
(board_init_r + gd->reloc_off)((gd_t *)gd, gd->relocaddr); |
48a338067 x86: Adjust board... |
1067 1068 1069 1070 |
/* NOTREACHED - board_init_r() does not return */ hang(); } |
5bcd19aa2 common/board_f: m... |
1071 |
#endif /* CONFIG_X86 */ |