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@lists.infradead.org
Subject: Re: [PATCH v2 10/12] commands: firmwareload: allow loading firmware from dt
Date: Thu, 28 Jan 2021 16:16:32 +0100	[thread overview]
Message-ID: <20210128151632.GC19583@pengutronix.de> (raw)
In-Reply-To: <20210127134423.31587-10-s.trumtrar@pengutronix.de>

On Wed, Jan 27, 2021 at 02:44:21PM +0100, 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>
> ---
>  commands/firmwareload.c | 42 +++++++++++++++++++++++++++++++++++------
>  1 file changed, 36 insertions(+), 6 deletions(-)
> 
> diff --git a/commands/firmwareload.c b/commands/firmwareload.c
> index b735088f6117..2b1e770662d1 100644
> --- a/commands/firmwareload.c
> +++ b/commands/firmwareload.c
> @@ -5,18 +5,38 @@
>  #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:lo")) > 0) {

'o' is added but not handled.

>  		switch (opt) {
>  		case 't':
>  			name = optarg;
>  			break;
> +		case 'c':
> +			compatible = xzalloc(strlen(optarg) + 1);
> +			strcpy(compatible, optarg);

Use xstrdup(). The string is not freed.

> +			oftree = 1;
> +			break;
> +		case 'S':
> +			search_path = xzalloc(strlen(optarg) + 1);
> +			strcpy(search_path, optarg);

ditto

> +			oftree = 1;
> +			break;
> +		case 'D':
> +			path = xzalloc(strlen(optarg) + 1);
> +			strcpy(path, optarg);

ditto

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-01-28 15:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 13:44 [PATCH v2 01/12] ARM: mmu: inherit pte flags from pmd Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 02/12] firmware: socfpga: set APPLYCFG after loading bitstream Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 03/12] reset: add of_reset_control_get to header Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 04/12] drivers: add fpga bridge framework Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 05/12] drivers: fpga: add socfpga bridges Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 06/12] firmware: socfpga: change function prefixes Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 07/12] firmware: import fpga-mgr.h from linux Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 08/12] of: kconfig: of_overlay uses firmwaremgr_load_file Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 09/12] of: of_firmware: add support for fpga bridges Steffen Trumtrar
2021-01-28 15:10   ` Sascha Hauer
2021-01-27 13:44 ` [PATCH v2 10/12] commands: firmwareload: allow loading firmware from dt Steffen Trumtrar
2021-01-28 15:16   ` Sascha Hauer [this message]
2021-01-27 13:44 ` [PATCH v2 11/12] drivers: firmware: socfpga: remove bridges shutdown Steffen Trumtrar
2021-01-27 13:44 ` [PATCH v2 12/12] firmware: add support for compressed images Steffen Trumtrar
2021-01-28 15:27   ` 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=20210128151632.GC19583@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