All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Gagniuc <mr.nuke.me@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH 5/7] spl: fit: Support loading FPGA images from list of "loadables"
Date: Wed, 10 Mar 2021 12:04:40 -0600	[thread overview]
Message-ID: <20210310180442.746517-6-mr.nuke.me@gmail.com> (raw)
In-Reply-To: <20210310180442.746517-1-mr.nuke.me@gmail.com>

Commit 4afc4f37c70e ("doc: FIT image: Clarify format and simplify
syntax") and delegated FPGA images to be added via the list of
"loadables" in lieu of the "fpga" property. Now actually implement
this in code.

Note that the "compatible" property is ignored for the time being, as
implementing "compatible" loading is beyond the scope of this change.
However, "u-boot,fpga-legacy" is accepted without warning.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
---
 common/spl/spl_fit.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 68f29c0026..ca6be6a839 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -477,6 +477,20 @@ static int spl_fit_record_loadable(const struct spl_fit_info *ctx, int index,
 	return ret;
 }
 
+static int spl_fit_image_is_fpga(const void *fit, int node)
+{
+	const char *type;
+
+	if (!IS_ENABLED(CONFIG_SPL_FPGA))
+		return 0;
+
+	type = fdt_getprop(fit, node, FIT_TYPE_PROP, NULL);
+	if (!type)
+		return 0;
+
+	return !strcmp(type, "fpga");
+}
+
 static int spl_fit_image_get_os(const void *fit, int noffset, uint8_t *os)
 {
 	if (!CONFIG_IS_ENABLED(FIT_IMAGE_TINY) || CONFIG_IS_ENABLED(OS_BOOT))
@@ -536,11 +550,18 @@ static void warn_deprecated(const char *msg)
 static int spl_fit_upload_fpga(struct spl_fit_info *ctx, int node,
 			       struct spl_image_info *fpga_image)
 {
+	const char *compatible;
 	int ret;
 
 	debug("FPGA bitstream at: %x, size: %x\n",
 	      (u32)fpga_image->load_addr, fpga_image->size);
 
+	compatible = fdt_getprop(ctx->fit, node, "compatible", NULL);
+	if (!compatible)
+		warn_deprecated("'fpga' image without 'compatible' property");
+	else if (strcmp(compatible, "u-boot,fpga-legacy"))
+		printf("Ignoring compatible = %s property\n", compatible);
+
 	ret = fpga_load(0, (void *)fpga_image->load_addr, fpga_image->size,
 			BIT_FULL);
 	if (ret) {
@@ -739,6 +760,9 @@ int spl_load_simple_fit(struct spl_image_info *spl_image,
 			return ret;
 		}
 
+		if (spl_fit_image_is_fpga(ctx.fit, node))
+			spl_fit_upload_fpga(&ctx, node, &image_info);
+
 		if (!spl_fit_image_get_os(ctx.fit, node, &os_type))
 			debug("Loadable is %s\n", genimg_get_os_name(os_type));
 
-- 
2.26.2

  parent reply	other threads:[~2021-03-10 18:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 18:04 [PATCH 0/7] SPL: FIT: Bring the SPL_LOAD_FIT path in line with documentation Alexandru Gagniuc
2021-03-10 18:04 ` [PATCH 1/7] spl: fit: Don't overwrite previous loadable if "load" is missing Alexandru Gagniuc
2021-03-15  7:25   ` Simon Glass
2021-03-10 18:04 ` [PATCH 2/7] doc: FIT image: Introduce "u-boot,fpga-legacy" property Alexandru Gagniuc
2021-03-10 18:04 ` [PATCH 3/7] spl: fit: Move FPGA loading code to separate functions Alexandru Gagniuc
2021-03-15  7:25   ` Simon Glass
2021-03-10 18:04 ` [PATCH 4/7] spl: fit: Warn if FIT contains "fpga" property in config node Alexandru Gagniuc
2021-03-18  6:44   ` Simon Glass
2021-03-19 14:53     ` Alex G.
2021-03-19 23:54       ` Simon Glass
2021-03-10 18:04 ` Alexandru Gagniuc [this message]
2021-03-29  7:43   ` [PATCH 5/7] spl: fit: Support loading FPGA images from list of "loadables" Simon Glass
2021-03-29 15:35     ` Alex G.
2021-03-10 18:04 ` [PATCH 6/7] Kconfig: Document the limitations of the simple SPL_LOAD_FIT path Alexandru Gagniuc
2021-03-29  7:43   ` Simon Glass
2021-03-10 18:04 ` [PATCH 7/7] doc: FIT image: Update FPGA example to make use of "loadables" Alexandru Gagniuc
2021-03-29  7:43   ` Simon Glass

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=20210310180442.746517-6-mr.nuke.me@gmail.com \
    --to=mr.nuke.me@gmail.com \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.