Prepare v2023.10
[platform/kernel/u-boot.git] / board / freescale / imx8qm_mek / spl.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright 2018, 2021 NXP
4  *
5  */
6
7 #include <common.h>
8 #include <dm.h>
9 #include <image.h>
10 #include <init.h>
11 #include <log.h>
12 #include <spl.h>
13 #include <asm/global_data.h>
14 #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 #include <asm/arch/sys_proto.h>
20
21 DECLARE_GLOBAL_DATA_PTR;
22
23 void spl_board_init(void)
24 {
25         struct udevice *dev;
26
27         uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(imx8_scu), &dev);
28
29         uclass_find_first_device(UCLASS_MISC, &dev);
30
31         for (; dev; uclass_find_next_device(&dev)) {
32                 if (device_probe(dev))
33                         continue;
34         }
35
36         arch_cpu_init();
37
38         board_early_init_f();
39
40         timer_init();
41
42         preloader_console_init();
43
44         puts("Normal Boot\n");
45 }
46
47 void spl_board_prepare_for_boot(void)
48 {
49         imx8_power_off_pd_devices(NULL, 0);
50 }
51
52 #ifdef CONFIG_SPL_LOAD_FIT
53 int board_fit_config_name_match(const char *name)
54 {
55         /* Just empty function now - can't decide what to choose */
56         debug("%s: %s\n", __func__, name);
57
58         return 0;
59 }
60 #endif
61
62 void board_init_f(ulong dummy)
63 {
64         /* Clear global data */
65         memset((void *)gd, 0, sizeof(gd_t));
66
67         /* Clear the BSS. */
68         memset(__bss_start, 0, __bss_end - __bss_start);
69
70         board_init_r(NULL, 0);
71 }