From a9a97511851198559e75640a9e5e67f65695dc2e Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Tue, 12 May 2020 18:38:31 +0530 Subject: lib: utils: Allow CLINT functions to be used for multiple CLINTs We extend CLINT cold init function to have a "struct clint_data *" parameter pointing to CLINT details. This allows platforms to use CLINT functions for multiple CLINT instances. When multiple CLINTs are present, the platform can also provide one of the CLINT as reference CLINT for other CLINTs. This will help CLINTs to sync their time value with reference CLINT using a time_delta computed in warm init function. Signed-off-by: Anup Patel Reviewed-by: Atish Patra --- lib/utils/timer/fdt_timer_clint.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/utils/timer') diff --git a/lib/utils/timer/fdt_timer_clint.c b/lib/utils/timer/fdt_timer_clint.c index 6aa6929..2f5f283 100644 --- a/lib/utils/timer/fdt_timer_clint.c +++ b/lib/utils/timer/fdt_timer_clint.c @@ -11,6 +11,8 @@ #include #include +static struct clint_data clint_timer; + static int timer_clint_cold_init(void *fdt, int nodeoff, const struct fdt_match *match) { @@ -27,7 +29,12 @@ static int timer_clint_cold_init(void *fdt, int nodeoff, return rc; /* TODO: We should figure-out CLINT has_64bit_mmio from DT node */ - return clint_cold_timer_init(addr, max_hartid + 1, TRUE); + clint_timer.addr = addr; + clint_timer.first_hartid = 0; + clint_timer.hart_count = max_hartid + 1; + clint_timer.has_64bit_mmio = TRUE; + + return clint_cold_timer_init(&clint_timer, NULL); } static const struct fdt_match timer_clint_match[] = { -- cgit v1.2.3