aboutsummaryrefslogtreecommitdiff
path: root/drivers/timer/andes_plmt_timer.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-01-18 08:04:28 -0500
committerTom Rini <trini@konsulko.com>2021-01-18 08:04:28 -0500
commit59e4e391df8c254299b1342c3cfa3390e9f1e895 (patch)
tree2dcb7f6fc8b1caab173f2abdbe78f368d254d08c /drivers/timer/andes_plmt_timer.c
parentb5b0237d0216db34605ca54b83588fcfcf5e63a8 (diff)
parent9e550e18305fb31af83bfb72d16e86d8c054fb65 (diff)
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-riscv
- Update qemu-riscv.rst build instructions. - Add support for SPI on Kendryte K210. - Add Microchip PolarFire SoC Icicle Kit support. - Add support for an early timer. - Select TIMER_EARLY to avoid infinite recursion for Trace.
Diffstat (limited to 'drivers/timer/andes_plmt_timer.c')
-rw-r--r--drivers/timer/andes_plmt_timer.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/timer/andes_plmt_timer.c b/drivers/timer/andes_plmt_timer.c
index db2cf86f63..a3797b22c7 100644
--- a/drivers/timer/andes_plmt_timer.c
+++ b/drivers/timer/andes_plmt_timer.c
@@ -18,11 +18,30 @@
/* mtime register */
#define MTIME_REG(base) ((ulong)(base))
-static u64 andes_plmt_get_count(struct udevice *dev)
+static u64 notrace andes_plmt_get_count(struct udevice *dev)
{
return readq((void __iomem *)MTIME_REG(dev_get_priv(dev)));
}
+#if CONFIG_IS_ENABLED(RISCV_MMODE) && IS_ENABLED(CONFIG_TIMER_EARLY)
+/**
+ * timer_early_get_rate() - Get the timer rate before driver model
+ */
+unsigned long notrace timer_early_get_rate(void)
+{
+ return RISCV_MMODE_TIMER_FREQ;
+}
+
+/**
+ * timer_early_get_count() - Get the timer count before driver model
+ *
+ */
+u64 notrace timer_early_get_count(void)
+{
+ return readq((void __iomem *)MTIME_REG(RISCV_MMODE_TIMERBASE));
+}
+#endif
+
static const struct timer_ops andes_plmt_ops = {
.get_count = andes_plmt_get_count,
};