developer | 345a6e5 | 2020-10-12 16:33:25 +0800 | [diff] [blame] | 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 | |
| 13 | static void enable_systimer_compensation(void) |
| 14 | { |
| 15 | unsigned int reg; |
| 16 | |
| 17 | reg = mmio_read_32(CNTCR_REG); |
| 18 | reg &= ~COMP_15_EN; |
| 19 | reg |= COMP_20_EN; |
| 20 | mmio_write_32(CNTCR_REG, reg); |
| 21 | |
| 22 | NOTICE("[systimer] CNTCR_REG(0x%x)\n", mmio_read_32(CNTCR_REG)); |
| 23 | } |
| 24 | |
| 25 | void mt_systimer_init(void) |
| 26 | { |
| 27 | /* systimer is default on, so we only enable systimer compensation */ |
| 28 | enable_systimer_compensation(); |
| 29 | } |