1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright 2018 NXP
4  *
5  */
6 
7 #include <dm.h>
8 #include <fdt_support.h>
9 #include <init.h>
10 #include <log.h>
11 #include <spl.h>
12 #include <asm/sections.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 
19 DECLARE_GLOBAL_DATA_PTR;
20 
spl_board_init(void)21 void 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 
33 	fdt_for_each_node_by_compatible(offset, gd->fdt_blob, -1,
34 					"nxp,imx8-pd")
35 		lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset),
36 			       NULL, NULL, true);
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 #if (IS_ENABLED(CONFIG_SPL_LOAD_FIT))
board_fit_config_name_match(const char * name)57 int 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 
board_init_f(ulong dummy)66 void 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 }
76