blob: ad786833309104756b7f64ec252f302739582b53 [file] [log] [blame]
Gaurav Jaindb4dd6a2022-03-24 11:50:33 +05301// SPDX-License-Identifier: GPL-2.0-or-later
Peng Fan203a2272019-03-05 02:32:49 +00002/*
Gaurav Jaindb4dd6a2022-03-24 11:50:33 +05303 * Copyright 2018, 2021 NXP
Peng Fan203a2272019-03-05 02:32:49 +00004 *
Peng Fan203a2272019-03-05 02:32:49 +00005 */
6
Peng Fan203a2272019-03-05 02:32:49 +00007#include <dm.h>
Simon Glass2dc9c342020-05-10 11:40:01 -06008#include <image.h>
Simon Glass97589732020-05-10 11:40:02 -06009#include <init.h>
Simon Glass0f2af882020-05-10 11:40:05 -060010#include <log.h>
Peng Fan203a2272019-03-05 02:32:49 +000011#include <spl.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060012#include <asm/global_data.h>
Peng Fan203a2272019-03-05 02:32:49 +000013#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>
Peng Fan1b9729a2020-05-05 20:28:40 +080018#include <asm/arch/sys_proto.h>
Shiji Yangbb112342023-08-03 09:47:16 +080019#include <asm/sections.h>
Peng Fan203a2272019-03-05 02:32:49 +000020
21DECLARE_GLOBAL_DATA_PTR;
22
23void spl_board_init(void)
24{
25 struct udevice *dev;
Peng Fan203a2272019-03-05 02:32:49 +000026
Gaurav Jaindb4dd6a2022-03-24 11:50:33 +053027 uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(imx8_scu), &dev);
28
Peng Fan203a2272019-03-05 02:32:49 +000029 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
Peng Fan203a2272019-03-05 02:32:49 +000036 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
Peng Fan1b9729a2020-05-05 20:28:40 +080047void spl_board_prepare_for_boot(void)
48{
49 imx8_power_off_pd_devices(NULL, 0);
50}
51
Peng Fan203a2272019-03-05 02:32:49 +000052#ifdef CONFIG_SPL_LOAD_FIT
53int 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
62void 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}