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