mt_timer.c 632 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * Copyright (c) 2020, MediaTek Inc. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <arch_helpers.h>
  7. #include <common/debug.h>
  8. #include <lib/mmio.h>
  9. #include <mcucfg.h>
  10. #include <mt_timer.h>
  11. #include <platform_def.h>
  12. static void enable_systimer_compensation(void)
  13. {
  14. unsigned int reg;
  15. reg = mmio_read_32(CNTCR_REG);
  16. reg &= ~COMP_15_EN;
  17. reg |= COMP_20_EN;
  18. mmio_write_32(CNTCR_REG, reg);
  19. NOTICE("[systimer] CNTCR_REG(0x%x)\n", mmio_read_32(CNTCR_REG));
  20. }
  21. void mt_systimer_init(void)
  22. {
  23. /* systimer is default on, so we only enable systimer compensation */
  24. enable_systimer_compensation();
  25. }