mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Michael Tretter <m.tretter@pengutronix.de>, barebox@lists.infradead.org
Subject: Re: [PATCH v2 6/7] blspec: load firmware if specified in dt overlay
Date: Wed, 11 Sep 2019 09:53:24 +0200	[thread overview]
Message-ID: <9d21f10e-9a02-a5c4-e921-42f76c89ebc7@pengutronix.de> (raw)
In-Reply-To: <20190906132008.25309-7-m.tretter@pengutronix.de>

Hello Michael,

On 9/6/19 3:20 PM, Michael Tretter wrote:
> If a device tree overlay referenced by the blspec depends on firmware,
> try to load the firmware from the default Linux firmware search path
> /lib/firmware in the about to be started rootfs.

Linking barebox with CONFIG_BLSPEC, but without CONFIG_OF_OVERLAY
now fails:

./common/blspec.c:84: undefined reference to `firmware_load_overlay'

Cheers
Ahmad

> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> 
> ---
> Changelog:
> 
> v1->v2: none
> ---
>  common/blspec.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/common/blspec.c b/common/blspec.c
> index fbba2fc78c..e733bf1188 100644
> --- a/common/blspec.c
> +++ b/common/blspec.c
> @@ -14,6 +14,7 @@
>  
>  #include <environment.h>
>  #include <globalvar.h>
> +#include <firmware.h>
>  #include <readkey.h>
>  #include <common.h>
>  #include <driver.h>
> @@ -49,6 +50,7 @@ static int blspec_apply_oftree_overlay(char *file, const char *abspath,
>  	struct fdt_header *fdt;
>  	struct device_node *overlay;
>  	char *path;
> +	char *firmware_path;
>  
>  	path = basprintf("%s/%s", abspath, file);
>  
> @@ -72,6 +74,20 @@ static int blspec_apply_oftree_overlay(char *file, const char *abspath,
>  		goto out;
>  	}
>  
> +	/*
> +	 * Unfortunately the device tree overlay contains only the filename of
> +	 * the firmware and relies on the firmware search paths to find the
> +	 * actual file. Use /lib/firmware in the Linux root directory and hope
> +	 * for the best.
> +	 */
> +	firmware_path = basprintf("%s/%s", abspath, "/lib/firmware");
> +	ret = firmware_load_overlay(overlay, firmware_path);
> +	free(firmware_path);
> +	if (ret) {
> +		of_delete_node(overlay);
> +		goto out;
> +	}
> +
>  	ret = of_register_overlay(overlay);
>  	if (ret) {
>  		pr_warn("cannot register devicetree overlay \"%s\"\n", path);
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-09-11  7:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 13:20 [PATCH v2 0/7] Device Tree Overlay Support Michael Tretter
2019-09-06 13:20 ` [PATCH v2 1/7] dtc: add -@ option to enable __symbols__ Michael Tretter
2019-09-06 13:20 ` [PATCH v2 2/7] of: add support for devicetree overlays Michael Tretter
2019-09-06 13:20 ` [PATCH v2 3/7] blspec: " Michael Tretter
2019-09-06 13:20 ` [PATCH v2 4/7] of: add iterator for overlays Michael Tretter
2019-09-06 13:20 ` [PATCH v2 5/7] firmware: add support to load firmware from dt overlay Michael Tretter
2019-09-06 13:20 ` [PATCH v2 6/7] blspec: load firmware if specified in " Michael Tretter
2019-09-11  7:53   ` Ahmad Fatoum [this message]
2019-09-06 13:20 ` [PATCH v2 7/7] commands: add of_overlay command for device tree overlays Michael Tretter
2019-09-11  7:55   ` Ahmad Fatoum
2019-09-11  8:00     ` Ahmad Fatoum
2019-09-11  9:28     ` Michael Tretter
2019-09-11  9:33       ` Ahmad Fatoum
2019-09-09  8:57 ` [PATCH v2 0/7] Device Tree Overlay Support Sascha Hauer
2019-09-12  6:57   ` Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9d21f10e-9a02-a5c4-e921-42f76c89ebc7@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.tretter@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox