arm64: dts: Revert "specify console via command line"
[linux/fpc-iii.git] / arch / riscv / kernel / clint.c
blob3647980d14c3c9c853c3541b0907a951c8ef4716
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Copyright (c) 2019 Christoph Hellwig.
4 */
6 #include <linux/io.h>
7 #include <linux/of_address.h>
8 #include <linux/types.h>
9 #include <asm/clint.h>
10 #include <asm/csr.h>
11 #include <asm/timex.h>
12 #include <asm/smp.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;
27 void __iomem *base;
29 np = of_find_compatible_node(NULL, NULL, "riscv,clint0");
30 if (!np) {
31 panic("clint not found");
32 return;
35 base = of_iomap(np, 0);
36 if (!base)
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);