Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Paul Kocialkowski | 52eb41d | 2015-07-15 16:02:26 +0200 | [diff] [blame] | 2 | /* |
| 3 | * OMAP5 boot |
| 4 | * |
| 5 | * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr> |
Paul Kocialkowski | 52eb41d | 2015-07-15 16:02:26 +0200 | [diff] [blame] | 6 | */ |
| 7 | |
Paul Kocialkowski | 52eb41d | 2015-07-15 16:02:26 +0200 | [diff] [blame] | 8 | #include <asm/io.h> |
| 9 | #include <asm/omap_common.h> |
| 10 | #include <spl.h> |
| 11 | |
| 12 | static u32 boot_devices[] = { |
Nishanth Menon | 813fe9d | 2016-11-29 15:22:00 +0530 | [diff] [blame] | 13 | #if defined(CONFIG_DRA7XX) |
Paul Kocialkowski | 52eb41d | 2015-07-15 16:02:26 +0200 | [diff] [blame] | 14 | 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 | |
| 33 | u32 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 | } |