diff mbox series

[v4,6/6] riscv: Move all fdt fixups together

Message ID 20200324041650.280302-7-atish.patra@wdc.com
State Accepted
Commit 177c53fe6c64d8656f5a647116a97047202c5455
Headers show
Series DT related fixes for RISC-V UEFI | expand

Commit Message

Atish Patra March 24, 2020, 4:16 a.m. UTC
Keep all the fdt fixups together for better code management.

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

Patch

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;
+}