boot.c 870 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * OMAP5 boot
  3. *
  4. * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
  5. *
  6. * SPDX-License-Identifier: GPL-2.0+
  7. */
  8. #include <common.h>
  9. #include <asm/io.h>
  10. #include <asm/omap_common.h>
  11. #include <spl.h>
  12. static u32 boot_devices[] = {
  13. #if defined(CONFIG_DRA7XX)
  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. u32 omap_sys_boot_device(void)
  33. {
  34. u32 sys_boot;
  35. /* Grab the first 4 bits of the status register for SYS_BOOT. */
  36. sys_boot = readl((u32 *) (*ctrl)->control_status) & ((1 << 4) - 1);
  37. if (sys_boot >= (sizeof(boot_devices) / sizeof(u32)))
  38. return BOOT_DEVICE_NONE;
  39. return boot_devices[sys_boot];
  40. }