px30-board-tpl.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2019 Rockchip Electronics Co., Ltd
  4. */
  5. #include <common.h>
  6. #include <debug_uart.h>
  7. #include <dm.h>
  8. #include <init.h>
  9. #include <ram.h>
  10. #include <spl.h>
  11. #include <version.h>
  12. #include <asm/io.h>
  13. #include <asm/arch-rockchip/bootrom.h>
  14. #include <asm/arch-rockchip/sdram_px30.h>
  15. #define TIMER_LOAD_COUNT0 0x00
  16. #define TIMER_LOAD_COUNT1 0x04
  17. #define TIMER_CUR_VALUE0 0x08
  18. #define TIMER_CUR_VALUE1 0x0c
  19. #define TIMER_CONTROL_REG 0x10
  20. #define TIMER_EN 0x1
  21. #define TIMER_FMODE (0 << 1)
  22. #define TIMER_RMODE (1 << 1)
  23. void secure_timer_init(void)
  24. {
  25. writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
  26. writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_LOAD_COUNT0);
  27. writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_LOAD_COUNT1);
  28. writel(TIMER_EN | TIMER_FMODE,
  29. CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
  30. }
  31. void board_init_f(ulong dummy)
  32. {
  33. int ret;
  34. #ifdef CONFIG_DEBUG_UART
  35. debug_uart_init();
  36. /*
  37. * Debug UART can be used from here if required:
  38. *
  39. * debug_uart_init();
  40. * printch('a');
  41. * printhex8(0x1234);
  42. * printascii("string");
  43. */
  44. printascii("U-Boot TPL board init\n");
  45. #endif
  46. secure_timer_init();
  47. ret = sdram_init();
  48. if (ret)
  49. printascii("sdram_init failed\n");
  50. /* return to maskrom */
  51. back_to_bootrom(BROM_BOOT_NEXTSTAGE);
  52. }