blob: 9dee12a2c6a2aa93d25358f6cca6412d9b084650 [file] [log] [blame]
Peng Fan203a2272019-03-05 02:32:49 +00001/*
2 * Copyright 2018 NXP
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <dm.h>
Simon Glass2dc9c342020-05-10 11:40:01 -06009#include <image.h>
Simon Glass97589732020-05-10 11:40:02 -060010#include <init.h>
Simon Glass0f2af882020-05-10 11:40:05 -060011#include <log.h>
Peng Fan203a2272019-03-05 02:32:49 +000012#include <spl.h>
13#include <dm/uclass.h>
14#include <dm/device.h>
15#include <dm/uclass-internal.h>
16#include <dm/device-internal.h>
17#include <dm/lists.h>
Peng Fan1b9729a2020-05-05 20:28:40 +080018#include <asm/arch/sys_proto.h>
Peng Fan203a2272019-03-05 02:32:49 +000019
20DECLARE_GLOBAL_DATA_PTR;
21
22void spl_board_init(void)
23{
24 struct udevice *dev;
Peng Fan203a2272019-03-05 02:32:49 +000025
26 uclass_find_first_device(UCLASS_MISC, &dev);
27
28 for (; dev; uclass_find_next_device(&dev)) {
29 if (device_probe(dev))
30 continue;
31 }
32
Peng Fan203a2272019-03-05 02:32:49 +000033 arch_cpu_init();
34
35 board_early_init_f();
36
37 timer_init();
38
39 preloader_console_init();
40
41 puts("Normal Boot\n");
42}
43
Peng Fan1b9729a2020-05-05 20:28:40 +080044void spl_board_prepare_for_boot(void)
45{
46 imx8_power_off_pd_devices(NULL, 0);
47}
48
Peng Fan203a2272019-03-05 02:32:49 +000049#ifdef CONFIG_SPL_LOAD_FIT
50int board_fit_config_name_match(const char *name)
51{
52 /* Just empty function now - can't decide what to choose */
53 debug("%s: %s\n", __func__, name);
54
55 return 0;
56}
57#endif
58
59void board_init_f(ulong dummy)
60{
61 /* Clear global data */
62 memset((void *)gd, 0, sizeof(gd_t));
63
64 /* Clear the BSS. */
65 memset(__bss_start, 0, __bss_end - __bss_start);
66
67 board_init_r(NULL, 0);
68}