Oliver Graute | af5e29b | 2021-05-31 15:50:40 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2018 NXP |
| 4 | * |
| 5 | */ |
| 6 | |
Oliver Graute | af5e29b | 2021-05-31 15:50:40 +0200 | [diff] [blame] | 7 | #include <dm.h> |
Marek BehĂșn | 5d6b448 | 2022-01-20 01:04:42 +0100 | [diff] [blame] | 8 | #include <fdt_support.h> |
Oliver Graute | af5e29b | 2021-05-31 15:50:40 +0200 | [diff] [blame] | 9 | #include <init.h> |
| 10 | #include <log.h> |
| 11 | #include <spl.h> |
Shiji Yang | bb11234 | 2023-08-03 09:47:16 +0800 | [diff] [blame] | 12 | #include <asm/sections.h> |
Oliver Graute | af5e29b | 2021-05-31 15:50:40 +0200 | [diff] [blame] | 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> |
| 18 | |
| 19 | DECLARE_GLOBAL_DATA_PTR; |
| 20 | |
| 21 | void spl_board_init(void) |
| 22 | { |
| 23 | struct udevice *dev; |
| 24 | int offset; |
| 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 | |
Marek BehĂșn | 5d6b448 | 2022-01-20 01:04:42 +0100 | [diff] [blame] | 33 | fdt_for_each_node_by_compatible(offset, gd->fdt_blob, -1, |
| 34 | "nxp,imx8-pd") |
Oliver Graute | af5e29b | 2021-05-31 15:50:40 +0200 | [diff] [blame] | 35 | lists_bind_fdt(gd->dm_root, offset_to_ofnode(offset), |
Patrice Chotard | cc523cf | 2021-09-10 16:16:20 +0200 | [diff] [blame] | 36 | NULL, NULL, true); |
Oliver Graute | af5e29b | 2021-05-31 15:50:40 +0200 | [diff] [blame] | 37 | |
| 38 | uclass_find_first_device(UCLASS_POWER_DOMAIN, &dev); |
| 39 | |
| 40 | for (; dev; uclass_find_next_device(&dev)) { |
| 41 | if (device_probe(dev)) |
| 42 | continue; |
| 43 | } |
| 44 | |
| 45 | arch_cpu_init(); |
| 46 | |
| 47 | board_early_init_f(); |
| 48 | |
| 49 | timer_init(); |
| 50 | |
| 51 | preloader_console_init(); |
| 52 | |
| 53 | puts("Normal Boot\n"); |
| 54 | } |
| 55 | |
| 56 | #if (IS_ENABLED(CONFIG_SPL_LOAD_FIT)) |
| 57 | int board_fit_config_name_match(const char *name) |
| 58 | { |
| 59 | /* Just empty function now - can't decide what to choose */ |
| 60 | debug("%s: %s\n", __func__, name); |
| 61 | |
| 62 | return 0; |
| 63 | } |
| 64 | #endif |
| 65 | |
| 66 | void board_init_f(ulong dummy) |
| 67 | { |
| 68 | /* Clear global data */ |
| 69 | memset((void *)gd, 0, sizeof(gd_t)); |
| 70 | |
| 71 | /* Clear the BSS. */ |
| 72 | memset(__bss_start, 0, __bss_end - __bss_start); |
| 73 | |
| 74 | board_init_r(NULL, 0); |
| 75 | } |