blob: e78760ce475ba66188a1d715b5aff52c4fdd3357 [file] [log] [blame]
David Brazdil0f672f62019-12-10 10:32:29 +00001// SPDX-License-Identifier: GPL-2.0-or-later
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00002/*
3 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
4 * Author: Fuxin Zhang, zhangfx@lemote.com
5 *
6 * Copyright (C) 2009 Lemote Inc.
7 * Author: Wu Zhangjin, wuzhangjin@gmail.com
Andrew Scullb4b6d4a2019-01-02 15:54:55 +00008 */
9#include <asm/mc146818-time.h>
10#include <asm/time.h>
11#include <asm/hpet.h>
12
13#include <loongson.h>
14#include <cs5536/cs5536_mfgpt.h>
15
16void __init plat_time_init(void)
17{
18 /* setup mips r4k timer */
19 mips_hpt_frequency = cpu_clock_freq / 2;
20
21#ifdef CONFIG_RS780_HPET
22 setup_hpet_timer();
23#else
24 setup_mfgpt0_timer();
25#endif
26}
27
28void read_persistent_clock64(struct timespec64 *ts)
29{
30 ts->tv_sec = mc146818_get_cmos_time();
31 ts->tv_nsec = 0;
32}