From: Steffen Trumtrar <str@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: [PATCH 11/13] commands: firmwareload: allow loading firmware from dt
Date: Thu, 21 Jan 2021 12:29:56 +0100 [thread overview]
Message-ID: <20210121112958.25937-11-str@pengutronix.de> (raw)
In-Reply-To: <20210121112958.25937-1-str@pengutronix.de>
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
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 | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/commands/firmwareload.c b/commands/firmwareload.c
index b735088f61..f2b7a74be0 100644
--- a/commands/firmwareload.c
+++ b/commands/firmwareload.c
@@ -5,18 +5,23 @@
#include <command.h>
#include <getopt.h>
#include <firmware.h>
+#include <of.h>
static int do_firmwareload(int argc, char *argv[])
{
int ret, opt;
const char *name = NULL, *firmware;
struct firmware_mgr *mgr;
+ int oftree = 0;
- while ((opt = getopt(argc, argv, "t:l")) > 0) {
+ while ((opt = getopt(argc, argv, "t:lo")) > 0) {
switch (opt) {
case 't':
name = optarg;
break;
+ case 'o':
+ oftree = 1;
+ break;
case 'l':
firmwaremgr_list_handlers();
return 0;
@@ -30,6 +35,11 @@ static int do_firmwareload(int argc, char *argv[])
firmware = argv[optind];
+ if (oftree) {
+ ret = of_firmware_load_file(firmware);
+ return ret;
+ }
+
mgr = firmwaremgr_find(name);
if (!mgr) {
@@ -46,6 +56,7 @@ static int do_firmwareload(int argc, char *argv[])
BAREBOX_CMD_HELP_START(firmwareload)
BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT("-t <target>", "define the firmware handler by name")
+BAREBOX_CMD_HELP_OPT("-o\t", "find firmware definition from devicetree")
BAREBOX_CMD_HELP_OPT("-l\t", "list devices capable of firmware loading")
BAREBOX_CMD_HELP_END
--
2.20.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2021-01-21 11:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-21 11:29 [PATCH 01/13] ARM: add fncpy.h from linux v4.6 Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 02/13] ARM: mmu: inherit pte flags from pmd Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 03/13] firmware: socfpga: set APPLYCFG after loading bitstream Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 04/13] reset: add of_reset_control_get to header Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 05/13] drivers: add fpga bridge framework Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 06/13] drivers: fpga: add socfpga bridges Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 07/13] firmware: socfpga: change function prefixes Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 08/13] firmware: import fpga-mgr.h from linux Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 09/13] of: kconfig: of_overlay uses firmwaremgr_load_file Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 10/13] of: of_firmware: add support for fpga bridges Steffen Trumtrar
2021-01-25 9:52 ` Sascha Hauer
2021-01-26 8:47 ` Steffen Trumtrar
2021-01-26 11:02 ` Sascha Hauer
2021-01-21 11:29 ` Steffen Trumtrar [this message]
2021-01-21 11:29 ` [PATCH 12/13] drivers: firmware: socfpga: remove bridges shutdown Steffen Trumtrar
2021-01-21 11:29 ` [PATCH 13/13] firmware: add support for compressed images Steffen Trumtrar
2021-01-25 9:56 ` [PATCH 01/13] ARM: add fncpy.h from linux v4.6 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=20210121112958.25937-11-str@pengutronix.de \
--to=str@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