summaryrefslogtreecommitdiff
path: root/lib/utils/timer/fdt_timer.c
diff options
context:
space:
mode:
authorAnup Patel <[email protected]>2020-05-13 13:11:44 +0530
committerAnup Patel <[email protected]>2020-05-23 10:36:53 +0530
commita63f05f3dea6fde8b5d545c2c6a5762faa56539a (patch)
tree93601cd20b7c96a842c15b93a9530ed81aa56452 /lib/utils/timer/fdt_timer.c
parent6956e83a944df1c54e4be3554f2ed4863ebe2f75 (diff)
lib: utils/timer: Initialize all matching timer DT nodes
We can have multiple matching DT nodes of the same FDT timer driver so in this case we should call cold_init() for all matching DT nodes instead of just first matching DT node. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Atish Patra <[email protected]>
Diffstat (limited to 'lib/utils/timer/fdt_timer.c')
-rw-r--r--lib/utils/timer/fdt_timer.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/utils/timer/fdt_timer.c b/lib/utils/timer/fdt_timer.c
index 46edb83a..d1d0e0ce 100644
--- a/lib/utils/timer/fdt_timer.c
+++ b/lib/utils/timer/fdt_timer.c
@@ -80,17 +80,19 @@ static int fdt_timer_cold_init(void)
for (pos = 0; pos < array_size(timer_drivers); pos++) {
drv = timer_drivers[pos];
- noff = fdt_find_match(fdt, -1, drv->match_table, &match);
- if (noff < 0)
- continue;
-
- if (drv->cold_init) {
- rc = drv->cold_init(fdt, noff, match);
- if (rc)
- return rc;
+ noff = -1;
+ while ((noff = fdt_find_match(fdt, noff,
+ drv->match_table, &match)) >= 0) {
+ if (drv->cold_init) {
+ rc = drv->cold_init(fdt, noff, match);
+ if (rc)
+ return rc;
+ }
+ current_driver = drv;
}
- current_driver = drv;
- break;
+
+ if (current_driver != &dummy)
+ break;
}
return 0;