public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marex@denx.de>,
	"NXP i.MX U-Boot Team" <uboot-imx@nxp.com>,
	Algapally Santosh Sagar <santoshsagar.algapally@amd.com>,
	Fabio Estevam <festevam@gmail.com>,
	Mayuresh Chitale <mchitale@ventanamicro.com>,
	Oleksandr Suvorov <oleksandr.suvorov@foundries.io>,
	Ovidiu Panait <ovpanait@gmail.com>,
	Roger Quadros <rogerq@kernel.org>, Simon Glass <sjg@chromium.org>,
	Stefano Babic <sbabic@denx.de>,
	u-boot@dh-electronics.com
Subject: [PATCH 1/5] spl: fit: Add board level function to decide application of DTO
Date: Thu, 21 Sep 2023 20:44:16 +0200	[thread overview]
Message-ID: <20230921184420.45186-1-marex@denx.de> (raw)

Add board-specific function used to indicate whether a DTO from fitImage
configuration node 'fdt' property DT and DTO list should be applied onto
the base DT or not applied.

This is useful in case of DTOs which implement e.g. different board revision
details, where such DTO should be applied on one board revision, and should
not be applied on another board revision.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: "NXP i.MX U-Boot Team" <uboot-imx@nxp.com>
Cc: Algapally Santosh Sagar <santoshsagar.algapally@amd.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Mayuresh Chitale <mchitale@ventanamicro.com>
Cc: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Cc: Ovidiu Panait <ovpanait@gmail.com>
Cc: Roger Quadros <rogerq@kernel.org>
Cc: Simon Glass <sjg@chromium.org>
Cc: Stefano Babic <sbabic@denx.de>
Cc: u-boot@dh-electronics.com
---
 common/spl/spl_fit.c | 23 ++++++++++++++++++++---
 include/spl.h        | 16 ++++++++++++++++
 2 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 730639f7562..ed91ddd6b40 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -357,6 +357,11 @@ static bool os_takes_devicetree(uint8_t os)
 	}
 }
 
+__weak int board_spl_fit_append_fdt_skip(const char *name)
+{
+	return 0;	/* Do not skip */
+}
+
 static int spl_fit_append_fdt(struct spl_image_info *spl_image,
 			      struct spl_load_info *info, ulong sector,
 			      const struct spl_fit_info *ctx)
@@ -400,11 +405,23 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
 		void *tmpbuffer = NULL;
 
 		for (; ; index++) {
-			node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index);
-			if (node == -E2BIG) {
+			const char *str;
+
+			ret = spl_fit_get_image_name(ctx, FIT_FDT_PROP, index, &str);
+			if (ret == -E2BIG) {
 				debug("%s: No additional FDT node\n", __func__);
+				ret = 0;
 				break;
-			} else if (node < 0) {
+			} else if (ret < 0) {
+				continue;
+			}
+
+			ret = board_spl_fit_append_fdt_skip(str);
+			if (ret)
+				continue;
+
+			node = fdt_subnode_offset(ctx->fit, ctx->images_node, str);
+			if (node < 0) {
 				debug("%s: unable to find FDT node %d\n",
 				      __func__, index);
 				continue;
diff --git a/include/spl.h b/include/spl.h
index 92bcaa90a4a..60a432c4b15 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -895,6 +895,22 @@ void spl_perform_fixups(struct spl_image_info *spl_image);
  */
 struct legacy_img_hdr *spl_get_load_buffer(ssize_t offset, size_t size);
 
+/**
+ * board_spl_fit_append_fdt_skip(): test whether DTO application should be skipped
+ * @name:	DTO node name within fitImage images node
+ *
+ * A board-specific function used to indicate whether a DTO from fitImage
+ * configuration node 'fdt' property DT and DTO list should be applied onto
+ * the base DT or not applied.
+ *
+ * This is useful in case of DTOs which implement e.g. different board revision
+ * details, where such DTO should be applied on one board revision, and should
+ * not be applied on another board revision.
+ *
+ * Return:	0 to indicate DTO is not skipped, all else to indicate DTO is skipped.
+ */
+int board_spl_fit_append_fdt_skip(const char *name);
+
 void board_boot_order(u32 *spl_boot_list);
 void spl_save_restore_data(void);
 #endif
-- 
2.40.1


             reply	other threads:[~2023-09-21 18:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 18:44 Marek Vasut [this message]
2023-09-21 18:44 ` [PATCH 2/5] arm64: dts: imx8mp: Switch to DT overlays for i.MX8MP DHCOM SoM Marek Vasut
2023-10-16 16:46   ` sbabic
2023-09-21 18:44 ` [PATCH 3/5] arm64: dts: imx8mp: Update i.MX8MP DHCOM SoM DT to production rev.200 Marek Vasut
2023-10-16 16:46   ` sbabic
2023-09-21 18:44 ` [PATCH 4/5] arm64: dts: imx8mp: Drop i.MX8MP DHCOM rev.100 PHY address workaround from PDK3 DT Marek Vasut
2023-10-16 16:46   ` sbabic
2023-09-21 18:44 ` [PATCH 5/5] arm64: dts: imx8mp: Add DT overlay describing i.MX8MP DHCOM SoM rev.100 Marek Vasut
2023-10-16 16:46   ` sbabic
2023-10-16 16:46 ` [PATCH 1/5] spl: fit: Add board level function to decide application of DTO sbabic

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=20230921184420.45186-1-marex@denx.de \
    --to=marex@denx.de \
    --cc=festevam@gmail.com \
    --cc=mchitale@ventanamicro.com \
    --cc=oleksandr.suvorov@foundries.io \
    --cc=ovpanait@gmail.com \
    --cc=rogerq@kernel.org \
    --cc=santoshsagar.algapally@amd.com \
    --cc=sbabic@denx.de \
    --cc=sjg@chromium.org \
    --cc=u-boot@dh-electronics.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.com \
    /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