rk3288-board-tpl.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (C) 2017 Amarula Solutions
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <debug_uart.h>
  8. #include <dm.h>
  9. #include <ram.h>
  10. #include <spl.h>
  11. #include <version.h>
  12. #include <asm/io.h>
  13. #include <asm/arch/bootrom.h>
  14. #include <asm/arch/clock.h>
  15. #include <asm/arch/grf_rk3288.h>
  16. #include <asm/arch/periph.h>
  17. #include <asm/arch/pmu_rk3288.h>
  18. #include <asm/arch/sys_proto.h>
  19. #include <asm/arch/timer.h>
  20. #define GRF_BASE 0xff770000
  21. void board_init_f(ulong dummy)
  22. {
  23. struct udevice *dev;
  24. int ret;
  25. /* Example code showing how to enable the debug UART on RK3288 */
  26. /* Enable early UART on the RK3288 */
  27. struct rk3288_grf * const grf = (void *)GRF_BASE;
  28. rk_clrsetreg(&grf->gpio7ch_iomux, GPIO7C7_MASK << GPIO7C7_SHIFT |
  29. GPIO7C6_MASK << GPIO7C6_SHIFT,
  30. GPIO7C7_UART2DBG_SOUT << GPIO7C7_SHIFT |
  31. GPIO7C6_UART2DBG_SIN << GPIO7C6_SHIFT);
  32. /*
  33. * Debug UART can be used from here if required:
  34. *
  35. * debug_uart_init();
  36. * printch('a');
  37. * printhex8(0x1234);
  38. * printascii("string");
  39. */
  40. debug_uart_init();
  41. ret = spl_early_init();
  42. if (ret) {
  43. debug("spl_early_init() failed: %d\n", ret);
  44. hang();
  45. }
  46. rockchip_timer_init();
  47. configure_l2ctlr();
  48. ret = rockchip_get_clk(&dev);
  49. if (ret) {
  50. debug("CLK init failed: %d\n", ret);
  51. return;
  52. }
  53. ret = uclass_get_device(UCLASS_RAM, 0, &dev);
  54. if (ret) {
  55. debug("DRAM init failed: %d\n", ret);
  56. return;
  57. }
  58. }
  59. void board_return_to_bootrom(void)
  60. {
  61. back_to_bootrom(BROM_BOOT_NEXTSTAGE);
  62. }
  63. u32 spl_boot_device(void)
  64. {
  65. return BOOT_DEVICE_BOOTROM;
  66. }
  67. void spl_board_init(void)
  68. {
  69. puts("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
  70. U_BOOT_TIME ")\n");
  71. }