Re: [RFC PATCH 0/3] m68k goes DT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Greg,

On Sun, 5 Jan 2025 at 23:59, Greg Ungerer <gerg@xxxxxxxxxx> wrote:
- We initially add passing of an FDT via bootinfo for mmu
- Add support for a generic machine that can boot almost anything so I can
   bring up my new (to Linux) machines.
- I will migrate MVME147 to device tree.
- Some like minded person migrates a machine they have to device tree. :)
- Maybe embed a FDT for machines that'll never get a bootloader that
   supports this and use the machine type to select the embedded FDT
   and move all of that stuff over without needing to mess with bootloaders.

To that end that is what I have been playing with. Doing it in a similar
way to what MIPS does. Example patch attached of what I did for non-MMU
ColdFire. So no boot loader support required.

Based on that I've attached what I think would work for normal 68k MMU.
Instead of manually embedding the DTB we embed all of them and if
there is no FDT in the bootinfo we use the builtin blob.
This allows booting without bootloader support and I can still pass a
custom FDT from u-boot to enable hardware connected to the VME
backplane.

Does this plan seem ok? If so I'll start the process of creating and
sending the dt bindings etc. I hate doing that stuff so I don't want
to do it if this is a no go. :)

Cheers,

Daniel
From d957da5c1a71ca91743f6b962a9adf0c7f093645 Mon Sep 17 00:00:00 2001
From: Daniel Palmer <daniel@xxxxxxxx>
Date: Mon, 6 Jan 2025 10:35:08 +0900
Subject: [PATCH] m68k: dt embedding

---
 arch/m68k/dts/Makefile           |  2 ++
 arch/m68k/dts/embedded_dtbs.S    | 12 ++++++++++++
 arch/m68k/kernel/setup_mm.c      | 11 +++++++++++
 arch/m68k/kernel/vmlinux-std.lds |  6 ++++++
 4 files changed, 31 insertions(+)
 create mode 100644 arch/m68k/dts/embedded_dtbs.S

diff --git a/arch/m68k/dts/Makefile b/arch/m68k/dts/Makefile
index ca4d64a73f49..e2cb53e6d2db 100644
--- a/arch/m68k/dts/Makefile
+++ b/arch/m68k/dts/Makefile
@@ -1,3 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-y += \
 	mvme147.dtb
+
+obj-y += embedded_dtbs.o
diff --git a/arch/m68k/dts/embedded_dtbs.S b/arch/m68k/dts/embedded_dtbs.S
new file mode 100644
index 000000000000..139851e77b39
--- /dev/null
+++ b/arch/m68k/dts/embedded_dtbs.S
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/linkage.h>
+#include <asm/page.h>
+
+        .section ".embedded_dtbs","aw"
+
+        .balign PAGE_SIZE
+
+SYM_DATA_START(mvme147_dtb)
+        .incbin "arch/m68k/dts/mvme147.dtb"
+SYM_DATA_END_LABEL(mvme147_dtb, SYM_L_GLOBAL, mvme147_dtb_end)
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 6d358124259e..a5feb561064d 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -293,6 +293,17 @@ void __init setup_arch(char **cmdline_p)
 		}
 	}
 
+	// TODO: This is wrong, the blob is in the init section so it needs to be copied
+	// but PoC
+	if (!fdt_blob)
+	{
+		extern void *mvme147_dtb;
+
+		pr_info("FDT blob was not provided, will use embedded one if available\n");
+		if (MACH_IS_MVME147)
+			fdt_blob = mvme147_dtb;
+	}
+
 	if (fdt_blob)
 		m68k_setup_fdt();
 
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 1ccdd04ae462..3e40b6cf36a4 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -43,6 +43,12 @@ SECTIONS
   __init_begin = .;
   INIT_TEXT_SECTION(PAGE_SIZE) :data
   INIT_DATA_SECTION(16)
+  STRUCT_ALIGN();
+  .embedded_dtbs : {
+	embedded_dtbs = .;
+	*(.embedded_dtbs)
+	KEEP(*(.embedded_dtbs))
+  }
   .m68k_fixup : {
 	__start_fixup = .;
 	*(.m68k_fixup)
-- 
2.45.2


[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux