rk3368-board-spl.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <debug_uart.h>
  8. #include <dm.h>
  9. #include <dm/pinctrl.h>
  10. #include <ram.h>
  11. #include <spl.h>
  12. #include <asm/io.h>
  13. #include <asm/arch/cru_rk3368.h>
  14. #include <asm/arch/grf_rk3368.h>
  15. #include <asm/arch/hardware.h>
  16. #include <asm/arch/periph.h>
  17. #include <asm/arch/timer.h>
  18. DECLARE_GLOBAL_DATA_PTR;
  19. void board_debug_uart_init(void)
  20. {
  21. }
  22. void board_init_f(ulong dummy)
  23. {
  24. struct udevice *pinctrl;
  25. struct udevice *dev;
  26. int ret;
  27. ret = spl_early_init();
  28. if (ret) {
  29. debug("spl_early_init() failed: %d\n", ret);
  30. hang();
  31. }
  32. /* Set up our preloader console */
  33. ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl);
  34. if (ret) {
  35. pr_err("%s: pinctrl init failed: %d\n", __func__, ret);
  36. hang();
  37. }
  38. ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART0);
  39. if (ret) {
  40. pr_err("%s: failed to set up console UART\n", __func__);
  41. hang();
  42. }
  43. preloader_console_init();
  44. ret = uclass_get_device(UCLASS_RAM, 0, &dev);
  45. if (ret) {
  46. debug("DRAM init failed: %d\n", ret);
  47. return;
  48. }
  49. }
  50. u32 spl_boot_mode(const u32 boot_device)
  51. {
  52. return MMCSD_MODE_RAW;
  53. }
  54. u32 spl_boot_device(void)
  55. {
  56. return BOOT_DEVICE_MMC1;
  57. }
  58. #ifdef CONFIG_SPL_LOAD_FIT
  59. int board_fit_config_name_match(const char *name)
  60. {
  61. /* Just empty function now - can't decide what to choose */
  62. debug("%s: %s\n", __func__, name);
  63. return 0;
  64. }
  65. #endif