xref: /openbmc/u-boot/arch/arm/mach-omap2/omap5/boot.c (revision a3b36c84)
1 /*
2  * OMAP5 boot
3  *
4  * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
5  *
6  * SPDX-License-Identifier:	GPL-2.0+
7  */
8 
9 #include <common.h>
10 #include <asm/io.h>
11 #include <asm/omap_common.h>
12 #include <spl.h>
13 
14 static u32 boot_devices[] = {
15 #if defined(CONFIG_DRA7XX)
16 	BOOT_DEVICE_MMC2,
17 	BOOT_DEVICE_NAND,
18 	BOOT_DEVICE_MMC1,
19 	BOOT_DEVICE_SATA,
20 	BOOT_DEVICE_XIP,
21 	BOOT_DEVICE_XIP,
22 	BOOT_DEVICE_SPI,
23 	BOOT_DEVICE_SPI,
24 #else
25 	BOOT_DEVICE_MMC2,
26 	BOOT_DEVICE_NAND,
27 	BOOT_DEVICE_MMC1,
28 	BOOT_DEVICE_SATA,
29 	BOOT_DEVICE_XIP,
30 	BOOT_DEVICE_MMC2,
31 	BOOT_DEVICE_XIPWAIT,
32 #endif
33 };
34 
35 u32 omap_sys_boot_device(void)
36 {
37 	u32 sys_boot;
38 
39 	/* Grab the first 4 bits of the status register for SYS_BOOT. */
40 	sys_boot = readl((u32 *) (*ctrl)->control_status) & ((1 << 4) - 1);
41 
42 	if (sys_boot >= (sizeof(boot_devices) / sizeof(u32)))
43 		return BOOT_DEVICE_NONE;
44 
45 	return boot_devices[sys_boot];
46 }
47