]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: fit: Add board level function to decide application of DTO
authorMarek Vasut <marex@denx.de>
Thu, 21 Sep 2023 18:44:16 +0000 (20:44 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 16 Oct 2023 14:25:10 +0000 (16:25 +0200)
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>
common/spl/spl_fit.c
include/spl.h

index ce6b8aa370a35c7ea4d5f26f75a8a7859b974020..1409b9263727aab65691d8cc536103637afbaee8 100644 (file)
@@ -372,6 +372,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)
@@ -414,11 +419,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;
index 7d30fb57dac957bc39ea6941b10bc8b25abb27d7..1d416b4c9296cb0354b6044ae21b01fdbb681dc0 100644 (file)
@@ -918,6 +918,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);