mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH v4 08/10] commands: firmwareload: allow loading firmware from dt
Date: Tue, 22 Jun 2021 11:08:56 +0200	[thread overview]
Message-ID: <20210622090856.GY31738@pengutronix.de> (raw)
In-Reply-To: <20210616063246.14900-8-s.trumtrar@pengutronix.de>

On Wed, Jun 16, 2021 at 08:32:44AM +0200, Steffen Trumtrar wrote:
> firmwareload can only load a bitstream into an FPGA without any
> knowledge of possible additional needs (e.g. FPGA bridges).
> 
> These are defined in the fpga-region nodes in the devicetree. The
> fpga-region describes the layout of the FPGA and the bridges it needs
> en/disabled.
> 
> Add an option to let firmwareload go via the oftree route and load the
> firmware that way.
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> 
> ---
> 
> v2->v3 - remove unused arg 'o'
>        - use xstrdup()
> ---
>  commands/firmwareload.c | 39 +++++++++++++++++++++++++++++++++------
>  1 file changed, 33 insertions(+), 6 deletions(-)
> 
> diff --git a/commands/firmwareload.c b/commands/firmwareload.c
> index b735088f6117..c2a017c45479 100644
> --- a/commands/firmwareload.c
> +++ b/commands/firmwareload.c
> @@ -5,18 +5,35 @@
>  #include <command.h>
>  #include <getopt.h>
>  #include <firmware.h>
> +#include <of.h>
>  
>  static int do_firmwareload(int argc, char *argv[])
>  {
> -	int ret, opt;
> +	int opt;
>  	const char *name = NULL, *firmware;
>  	struct firmware_mgr *mgr;
> +	char *path = NULL;
> +	char *search_path = NULL;
> +	char *compatible = NULL;
> +	int oftree = 0;
>  
> -	while ((opt = getopt(argc, argv, "t:l")) > 0) {
> +	while ((opt = getopt(argc, argv, "t:c:S:D:l")) > 0) {
>  		switch (opt) {
>  		case 't':
>  			name = optarg;
>  			break;
> +		case 'c':
> +			compatible = xstrdup(optarg);
> +			oftree = 1;
> +			break;
> +		case 'S':
> +			search_path = xstrdup(optarg);
> +			oftree = 1;
> +			break;
> +		case 'D':
> +			path = xstrdup(optarg);

As mentioned to v2 these strings are not freed. Anyway, duplicating them
is not necessary, a plain path = optarg is enough. Will fix that up.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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:[~2021-06-22  9:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16  6:32 [PATCH v4 01/10] reset: add of_reset_control_get to header Steffen Trumtrar
2021-06-16  6:32 ` [PATCH v4 02/10] drivers: add fpga bridge framework Steffen Trumtrar
2021-06-16  6:32 ` [PATCH v4 03/10] drivers: fpga: add socfpga bridges Steffen Trumtrar
2021-06-16  6:32 ` [PATCH v4 04/10] firmware: socfpga: change function prefixes Steffen Trumtrar
2021-06-16  6:32 ` [PATCH v4 05/10] firmware: import fpga-mgr.h from linux Steffen Trumtrar
2021-06-16  6:32 ` [PATCH v4 06/10] of: kconfig: of_overlay uses firmwaremgr_load_file Steffen Trumtrar
2021-06-16  6:32 ` [PATCH v4 07/10] of: of_firmware: add support for fpga bridges Steffen Trumtrar
2021-06-18  8:32   ` Steffen Trumtrar
2021-06-21  8:01     ` Sascha Hauer
2021-06-16  6:32 ` [PATCH v4 08/10] commands: firmwareload: allow loading firmware from dt Steffen Trumtrar
2021-06-22  9:08   ` Sascha Hauer [this message]
2021-06-16  6:32 ` [PATCH v4 09/10] drivers: firmware: socfpga: remove bridges shutdown Steffen Trumtrar
2021-06-16  6:32 ` [PATCH v4 10/10] firmware: add support for compressed images Steffen Trumtrar

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=20210622090856.GY31738@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.trumtrar@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