xref: /linux/arch/mips/loongson64/time.c (revision 6fbde6b4)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
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
8  */
9 #include <asm/mc146818-time.h>
10 #include <asm/time.h>
11 #include <asm/hpet.h>
12 
13 #include <loongson.h>
14 
15 void __init plat_time_init(void)
16 {
17 	/* setup mips r4k timer */
18 	mips_hpt_frequency = cpu_clock_freq / 2;
19 
20 #ifdef CONFIG_RS780_HPET
21 	setup_hpet_timer();
22 #endif
23 }
24 
25 void read_persistent_clock64(struct timespec64 *ts)
26 {
27 	ts->tv_sec = mc146818_get_cmos_time();
28 	ts->tv_nsec = 0;
29 }
30