mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-25 07:41:42 +01:00
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>
This commit is contained in:
@@ -38,6 +38,10 @@ static int timer_mtimer_cold_init(void *fdt, int nodeoff,
|
||||
mt->has_64bit_mmio = true;
|
||||
mt->has_shared_mtime = false;
|
||||
|
||||
rc = fdt_parse_timebase_frequency(fdt, &mt->mtime_freq);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (match->data) { /* SiFive CLINT */
|
||||
/* Set CLINT addresses */
|
||||
mt->mtimecmp_addr = addr[0] + ACLINT_DEFAULT_MTIMECMP_OFFSET;
|
||||
|
Reference in New Issue
Block a user