1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2018, Anup Patel <anup@brainfault.org>
4 * Copyright (C) 2018, Bin Meng <bmeng.cn@gmail.com>
6 * The riscv_get_time() API implementation that is using the
7 * standard rdtime instruction.
12 /* Implement the API required by RISC-V timer driver */
13 int riscv_get_time(u64 *time)
18 __asm__ __volatile__ (
26 __asm__ __volatile__ (
32 : "=&r" (hi), "=&r" (lo), "=&r" (tmp));
34 *time = ((u64)hi << 32) | lo;