All of lore.kernel.org
 help / color / mirror / Atom feed
From: Atish Patra <atish.patra@wdc.com>
To: u-boot@lists.denx.de
Subject: [PATCH v4 6/6] riscv: Move all fdt fixups together
Date: Mon, 23 Mar 2020 21:16:50 -0700	[thread overview]
Message-ID: <20200324041650.280302-7-atish.patra@wdc.com> (raw)
In-Reply-To: <20200324041650.280302-1-atish.patra@wdc.com>

Keep all the fdt fixups together for better code management.

Signed-off-by: Atish Patra <atish.patra@wdc.com>
---
 arch/riscv/lib/bootm.c     | 33 ---------------------------------
 arch/riscv/lib/fdt_fixup.c | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index 8ff8db6bf533..0d06095da11a 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -26,39 +26,6 @@ __weak void board_quiesce_devices(void)
 {
 }
 
-int arch_fixup_fdt(void *blob)
-{
-	int err;
-#ifdef CONFIG_EFI_LOADER
-	u32 size;
-	int chosen_offset;
-
-	size = fdt_totalsize(blob);
-	err  = fdt_open_into(blob, blob, size + 32);
-	if (err < 0) {
-		printf("Device Tree can't be expanded to accommodate new node");
-		return err;
-	}
-	chosen_offset = fdt_path_offset(blob, "/chosen");
-	if (chosen_offset < 0) {
-		err = fdt_add_subnode(blob, 0, "chosen");
-		if (err < 0) {
-			printf("chosen node can not be added\n");
-			return err;
-		}
-	}
-	/* Overwrite the boot-hartid as U-Boot is the last stage BL */
-	fdt_setprop_u32(blob, chosen_offset, "boot-hartid", gd->arch.boot_hart);
-#endif
-
-	/* Copy the reserved-memory node to the DT used by OS */
-	err = riscv_fdt_copy_resv_mem_node(gd->fdt_blob, blob);
-	if (err < 0)
-		return err;
-
-	return 0;
-}
-
 /**
  * announce_and_cleanup() - Print message and prepare for kernel boot
  *
diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
index e41f06f5b7f1..df340d1e9fda 100644
--- a/arch/riscv/lib/fdt_fixup.c
+++ b/arch/riscv/lib/fdt_fixup.c
@@ -93,3 +93,36 @@ int riscv_board_reserved_mem_fixup(void *fdt)
 
 	return 0;
 }
+
+int arch_fixup_fdt(void *blob)
+{
+	int err;
+#ifdef CONFIG_EFI_LOADER
+	u32 size;
+	int chosen_offset;
+
+	size = fdt_totalsize(blob);
+	err  = fdt_open_into(blob, blob, size + 32);
+	if (err < 0) {
+		printf("Device Tree can't be expanded to accommodate new node");
+		return err;
+	}
+	chosen_offset = fdt_path_offset(blob, "/chosen");
+	if (chosen_offset < 0) {
+		err = fdt_add_subnode(blob, 0, "chosen");
+		if (err < 0) {
+			printf("chosen node can not be added\n");
+			return err;
+		}
+	}
+	/* Overwrite the boot-hartid as U-Boot is the last stage BL */
+	fdt_setprop_u32(blob, chosen_offset, "boot-hartid", gd->arch.boot_hart);
+#endif
+
+	/* Copy the reserved-memory node to the DT used by OS */
+	err = riscv_fdt_copy_resv_mem_node(gd->fdt_blob, blob);
+	if (err < 0)
+		return err;
+
+	return 0;
+}
-- 
2.25.1

      parent reply	other threads:[~2020-03-24  4:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24  4:16 [PATCH v4 0/6] DT related fixes for RISC-V UEFI Atish Patra
2020-03-24  4:16 ` [PATCH v4 1/6] riscv: Add boot hartid to Device tree Atish Patra
2020-03-24  4:16 ` [PATCH v4 2/6] fdtdec: Fix boundary check Atish Patra
2020-03-24  4:16 ` [PATCH v4 3/6] riscv: Provide a mechanism to fix DT for reserved memory Atish Patra
2020-03-24  6:13   ` Heinrich Schuchardt
2020-03-24  7:15     ` Atish Patra
2020-03-24  4:16 ` [PATCH v4 4/6] riscv: Setup reserved-memory node for FU540 Atish Patra
2020-03-24  4:16 ` [PATCH v4 5/6] riscv: Copy the reserved-memory nodes to final DT Atish Patra
2020-03-24  6:23   ` Heinrich Schuchardt
2020-03-24  7:15     ` Atish Patra
2020-03-24 22:11       ` Heinrich Schuchardt
2020-03-25  3:38         ` Atish Patra
2020-03-24  4:16 ` Atish Patra [this message]

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=20200324041650.280302-7-atish.patra@wdc.com \
    --to=atish.patra@wdc.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.