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:
Anup Patel
2021-09-14 21:51:48 +05:30
committed by Anup Patel
parent 72154f4708
commit 12e7af9ab7
10 changed files with 25 additions and 1 deletions

View File

@@ -186,6 +186,8 @@ int aclint_mtimer_cold_init(struct aclint_mtimer_data *mt,
(mt->first_hartid >= SBI_HARTMASK_MAX_BITS) ||
(mt->hart_count > ACLINT_MTIMER_MAX_HARTS))
return SBI_EINVAL;
if (reference && mt->mtime_freq != reference->mtime_freq)
return SBI_EINVAL;
/* Initialize private data */
aclint_mtimer_set_reference(mt, reference);
@@ -227,6 +229,7 @@ int aclint_mtimer_cold_init(struct aclint_mtimer_data *mt,
return rc;
}
mtimer.timer_freq = mt->mtime_freq;
sbi_timer_set_device(&mtimer);
return 0;