rk3036-board-spl.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * (C) Copyright 2015-2019 Rockchip Electronics Co., Ltd
  4. */
  5. #include <common.h>
  6. #include <debug_uart.h>
  7. #include <asm/io.h>
  8. #include <asm/arch-rockchip/bootrom.h>
  9. #include <asm/arch-rockchip/sdram_rk3036.h>
  10. #define TIMER_LOAD_COUNT_L 0x00
  11. #define TIMER_LOAD_COUNT_H 0x04
  12. #define TIMER_CONTROL_REG 0x10
  13. #define TIMER_EN 0x1
  14. #define TIMER_FMODE (0 << 1)
  15. #define TIMER_RMODE (1 << 1)
  16. void rockchip_stimer_init(void)
  17. {
  18. asm volatile("mcr p15, 0, %0, c14, c0, 0"
  19. : : "r"(COUNTER_FREQUENCY));
  20. writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
  21. writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
  22. writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
  23. writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
  24. TIMER_CONTROL_REG);
  25. }
  26. void board_init_f(ulong dummy)
  27. {
  28. #ifdef CONFIG_DEBUG_UART
  29. debug_uart_init();
  30. #endif
  31. /* Init secure timer */
  32. rockchip_stimer_init();
  33. /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
  34. timer_init();
  35. sdram_init();
  36. /* return to maskrom */
  37. back_to_bootrom(BROM_BOOT_NEXTSTAGE);
  38. }
  39. /* Place Holders */
  40. void board_init_r(gd_t *id, ulong dest_addr)
  41. {
  42. /*
  43. * Function attribute is no-return
  44. * This Function never executes
  45. */
  46. while (1)
  47. ;
  48. }