1 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
11 u32 spl_boot_device(void)
15 boot_mode = (readl(TAMP_BOOT_CONTEXT) & TAMP_BOOT_MODE_MASK) >>
17 clrsetbits_le32(TAMP_BOOT_CONTEXT,
19 boot_mode << TAMP_BOOT_MODE_SHIFT);
23 case BOOT_FLASH_EMMC_1:
24 return BOOT_DEVICE_MMC1;
26 case BOOT_FLASH_EMMC_2:
27 return BOOT_DEVICE_MMC2;
30 return BOOT_DEVICE_MMC1;
33 u32 spl_boot_mode(const u32 boot_device)
35 return MMCSD_MODE_RAW;
38 int spl_boot_partition(const u32 boot_device)
40 switch (boot_device) {
41 case BOOT_DEVICE_MMC1:
42 return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION;
43 case BOOT_DEVICE_MMC2:
44 return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION_MMC2;
50 void board_init_f(ulong dummy)
57 ret = spl_early_init();
59 debug("spl_early_init() failed: %d\n", ret);
63 ret = uclass_get_device(UCLASS_CLK, 0, &dev);
65 debug("Clock init failed: %d\n", ret);
69 ret = uclass_get_device(UCLASS_RESET, 0, &dev);
71 debug("Reset init failed: %d\n", ret);
75 ret = uclass_get_device(UCLASS_PINCTRL, 0, &dev);
77 debug("%s: Cannot find pinctrl device\n", __func__);
81 /* enable console uart printing */
82 preloader_console_init();
84 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
86 debug("DRAM init failed: %d\n", ret);