blob: 95ce9f37e8b718a2a2b8338eb313c06e1e830cc9 [file] [log] [blame]
Peng Fan018e3fd2018-12-21 06:21:34 +00001/*
2 * Copyright 2018 NXP
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <dm.h>
9#include <spl.h>
10#include <dm/uclass.h>
11#include <dm/device.h>
12#include <dm/uclass-internal.h>
13#include <dm/device-internal.h>
14#include <dm/lists.h>
15
16DECLARE_GLOBAL_DATA_PTR;
17
18void spl_board_init(void)
19{
20 struct udevice *dev;
21 int offset;
22
23 uclass_find_first_device(UCLASS_MISC, &dev);
24
25 for (; dev; uclass_find_next_device(&dev)) {
26 if (device_probe(dev))
27 continue;
28 }
29
30 offset = fdt_node_offset_by_compatible(gd->fdt_blob, -1, "nxp,imx8-pd");
31 while (offset != -FDT_ERR_NOTFOUND) {
32 lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset),
33 NULL, true);
34 offset = fdt_node_offset_by_compatible(gd->fdt_blob, offset,
35 "nxp,imx8-pd");
36 }
37
38 uclass_find_first_device(UCLASS_POWER_DOMAIN, &dev);
39
40 for (; dev; uclass_find_next_device(&dev)) {
41 if (device_probe(dev))
42 continue;
43 }
44
45 arch_cpu_init();
46
47 board_early_init_f();
48
49 timer_init();
50
51 preloader_console_init();
52
53 puts("Normal Boot\n");
54}
55
56#ifdef CONFIG_SPL_LOAD_FIT
57int board_fit_config_name_match(const char *name)
58{
59 /* Just empty function now - can't decide what to choose */
60 debug("%s: %s\n", __func__, name);
61
62 return 0;
63}
64#endif
65
66void board_init_f(ulong dummy)
67{
68 /* Clear global data */
69 memset((void *)gd, 0, sizeof(gd_t));
70
71 /* Clear the BSS. */
72 memset(__bss_start, 0, __bss_end - __bss_start);
73
74 board_init_r(NULL, 0);
75}