18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2020 Loongson Technology Corporation Limited
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef _ASM_TIMEX_H
68c2ecf20Sopenharmony_ci#define _ASM_TIMEX_H
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifdef __KERNEL__
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/compiler.h>
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <asm/cpu.h>
138c2ecf20Sopenharmony_ci#include <asm/cpu-features.h>
148c2ecf20Sopenharmony_ci#include <asm/loongarchregs.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * Standard way to access the cycle counter.
188c2ecf20Sopenharmony_ci * Currently only used on SMP for scheduling.
198c2ecf20Sopenharmony_ci *
208c2ecf20Sopenharmony_ci * We know that all SMP capable CPUs have cycle counters.
218c2ecf20Sopenharmony_ci */
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_citypedef unsigned long cycles_t;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci#define get_cycles get_cycles
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistatic inline cycles_t get_cycles(void)
288c2ecf20Sopenharmony_ci{
298c2ecf20Sopenharmony_ci	return drdtime();
308c2ecf20Sopenharmony_ci}
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#endif /*  _ASM_TIMEX_H */
35