Gaurav Jain | db4dd6a | 2022-03-24 11:50:33 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 2 | /* |
Gaurav Jain | db4dd6a | 2022-03-24 11:50:33 +0530 | [diff] [blame] | 3 | * Copyright 2018, 2021 NXP |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 4 | * |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #include <common.h> |
| 8 | #include <dm.h> |
Simon Glass | 2dc9c34 | 2020-05-10 11:40:01 -0600 | [diff] [blame] | 9 | #include <image.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 10 | #include <init.h> |
Simon Glass | 0f2af88 | 2020-05-10 11:40:05 -0600 | [diff] [blame] | 11 | #include <log.h> |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 12 | #include <spl.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame] | 13 | #include <asm/global_data.h> |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 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> |
Peng Fan | 1b9729a | 2020-05-05 20:28:40 +0800 | [diff] [blame] | 19 | #include <asm/arch/sys_proto.h> |
Shiji Yang | bb11234 | 2023-08-03 09:47:16 +0800 | [diff] [blame] | 20 | #include <asm/sections.h> |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
| 24 | void spl_board_init(void) |
| 25 | { |
| 26 | struct udevice *dev; |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 27 | |
Gaurav Jain | db4dd6a | 2022-03-24 11:50:33 +0530 | [diff] [blame] | 28 | uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(imx8_scu), &dev); |
| 29 | |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 30 | uclass_find_first_device(UCLASS_MISC, &dev); |
| 31 | |
| 32 | for (; dev; uclass_find_next_device(&dev)) { |
| 33 | if (device_probe(dev)) |
| 34 | continue; |
| 35 | } |
| 36 | |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 37 | arch_cpu_init(); |
| 38 | |
| 39 | board_early_init_f(); |
| 40 | |
| 41 | timer_init(); |
| 42 | |
| 43 | preloader_console_init(); |
| 44 | |
| 45 | puts("Normal Boot\n"); |
| 46 | } |
| 47 | |
Peng Fan | 1b9729a | 2020-05-05 20:28:40 +0800 | [diff] [blame] | 48 | void spl_board_prepare_for_boot(void) |
| 49 | { |
| 50 | imx8_power_off_pd_devices(NULL, 0); |
| 51 | } |
| 52 | |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 53 | #ifdef CONFIG_SPL_LOAD_FIT |
| 54 | int board_fit_config_name_match(const char *name) |
| 55 | { |
| 56 | /* Just empty function now - can't decide what to choose */ |
| 57 | debug("%s: %s\n", __func__, name); |
| 58 | |
| 59 | return 0; |
| 60 | } |
| 61 | #endif |
| 62 | |
| 63 | void board_init_f(ulong dummy) |
| 64 | { |
| 65 | /* Clear global data */ |
| 66 | memset((void *)gd, 0, sizeof(gd_t)); |
| 67 | |
| 68 | /* Clear the BSS. */ |
| 69 | memset(__bss_start, 0, __bss_end - __bss_start); |
| 70 | |
| 71 | board_init_r(NULL, 0); |
| 72 | } |