1 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
11 #include <asm/arch/sys_proto.h>
12 #include <linux/libfdt.h>
14 u32 spl_boot_device(void)
18 boot_mode = get_bootmode();
22 case BOOT_FLASH_EMMC_1:
23 return BOOT_DEVICE_MMC1;
25 case BOOT_FLASH_EMMC_2:
26 return BOOT_DEVICE_MMC2;
27 case BOOT_SERIAL_UART_1:
28 case BOOT_SERIAL_UART_2:
29 case BOOT_SERIAL_UART_3:
30 case BOOT_SERIAL_UART_4:
31 case BOOT_SERIAL_UART_5:
32 case BOOT_SERIAL_UART_6:
33 case BOOT_SERIAL_UART_7:
34 case BOOT_SERIAL_UART_8:
35 return BOOT_DEVICE_UART;
36 case BOOT_SERIAL_USB_OTG:
37 return BOOT_DEVICE_USB;
38 case BOOT_FLASH_NAND_FMC:
39 return BOOT_DEVICE_NAND;
40 case BOOT_FLASH_NOR_QSPI:
41 return BOOT_DEVICE_SPI;
44 return BOOT_DEVICE_MMC1;
47 u32 spl_boot_mode(const u32 boot_device)
49 return MMCSD_MODE_RAW;
52 int spl_boot_partition(const u32 boot_device)
54 switch (boot_device) {
55 case BOOT_DEVICE_MMC1:
56 return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION;
57 case BOOT_DEVICE_MMC2:
58 return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2;
64 #ifdef CONFIG_SPL_DISPLAY_PRINT
65 void spl_display_print(void)
67 DECLARE_GLOBAL_DATA_PTR;
70 /* same code than show_board_info() but not compiled for SPL
71 * see CONFIG_DISPLAY_BOARDINFO & common/board_info.c
73 model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);
75 printf("Model: %s\n", model);
79 void board_init_f(ulong dummy)
86 ret = spl_early_init();
88 debug("spl_early_init() failed: %d\n", ret);
92 ret = uclass_get_device(UCLASS_CLK, 0, &dev);
94 debug("Clock init failed: %d\n", ret);
98 ret = uclass_get_device(UCLASS_RESET, 0, &dev);
100 debug("Reset init failed: %d\n", ret);
104 ret = uclass_get_device(UCLASS_PINCTRL, 0, &dev);
106 debug("%s: Cannot find pinctrl device\n", __func__);
110 /* enable console uart printing */
111 preloader_console_init();
113 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
115 printf("DRAM init failed: %d\n", ret);