spl.c 918 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #if defined(CONFIG_AT91SAM9_WATCHDOG)
  14. void at91_disable_wdt(void) { }
  15. #else
  16. void at91_disable_wdt(void)
  17. {
  18. struct at91_wdt *wdt = (struct at91_wdt *)ATMEL_BASE_WDT;
  19. writel(AT91_WDT_MR_WDDIS, &wdt->mr);
  20. }
  21. #endif
  22. u32 spl_boot_device(void)
  23. {
  24. #ifdef CONFIG_SYS_USE_MMC
  25. return BOOT_DEVICE_MMC1;
  26. #elif CONFIG_SYS_USE_NANDFLASH
  27. return BOOT_DEVICE_NAND;
  28. #elif CONFIG_SYS_USE_SERIALFLASH
  29. return BOOT_DEVICE_SPI;
  30. #endif
  31. return BOOT_DEVICE_NONE;
  32. }
  33. u32 spl_boot_mode(void)
  34. {
  35. switch (spl_boot_device()) {
  36. #ifdef CONFIG_SYS_USE_MMC
  37. case BOOT_DEVICE_MMC1:
  38. return MMCSD_MODE_FS;
  39. break;
  40. #endif
  41. case BOOT_DEVICE_NONE:
  42. default:
  43. hang();
  44. }
  45. }