blob: dea34e4dc63cd85048913279a98d5d46c599c353 [file] [log] [blame]
Oliver Grautefe133eb2021-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Ășn3058e282022-01-20 01:04:42 +01009#include <fdt_support.h>
Oliver Grautefe133eb2021-05-31 15:50:40 +020010#include <init.h>
11#include <log.h>
12#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>
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Ășn3058e282022-01-20 01:04:42 +010033 fdt_for_each_node_by_compatible(offset, gd->fdt_blob, -1,
34 "nxp,imx8-pd")
Oliver Grautefe133eb2021-05-31 15:50:40 +020035 lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset),
Patrice Chotard38f7d3b2021-09-10 16:16:20 +020036 NULL, NULL, true);
Oliver Grautefe133eb2021-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}