From e931f387b27a2f575f5b713391e241d8963b48c5 Mon Sep 17 00:00:00 2001 From: Anup Patel <anup.patel@wdc.com> Date: Tue, 13 Jul 2021 11:23:41 +0800 Subject: lib: utils/fdt: Add fdt_parse_phandle_with_args() API The libfdt project does not have a generic API to parse phandle with args from a DT node so we add fdt_parse_phandle_with_args() for this purpose. This new API will be useful to FDT based drivers. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com> --- include/sbi_utils/fdt/fdt_helper.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/sbi_utils/fdt/fdt_helper.h b/include/sbi_utils/fdt/fdt_helper.h index 871f9b9..55b9382 100644 --- a/include/sbi_utils/fdt/fdt_helper.h +++ b/include/sbi_utils/fdt/fdt_helper.h @@ -17,6 +17,13 @@ struct fdt_match { void *data; }; +#define FDT_MAX_PHANDLE_ARGS 16 +struct fdt_phandle_args { + int node_offset; + int args_count; + u32 args[FDT_MAX_PHANDLE_ARGS]; +}; + struct platform_uart_data { unsigned long addr; unsigned long freq; @@ -32,6 +39,10 @@ int fdt_find_match(void *fdt, int startoff, const struct fdt_match *match_table, const struct fdt_match **out_match); +int fdt_parse_phandle_with_args(void *fdt, int nodeoff, + const char *prop, const char *cells_prop, + int index, struct fdt_phandle_args *out_args); + int fdt_get_node_addr_size(void *fdt, int node, unsigned long *addr, unsigned long *size); -- cgit v1.2.3