[PATCH v7 3/7] misc: fw_loader: implement generic get_fw_loader_from_node()

Simon Glass sjg at chromium.org
Fri Jun 19 14:46:05 CEST 2026


Hi Christian,

On 2026-06-16T19:18:35, Christian Marangi <ansuelsmth at gmail.com> wrote:
> misc: fw_loader: implement generic get_fw_loader_from_node()
>
> Implement a generic function to get a FW loader dev from a node.
>
> There is currently only get_fs_loader() but that is limited to chosen
> node and is limited only to FS loader.
>
> Introduce get_fw_loader_from_node() that will parse the
> 'firmware-loader' from a specified node and will search and probe a
> matching FW loader device, if found.
>
> Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
>
> drivers/misc/fw_loader/fw_loader-uclass.c | 23 +++++++++++++++++++++++
>  include/fw_loader.h                       | 14 ++++++++++++++
>  2 files changed, 37 insertions(+)

> diff --git a/drivers/misc/fw_loader/fw_loader-uclass.c b/drivers/misc/fw_loader/fw_loader-uclass.c
> @@ -108,6 +110,27 @@ UCLASS_DRIVER(fw_loader) = {
> +int get_fw_loader_from_node(ofnode node, struct udevice **dev)
> +{
> +     struct udevice *fw_dev;
> +     int ret;
> +
> +     node = ofnode_parse_phandle(node, 'firmware-loader', 0);
> +     if (!ofnode_valid(node))
> +             return -ENODEV;
> +
> +     ret = device_find_global_by_ofnode(node, &fw_dev);
> +     if (ret)
> +             return ret;
> +
> +     ret = device_probe(fw_dev);
> +     if (ret)
> +             return ret;
> +
> +     *dev = fw_dev;
> +     return 0;
> +}

Can you use uclass_get_device_by_ofnode(UCLASS_FIRMWARE_LOADER, node,
dev) here? It is more specific.

Reviewed-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list