1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
8 * See "LICENSE_GPLv2.txt" for details.
9 *
10 * @TAG(DATA61_GPL)
11 */
12
13#include <plat/machine/timer.h>
14#include <arch/machine/generic_timer.h>
15
16BOOT_CODE void initGenericTimer(void)
17{
18    if (config_set(CONFIG_DEBUG_BUILD)) {
19        /* check the frequency is correct */
20        uint32_t gpt_cnt_tval = 0;
21        SYSTEM_READ_WORD(CNTFRQ, gpt_cnt_tval);
22        if (gpt_cnt_tval != 0 && gpt_cnt_tval != TIMER_CLOCK_HZ) {
23            printf("Warning:  gpt_cnt_tval %u, expected %u\n", gpt_cnt_tval,
24                   (uint32_t) TIMER_CLOCK_HZ);
25        }
26    }
27
28    resetTimer();
29}
30