Files
opensbi/lib/utils/timer/fdt_timer.c
Samuel Holland a387a8dff0 lib: utils/timer: Use fdt_driver for initialization
The timer driver subsystem does not need any extra data, so it can use
`struct fdt_driver` directly. The generic fdt_timer_init() performs a
best-effort initialization of all matching DT nodes.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
2024-11-28 17:57:20 +05:30

26 lines
645 B
C

/*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
*
* Authors:
* Anup Patel <anup.patel@wdc.com>
*/
#include <sbi/sbi_error.h>
#include <sbi/sbi_scratch.h>
#include <sbi_utils/fdt/fdt_helper.h>
#include <sbi_utils/timer/fdt_timer.h>
/* List of FDT timer drivers generated at compile time */
extern const struct fdt_driver *const fdt_timer_drivers[];
int fdt_timer_init(void)
{
/*
* Systems with Sstc might not provide any node in the FDT,
* so do not return a failure if no device is found.
*/
return fdt_driver_init_all(fdt_get_address(), fdt_timer_drivers);
}