boot.c 867 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * OMAP5 boot
  4. *
  5. * Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr>
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <asm/omap_common.h>
  10. #include <spl.h>
  11. static u32 boot_devices[] = {
  12. #if defined(CONFIG_DRA7XX)
  13. BOOT_DEVICE_MMC2,
  14. BOOT_DEVICE_NAND,
  15. BOOT_DEVICE_MMC1,
  16. BOOT_DEVICE_SATA,
  17. BOOT_DEVICE_XIP,
  18. BOOT_DEVICE_XIP,
  19. BOOT_DEVICE_SPI,
  20. BOOT_DEVICE_SPI,
  21. #else
  22. BOOT_DEVICE_MMC2,
  23. BOOT_DEVICE_NAND,
  24. BOOT_DEVICE_MMC1,
  25. BOOT_DEVICE_SATA,
  26. BOOT_DEVICE_XIP,
  27. BOOT_DEVICE_MMC2,
  28. BOOT_DEVICE_XIPWAIT,
  29. #endif
  30. };
  31. u32 omap_sys_boot_device(void)
  32. {
  33. u32 sys_boot;
  34. /* Grab the first 4 bits of the status register for SYS_BOOT. */
  35. sys_boot = readl((u32 *) (*ctrl)->control_status) & ((1 << 4) - 1);
  36. if (sys_boot >= (sizeof(boot_devices) / sizeof(u32)))
  37. return BOOT_DEVICE_NONE;
  38. return boot_devices[sys_boot];
  39. }