blob: b432ce27459f60e3773a690880a60a0c136d26a8 [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
7#include <common.h>
8#include <dm.h>
Marek BehĂșn5d6b4482022-01-20 01:04:42 +01009#include <fdt_support.h>
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020010#include <init.h>
11#include <log.h>
12#include <spl.h>
Shiji Yangbb112342023-08-03 09:47:16 +080013#include <asm/sections.h>
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020014#include <dm/uclass.h>
15#include <dm/device.h>
16#include <dm/uclass-internal.h>
17#include <dm/device-internal.h>
18#include <dm/lists.h>
19
20DECLARE_GLOBAL_DATA_PTR;
21
22void spl_board_init(void)
23{
24 struct udevice *dev;
25 int offset;
26
27 uclass_find_first_device(UCLASS_MISC, &dev);
28
29 for (; dev; uclass_find_next_device(&dev)) {
30 if (device_probe(dev))
31 continue;
32 }
33
Marek BehĂșn5d6b4482022-01-20 01:04:42 +010034 fdt_for_each_node_by_compatible(offset, gd->fdt_blob, -1,
35 "nxp,imx8-pd")
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020036 lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset),
Patrice Chotardcc523cf2021-09-10 16:16:20 +020037 NULL, NULL, true);
Oliver Grauteaf5e29b2021-05-31 15:50:40 +020038
39 uclass_find_first_device(UCLASS_POWER_DOMAIN, &dev);
40
41 for (; dev; uclass_find_next_device(&dev)) {
42 if (device_probe(dev))
43 continue;
44 }
45
46 arch_cpu_init();
47
48 board_early_init_f();
49
50 timer_init();
51
52 preloader_console_init();
53
54 puts("Normal Boot\n");
55}
56
57#if (IS_ENABLED(CONFIG_SPL_LOAD_FIT))
58int board_fit_config_name_match(const char *name)
59{
60 /* Just empty function now - can't decide what to choose */
61 debug("%s: %s\n", __func__, name);
62
63 return 0;
64}
65#endif
66
67void board_init_f(ulong dummy)
68{
69 /* Clear global data */
70 memset((void *)gd, 0, sizeof(gd_t));
71
72 /* Clear the BSS. */
73 memset(__bss_start, 0, __bss_end - __bss_start);
74
75 board_init_r(NULL, 0);
76}