xref: /openbmc/u-boot/arch/arm/mach-stm32mp/spl.c (revision 9d466f2f)
1 /*
2  * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
3  *
4  * SPDX-License-Identifier:	GPL-2.0+	BSD-3-Clause
5  */
6 
7 #include <common.h>
8 #include <dm.h>
9 #include <spl.h>
10 
11 u32 spl_boot_device(void)
12 {
13 	return BOOT_DEVICE_MMC1;
14 }
15 
16 u32 spl_boot_mode(const u32 boot_device)
17 {
18 	return MMCSD_MODE_RAW;
19 }
20 
21 void board_init_f(ulong dummy)
22 {
23 	struct udevice *dev;
24 	int ret;
25 
26 	arch_cpu_init();
27 
28 	ret = spl_early_init();
29 	if (ret) {
30 		debug("spl_early_init() failed: %d\n", ret);
31 		hang();
32 	}
33 
34 	ret = uclass_get_device(UCLASS_CLK, 0, &dev);
35 	if (ret) {
36 		debug("Clock init failed: %d\n", ret);
37 		return;
38 	}
39 
40 	ret = uclass_get_device(UCLASS_RESET, 0, &dev);
41 	if (ret) {
42 		debug("Reset init failed: %d\n", ret);
43 		return;
44 	}
45 
46 	ret = uclass_get_device(UCLASS_PINCTRL, 0, &dev);
47 	if (ret) {
48 		debug("%s: Cannot find pinctrl device\n", __func__);
49 		return;
50 	}
51 
52 	/* enable console uart printing */
53 	preloader_console_init();
54 
55 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
56 	if (ret) {
57 		debug("DRAM init failed: %d\n", ret);
58 		return;
59 	}
60 }
61