riscv: clk: Add CLINT clock to kendryte clock driver
authorSean Anderson <seanga2@gmail.com>
Mon, 28 Sep 2020 14:52:27 +0000 (10:52 -0400)
committerAndes <uboot@andestech.com>
Wed, 30 Sep 2020 00:54:46 +0000 (08:54 +0800)
Another "virtual" clock (in the sense that it isn't configurable). This
could possibly be done as a clock in the device tree, but I think this is a
bit cleaner.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
drivers/clk/kendryte/clk.c
include/dt-bindings/clock/k210-sysctl.h

index 981b3b7..bb19696 100644 (file)
@@ -646,6 +646,10 @@ static int k210_clk_probe(struct udevice *dev)
        REGISTER_GATE(K210_CLK_RTC,   "rtc",   in0);
 #undef REGISTER_GATE
 
+       /* The MTIME register in CLINT runs at one 50th the CPU clock speed */
+       clk_dm(K210_CLK_CLINT,
+              clk_register_fixed_factor(NULL, "clint", "cpu", 0, 1, 50));
+
        return 0;
 }
 
index 0e3ed3f..fe852bb 100644 (file)
@@ -55,5 +55,6 @@
 #define K210_CLK_OTP    43
 #define K210_CLK_RTC    44
 #define K210_CLK_ACLK   45
+#define K210_CLK_CLINT  46
 
 #endif /* CLOCK_K210_SYSCTL_H */