4 * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
6 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm/arch/sys_proto.h>
14 static u32 boot_devices[] = {
46 u32 omap_sys_boot_device(void)
48 struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
51 /* Grab the first 5 bits of the status register for SYS_BOOT. */
52 sys_boot = readl(&ctrl_base->status) & ((1 << 5) - 1);
54 if (sys_boot >= (sizeof(boot_devices) / sizeof(u32)))
55 return BOOT_DEVICE_NONE;
57 return boot_devices[sys_boot];
60 char omap_reboot_mode(void)
65 reboot_mode = readl((u32 *)(OMAP34XX_SCRATCHPAD + 4));
67 c = (reboot_mode >> 24) & 0xff;
71 c = (reboot_mode >> 16) & 0xff;
75 c = reboot_mode & 0xff;
80 int omap_reboot_mode_clear(void)
82 writel(0, (u32 *)(OMAP34XX_SCRATCHPAD + 4));
87 int omap_reboot_mode_store(char c)
91 reboot_mode = 'B' << 24 | 'M' << 16 | c;
93 writel(reboot_mode, (u32 *)(OMAP34XX_SCRATCHPAD + 4));