blob: 4b5aa770e76b1012db1acc658995409e132fe785 [file] [log] [blame]
Paul Kocialkowski94fc7512015-07-15 16:02:25 +02001/*
2 * OMAP4 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[] = {
15 BOOT_DEVICE_MMC2,
16 BOOT_DEVICE_XIP,
17 BOOT_DEVICE_XIPWAIT,
18 BOOT_DEVICE_NAND,
19 BOOT_DEVICE_XIPWAIT,
20 BOOT_DEVICE_MMC1,
21 BOOT_DEVICE_ONENAND,
22 BOOT_DEVICE_ONENAND,
23 BOOT_DEVICE_MMC2,
24 BOOT_DEVICE_ONENAND,
25 BOOT_DEVICE_XIPWAIT,
26 BOOT_DEVICE_NAND,
27 BOOT_DEVICE_NAND,
28 BOOT_DEVICE_MMC1,
29 BOOT_DEVICE_ONENAND,
30 BOOT_DEVICE_MMC2,
31 BOOT_DEVICE_XIP,
32 BOOT_DEVICE_XIPWAIT,
33 BOOT_DEVICE_NAND,
34 BOOT_DEVICE_MMC1,
35 BOOT_DEVICE_MMC1,
36 BOOT_DEVICE_ONENAND,
37 BOOT_DEVICE_MMC2,
38 BOOT_DEVICE_XIP,
39 BOOT_DEVICE_MMC2_2,
40 BOOT_DEVICE_NAND,
41 BOOT_DEVICE_MMC2_2,
42 BOOT_DEVICE_MMC1,
43 BOOT_DEVICE_MMC2_2,
44 BOOT_DEVICE_MMC2_2,
45 BOOT_DEVICE_NONE,
46 BOOT_DEVICE_XIPWAIT,
47};
48
49u32 omap_sys_boot_device(void)
50{
51 u32 sys_boot;
52
53 /* Grab the first 5 bits of the status register for SYS_BOOT. */
54 sys_boot = readl((u32 *) (*ctrl)->control_status) & ((1 << 5) - 1);
55
56 if (sys_boot >= (sizeof(boot_devices) / sizeof(u32)))
57 return BOOT_DEVICE_NONE;
58
59 return boot_devices[sys_boot];
60}