blob: 5b479a87516be24d2dfc4632eb0509f090b2d873 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Paul Kocialkowski52eb41d2015-07-15 16:02:26 +02002/*
3 * OMAP5 boot
4 *
5 * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
Paul Kocialkowski52eb41d2015-07-15 16:02:26 +02006 */
7
Paul Kocialkowski52eb41d2015-07-15 16:02:26 +02008#include <asm/io.h>
9#include <asm/omap_common.h>
10#include <spl.h>
11
12static u32 boot_devices[] = {
Nishanth Menon813fe9d2016-11-29 15:22:00 +053013#if defined(CONFIG_DRA7XX)
Paul Kocialkowski52eb41d2015-07-15 16:02:26 +020014 BOOT_DEVICE_MMC2,
15 BOOT_DEVICE_NAND,
16 BOOT_DEVICE_MMC1,
17 BOOT_DEVICE_SATA,
18 BOOT_DEVICE_XIP,
19 BOOT_DEVICE_XIP,
20 BOOT_DEVICE_SPI,
21 BOOT_DEVICE_SPI,
22#else
23 BOOT_DEVICE_MMC2,
24 BOOT_DEVICE_NAND,
25 BOOT_DEVICE_MMC1,
26 BOOT_DEVICE_SATA,
27 BOOT_DEVICE_XIP,
28 BOOT_DEVICE_MMC2,
29 BOOT_DEVICE_XIPWAIT,
30#endif
31};
32
33u32 omap_sys_boot_device(void)
34{
35 u32 sys_boot;
36
37 /* Grab the first 4 bits of the status register for SYS_BOOT. */
38 sys_boot = readl((u32 *) (*ctrl)->control_status) & ((1 << 4) - 1);
39
40 if (sys_boot >= (sizeof(boot_devices) / sizeof(u32)))
41 return BOOT_DEVICE_NONE;
42
43 return boot_devices[sys_boot];
44}