spl.c 835 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright (C) 2013 Atmel Corporation
  3. * Bo Shen <voice.shen@atmel.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <asm/io.h>
  9. #include <asm/arch/at91_common.h>
  10. #include <asm/arch/at91_wdt.h>
  11. #include <asm/arch/clk.h>
  12. #include <spl.h>
  13. void at91_disable_wdt(void)
  14. {
  15. struct at91_wdt *wdt = (struct at91_wdt *)ATMEL_BASE_WDT;
  16. writel(AT91_WDT_MR_WDDIS, &wdt->mr);
  17. }
  18. u32 spl_boot_device(void)
  19. {
  20. #ifdef CONFIG_SYS_USE_MMC
  21. return BOOT_DEVICE_MMC1;
  22. #elif CONFIG_SYS_USE_NANDFLASH
  23. return BOOT_DEVICE_NAND;
  24. #elif CONFIG_SYS_USE_SERIALFLASH
  25. return BOOT_DEVICE_SPI;
  26. #endif
  27. return BOOT_DEVICE_NONE;
  28. }
  29. u32 spl_boot_mode(void)
  30. {
  31. switch (spl_boot_device()) {
  32. #ifdef CONFIG_SYS_USE_MMC
  33. case BOOT_DEVICE_MMC1:
  34. return MMCSD_MODE_FS;
  35. break;
  36. #endif
  37. case BOOT_DEVICE_NONE:
  38. default:
  39. hang();
  40. }
  41. }