blob: 242e794981b7ebf320f31f876925144c2cbd53ce [file] [log] [blame]
Oliver Grauteaf5e29b2021-05-31 15:50:40 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018 NXP
4 *
5 */
6
Oliver Grauteaf5e29b2021-05-31 15:50:40 +02007#include <dm.h>
Marek BehĂșn5d6b4482022-01-20 01:04:42 +01008#include <fdt_support.h>
Oliver Grauteaf5e29b2021-05-31 15:50:40 +02009#include <init.h>
10#include <log.h>
11#include <spl.h>
Shiji Yangbb112342023-08-03 09:47:16 +080012#include <asm/sections.h>
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020013#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>
18
19DECLARE_GLOBAL_DATA_PTR;
20
21void spl_board_init(void)
22{
23 struct udevice *dev;
24 int offset;
25
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
Marek BehĂșn5d6b4482022-01-20 01:04:42 +010033 fdt_for_each_node_by_compatible(offset, gd->fdt_blob, -1,
34 "nxp,imx8-pd")
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020035 lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset),
Patrice Chotardcc523cf2021-09-10 16:16:20 +020036 NULL, NULL, true);
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020037
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#if (IS_ENABLED(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}