1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2019 Christoph Hellwig.
7 #include <linux/of_address.h>
8 #include <linux/types.h>
11 #include <asm/timex.h>
15 * This is the layout used by the SiFive clint, which is also shared by the qemu
16 * virt platform, and the Kendryte KD210 at least.
18 #define CLINT_IPI_OFF 0
19 #define CLINT_TIME_CMP_OFF 0x4000
20 #define CLINT_TIME_VAL_OFF 0xbff8
22 u32 __iomem *clint_ipi_base;
24 void clint_init_boot_cpu(void)
26 struct device_node *np;
29 np = of_find_compatible_node(NULL, NULL, "riscv,clint0");
31 panic("clint not found");
35 base = of_iomap(np, 0);
37 panic("could not map CLINT");
39 clint_ipi_base = base + CLINT_IPI_OFF;
40 riscv_time_cmp = base + CLINT_TIME_CMP_OFF;
41 riscv_time_val = base + CLINT_TIME_VAL_OFF;
43 clint_clear_ipi(boot_cpu_hartid);