Ye Li | f3c8abb | 2025-04-28 18:37:43 +0800 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright 2025 NXP |
| 4 | */ |
| 5 | |
| 6 | #include <asm/arch/clock.h> |
| 7 | #include <asm/arch/mu.h> |
| 8 | #include <asm/mach-imx/boot_mode.h> |
| 9 | #include <asm/sections.h> |
| 10 | #include <hang.h> |
| 11 | #include <init.h> |
| 12 | #include <spl.h> |
| 13 | |
| 14 | DECLARE_GLOBAL_DATA_PTR; |
| 15 | |
| 16 | int spl_board_boot_device(enum boot_device boot_dev_spl) |
| 17 | { |
| 18 | switch (boot_dev_spl) { |
| 19 | case SD1_BOOT: |
| 20 | case MMC1_BOOT: |
| 21 | return BOOT_DEVICE_MMC1; |
| 22 | case SD2_BOOT: |
| 23 | case MMC2_BOOT: |
| 24 | return BOOT_DEVICE_MMC2; |
| 25 | case USB_BOOT: |
| 26 | return BOOT_DEVICE_BOARD; |
| 27 | default: |
| 28 | return BOOT_DEVICE_NONE; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | void spl_board_init(void) |
| 33 | { |
| 34 | puts("Normal Boot\n"); |
| 35 | } |
| 36 | |
| 37 | void board_init_f(ulong dummy) |
| 38 | { |
| 39 | int ret; |
| 40 | |
| 41 | /* Clear the BSS. */ |
| 42 | memset(__bss_start, 0, __bss_end - __bss_start); |
| 43 | |
| 44 | #ifdef CONFIG_SPL_RECOVER_DATA_SECTION |
| 45 | if (IS_ENABLED(CONFIG_SPL_BUILD)) |
| 46 | spl_save_restore_data(); |
| 47 | #endif |
| 48 | |
| 49 | timer_init(); |
| 50 | |
| 51 | /* Need dm_init() to run before any SCMI calls can be made. */ |
| 52 | spl_early_init(); |
| 53 | |
| 54 | /* Need enable SCMI drivers and ELE driver before enabling console */ |
| 55 | ret = imx9_probe_mu(); |
| 56 | if (ret) |
| 57 | hang(); /* if MU not probed, nothing can output, just hang here */ |
| 58 | |
| 59 | arch_cpu_init(); |
| 60 | |
| 61 | board_early_init_f(); |
| 62 | |
| 63 | preloader_console_init(); |
| 64 | |
| 65 | debug("SOC: 0x%x\n", gd->arch.soc_rev); |
| 66 | debug("LC: 0x%x\n", gd->arch.lifecycle); |
| 67 | |
| 68 | board_init_r(NULL, 0); |
| 69 | } |