From 12e7af9ab7ef9adf61b9138e2c38e3aeef3c140b Mon Sep 17 00:00:00 2001
From: Anup Patel <anup.patel@wdc.com>
Date: Tue, 14 Sep 2021 21:51:48 +0530
Subject: lib: sbi: Add timer frequency to struct sbi_timer_device

Generic mdelay() and udelay() functions can be provided by the
sbi_timer framework if timer frequency is available in the timer
instance provided by the platform support or timer driver.

This patch adds timer frequency (timer_freq) member in the
struct sbi_timer_device for above purpose.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Xiang W <wxjstz@126.com>
---
 include/sbi/sbi_timer.h                 | 3 +++
 include/sbi_utils/timer/aclint_mtimer.h | 1 +
 2 files changed, 4 insertions(+)

(limited to 'include')

diff --git a/include/sbi/sbi_timer.h b/include/sbi/sbi_timer.h
index 1ba6da0..211e83d 100644
--- a/include/sbi/sbi_timer.h
+++ b/include/sbi/sbi_timer.h
@@ -17,6 +17,9 @@ struct sbi_timer_device {
 	/** Name of the timer operations */
 	char name[32];
 
+	/** Frequency of timer in HZ */
+	unsigned long timer_freq;
+
 	/** Get free-running timer value */
 	u64 (*timer_value)(void);
 
diff --git a/include/sbi_utils/timer/aclint_mtimer.h b/include/sbi_utils/timer/aclint_mtimer.h
index a9fe445..f02cc62 100644
--- a/include/sbi_utils/timer/aclint_mtimer.h
+++ b/include/sbi_utils/timer/aclint_mtimer.h
@@ -24,6 +24,7 @@
 
 struct aclint_mtimer_data {
 	/* Public details */
+	unsigned long mtime_freq;
 	unsigned long mtime_addr;
 	unsigned long mtime_size;
 	unsigned long mtimecmp_addr;
-- 
cgit v1.2.3