summaryrefslogtreecommitdiff
path: root/lib/utils/timer
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2021-05-20 11:08:38 +0300
committerAnup Patel <anup@brainfault.org>2021-06-24 07:09:48 +0300
commitbd5d2089b80742a210b257c8e6c1361310725200 (patch)
treeada664073241ca2ac195f1cd1f15001307c0e520 /lib/utils/timer
parent5a049fe1d6a5d1c381113853fce3afad6573bb56 (diff)
downloadopensbi-bd5d2089b80742a210b257c8e6c1361310725200.tar.xz
lib: utils: Add FDT parsing API common for both ACLINT and CLINT
We add fdt_parse_aclint_node() which can parse both ACLINT and CLINT DT nodes. This means fdt_parse_clint_node() is not required anymore so we remove it as well. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Xiang W <wxjstz@126.com>
Diffstat (limited to 'lib/utils/timer')
-rw-r--r--lib/utils/timer/fdt_timer_clint.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/utils/timer/fdt_timer_clint.c b/lib/utils/timer/fdt_timer_clint.c
index 0352e53..63d6586 100644
--- a/lib/utils/timer/fdt_timer_clint.c
+++ b/lib/utils/timer/fdt_timer_clint.c
@@ -7,6 +7,7 @@
* Anup Patel <anup.patel@wdc.com>
*/
+#include <libfdt.h>
#include <sbi/sbi_error.h>
#include <sbi_utils/fdt/fdt_helper.h>
#include <sbi_utils/timer/fdt_timer.h>
@@ -21,6 +22,7 @@ static int timer_clint_cold_init(void *fdt, int nodeoff,
const struct fdt_match *match)
{
int rc;
+ unsigned long ctsize;
struct clint_data *ct, *ctmaster = NULL;
if (CLINT_TIMER_MAX_NR <= clint_timer_count)
@@ -29,10 +31,15 @@ static int timer_clint_cold_init(void *fdt, int nodeoff,
if (1 < clint_timer_count)
ctmaster = &clint_timer[0];
- rc = fdt_parse_clint_node(fdt, nodeoff, TRUE, ct);
+ rc = fdt_parse_aclint_node(fdt, nodeoff, true, &ct->addr, &ctsize,
+ &ct->first_hartid, &ct->hart_count);
if (rc)
return rc;
+ ct->has_64bit_mmio = true;
+ if (fdt_getprop(fdt, nodeoff, "clint,has-no-64bit-mmio", &rc))
+ ct->has_64bit_mmio = false;
+
return clint_cold_timer_init(ct, ctmaster);
}