1 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
10 #include <asm/arch/sys_proto.h>
11 #include <linux/libfdt.h>
13 u32 spl_boot_device(void)
17 boot_mode = get_bootmode();
21 case BOOT_FLASH_EMMC_1:
22 return BOOT_DEVICE_MMC1;
24 case BOOT_FLASH_EMMC_2:
25 return BOOT_DEVICE_MMC2;
26 case BOOT_SERIAL_UART_1:
27 case BOOT_SERIAL_UART_2:
28 case BOOT_SERIAL_UART_3:
29 case BOOT_SERIAL_UART_4:
30 case BOOT_SERIAL_UART_5:
31 case BOOT_SERIAL_UART_6:
32 case BOOT_SERIAL_UART_7:
33 case BOOT_SERIAL_UART_8:
34 return BOOT_DEVICE_UART;
35 case BOOT_SERIAL_USB_OTG:
36 return BOOT_DEVICE_USB;
37 case BOOT_FLASH_NAND_FMC:
38 return BOOT_DEVICE_NAND;
39 case BOOT_FLASH_NOR_QSPI:
40 return BOOT_DEVICE_SPI;
43 return BOOT_DEVICE_MMC1;
46 u32 spl_boot_mode(const u32 boot_device)
48 return MMCSD_MODE_RAW;
51 int spl_boot_partition(const u32 boot_device)
53 switch (boot_device) {
54 case BOOT_DEVICE_MMC1:
55 return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION;
56 case BOOT_DEVICE_MMC2:
57 return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2;
63 #ifdef CONFIG_SPL_DISPLAY_PRINT
64 void spl_display_print(void)
66 DECLARE_GLOBAL_DATA_PTR;
69 /* same code than show_board_info() but not compiled for SPL
70 * see CONFIG_DISPLAY_BOARDINFO & common/board_info.c
72 model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
74 printf("Model: %s\n", model);
78 void board_init_f(ulong dummy)
85 ret = spl_early_init();
87 debug("spl_early_init() failed: %d\n", ret);
91 ret = uclass_get_device(UCLASS_CLK, 0, &dev);
93 debug("Clock init failed: %d\n", ret);
97 ret = uclass_get_device(UCLASS_RESET, 0, &dev);
99 debug("Reset init failed: %d\n", ret);
103 ret = uclass_get_device(UCLASS_PINCTRL, 0, &dev);
105 debug("%s: Cannot find pinctrl device\n", __func__);
109 /* enable console uart printing */
110 preloader_console_init();
112 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
114 printf("DRAM init failed: %d\n", ret);