[PATCH 2/7] lib: utils/timer: Skip initialize timer when dt is not enabled

Anup Patel anup at brainfault.org
Thu Jun 13 06:25:13 PDT 2024


On Tue, Jun 11, 2024 at 4:49 PM Xiang W <wxjstz at 126.com> wrote:
>
> When the dt node has a status property and the value is not ok or
> okay, skip initializing timer.
>
> Signed-off-by: Xiang W <wxjstz at 126.com>

LGTM.

Reviewed-by: Anup Patel <anup at brainfault.org>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  lib/utils/timer/fdt_timer.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/utils/timer/fdt_timer.c b/lib/utils/timer/fdt_timer.c
> index 62426a7..f468730 100644
> --- a/lib/utils/timer/fdt_timer.c
> +++ b/lib/utils/timer/fdt_timer.c
> @@ -44,6 +44,9 @@ static int fdt_timer_cold_init(void)
>                 noff = -1;
>                 while ((noff = fdt_find_match(fdt, noff,
>                                         drv->match_table, &match)) >= 0) {
> +                       if (!fdt_node_is_enabled(fdt, noff))
> +                               continue;
> +
>                         /* drv->cold_init must not be NULL */
>                         if (drv->cold_init == NULL)
>                                 return SBI_EFAIL;
> --
> 2.43.0
>



More information about the opensbi mailing list