]> git.ipfire.org Git - people/ms/u-boot.git/blame - arch/powerpc/cpu/mpc5xxx/spl_boot.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / arch / powerpc / cpu / mpc5xxx / spl_boot.c
CommitLineData
083f2e08
SR
1/*
2 * Copyright (C) 2012 Stefan Roese <sr@denx.de>
3 *
1a459660 4 * SPDX-License-Identifier: GPL-2.0+
083f2e08
SR
5 */
6
7#include <common.h>
8#include <spl.h>
9
10DECLARE_GLOBAL_DATA_PTR;
11
12/*
13 * Needed to align size SPL image to a 4-byte length
14 */
15u32 end_align __attribute__ ((section(".end_align")));
16
17/*
18 * Return selected boot device. On MPC5200 its only NOR flash right now.
19 */
20u32 spl_boot_device(void)
21{
22 return BOOT_DEVICE_NOR;
23}
24
25/*
26 * SPL version of board_init_f()
27 */
28void board_init_f(ulong bootflag)
29{
30 end_align = (u32)__spl_flash_end;
31
32 /*
b4dc0bdd
SR
33 * On MPC5200, the initial RAM (and gd) is located in the internal
34 * SRAM. So we can actually call the preloader console init code
35 * before calling initdram(). This makes serial output (printf)
36 * available very early, even before SDRAM init, which has been
37 * an U-Boot priciple from day 1.
083f2e08 38 */
083f2e08
SR
39
40 /*
41 * Init global_data pointer. Has to be done before calling
42 * get_clocks(), as it stores some clock values into gd needed
43 * later on in the serial driver.
44 */
45 /* Pointer is writable since we allocated a register for it */
46 gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
47 /* Clear initial global data */
48 memset((void *)gd, 0, sizeof(gd_t));
49
50 /*
51 * get_clocks() needs to be called so that the serial driver
52 * works correctly
53 */
54 get_clocks();
55
56 /*
57 * Do rudimental console / serial setup
58 */
59 preloader_console_init();
60
b4dc0bdd
SR
61 /*
62 * First we need to initialize the SDRAM, so that the real
63 * U-Boot or the OS (Linux) can be loaded
64 */
65 initdram(0);
66
67 /* Clear bss */
3929fb0a 68 memset(__bss_start, '\0', __bss_end - __bss_start);
b4dc0bdd 69
083f2e08
SR
70 /*
71 * Call board_init_r() (SPL framework version) to load and boot
72 * real U-Boot or OS
73 */
74 board_init_r(NULL, 0);
75 /* Does not return!!! */
76}