blob: 15d6836c6eaef0337d820daf69cf432207dd6ccb [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Paul Kocialkowskid1a04b32015-07-15 16:02:26 +02002/*
3 * OMAP5 boot
4 *
5 * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
Paul Kocialkowskid1a04b32015-07-15 16:02:26 +02006 */
7
8#include <common.h>
9#include <asm/io.h>
10#include <asm/omap_common.h>
11#include <spl.h>
12
13static u32 boot_devices[] = {
Nishanth Menon3891a542016-11-29 15:22:00 +053014#if defined(CONFIG_DRA7XX)
Paul Kocialkowskid1a04b32015-07-15 16:02:26 +020015 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
34u32 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}