blob: 18750b810a3a0461bd53671bfe2893cd384e50b4 [file] [log] [blame]
Paul Kocialkowskid1a04b32015-07-15 16:02:26 +02001/*
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
14static u32 boot_devices[] = {
Nishanth Menon3891a542016-11-29 15:22:00 +053015#if defined(CONFIG_DRA7XX)
Paul Kocialkowskid1a04b32015-07-15 16:02:26 +020016 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
35u32 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}