blob: 5a0a2f5d2f177ebf3f12a900af917a8fc343ed3c [file] [log] [blame]
Peng Fan0d331c02019-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 Glass4d72caa2020-05-10 11:40:01 -06009#include <image.h>
Peng Fan0d331c02019-03-05 02:32:49 +000010#include <spl.h>
11#include <dm/uclass.h>
12#include <dm/device.h>
13#include <dm/uclass-internal.h>
14#include <dm/device-internal.h>
15#include <dm/lists.h>
Peng Fan231401d2020-05-05 20:28:40 +080016#include <asm/arch/sys_proto.h>
Peng Fan0d331c02019-03-05 02:32:49 +000017
18DECLARE_GLOBAL_DATA_PTR;
19
20void spl_board_init(void)
21{
22 struct udevice *dev;
Peng Fan0d331c02019-03-05 02:32:49 +000023
24 uclass_find_first_device(UCLASS_MISC, &dev);
25
26 for (; dev; uclass_find_next_device(&dev)) {
27 if (device_probe(dev))
28 continue;
29 }
30
Peng Fan0d331c02019-03-05 02:32:49 +000031 arch_cpu_init();
32
33 board_early_init_f();
34
35 timer_init();
36
37 preloader_console_init();
38
39 puts("Normal Boot\n");
40}
41
Peng Fan231401d2020-05-05 20:28:40 +080042void spl_board_prepare_for_boot(void)
43{
44 imx8_power_off_pd_devices(NULL, 0);
45}
46
Peng Fan0d331c02019-03-05 02:32:49 +000047#ifdef CONFIG_SPL_LOAD_FIT
48int board_fit_config_name_match(const char *name)
49{
50 /* Just empty function now - can't decide what to choose */
51 debug("%s: %s\n", __func__, name);
52
53 return 0;
54}
55#endif
56
57void board_init_f(ulong dummy)
58{
59 /* Clear global data */
60 memset((void *)gd, 0, sizeof(gd_t));
61
62 /* Clear the BSS. */
63 memset(__bss_start, 0, __bss_end - __bss_start);
64
65 board_init_r(NULL, 0);
66}