blob: 318f23b6461dd1a7589cdc34cf1d1bbbc649e6ab [file] [log] [blame]
Stefan Roese07038ad2013-04-02 10:37:04 +02001/*
2 * Copyright (C) 2013 Stefan Roese <sr@denx.de>
3 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Stefan Roese07038ad2013-04-02 10:37:04 +02005 */
6
7#include <common.h>
8#include <spl.h>
9
10DECLARE_GLOBAL_DATA_PTR;
11
12/*
13 * Return selected boot device. On PPC4xx its only NOR flash right now.
14 */
15u32 spl_boot_device(void)
16{
17 return BOOT_DEVICE_NOR;
18}
19
20/*
21 * SPL version of board_init_f()
22 */
23void board_init_f(ulong bootflag)
24{
25 /*
26 * First we need to initialize the SDRAM, so that the real
27 * U-Boot or the OS (Linux) can be loaded
28 */
29 initdram(0);
30
31 /* Clear bss */
32 memset(__bss_start, '\0', __bss_end - __bss_start);
33
34 /*
35 * Init global_data pointer. Has to be done before calling
36 * get_clocks(), as it stores some clock values into gd needed
37 * later on in the serial driver.
38 */
39 /* Pointer is writable since we allocated a register for it */
40 gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
41 /* Clear initial global data */
42 memset((void *)gd, 0, sizeof(gd_t));
43
44 /*
45 * get_clocks() needs to be called so that the serial driver
46 * works correctly
47 */
48 get_clocks();
49
50 /*
51 * Do rudimental console / serial setup
52 */
53 preloader_console_init();
54
55 /*
56 * Call board_init_r() (SPL framework version) to load and boot
57 * real U-Boot or OS
58 */
59 board_init_r(NULL, 0);
60 /* Does not return!!! */
61}