Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 NXP |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 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> |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 20 | |
| 21 | DECLARE_GLOBAL_DATA_PTR; |
| 22 | |
| 23 | void spl_board_init(void) |
| 24 | { |
| 25 | struct udevice *dev; |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 26 | |
| 27 | uclass_find_first_device(UCLASS_MISC, &dev); |
| 28 | |
| 29 | for (; dev; uclass_find_next_device(&dev)) { |
| 30 | if (device_probe(dev)) |
| 31 | continue; |
| 32 | } |
| 33 | |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 34 | arch_cpu_init(); |
| 35 | |
| 36 | board_early_init_f(); |
| 37 | |
| 38 | timer_init(); |
| 39 | |
| 40 | preloader_console_init(); |
| 41 | |
| 42 | puts("Normal Boot\n"); |
| 43 | } |
| 44 | |
Peng Fan | 1b9729a | 2020-05-05 20:28:40 +0800 | [diff] [blame] | 45 | void spl_board_prepare_for_boot(void) |
| 46 | { |
| 47 | imx8_power_off_pd_devices(NULL, 0); |
| 48 | } |
| 49 | |
Peng Fan | 203a227 | 2019-03-05 02:32:49 +0000 | [diff] [blame] | 50 | #ifdef CONFIG_SPL_LOAD_FIT |
| 51 | int board_fit_config_name_match(const char *name) |
| 52 | { |
| 53 | /* Just empty function now - can't decide what to choose */ |
| 54 | debug("%s: %s\n", __func__, name); |
| 55 | |
| 56 | return 0; |
| 57 | } |
| 58 | #endif |
| 59 | |
| 60 | void board_init_f(ulong dummy) |
| 61 | { |
| 62 | /* Clear global data */ |
| 63 | memset((void *)gd, 0, sizeof(gd_t)); |
| 64 | |
| 65 | /* Clear the BSS. */ |
| 66 | memset(__bss_start, 0, __bss_end - __bss_start); |
| 67 | |
| 68 | board_init_r(NULL, 0); |
| 69 | } |