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