timer_s10.c 554 B

1234567891011121314151617181920212223242526
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * Copyright (C) 2017-2018 Intel Corporation <www.intel.com>
  4. *
  5. */
  6. #include <common.h>
  7. #include <asm/io.h>
  8. #include <asm/arch/timer.h>
  9. /*
  10. * Timer initialization
  11. */
  12. int timer_init(void)
  13. {
  14. int enable = 0x3; /* timer enable + output signal masked */
  15. int loadval = ~0;
  16. /* enable system counter */
  17. writel(enable, SOCFPGA_GTIMER_SEC_ADDRESS);
  18. /* enable processor pysical counter */
  19. asm volatile("msr cntp_ctl_el0, %0" : : "r" (enable));
  20. asm volatile("msr cntp_tval_el0, %0" : : "r" (loadval));
  21. return 0;
  22. }