[PATCH 11/13] m68k: implement an embedded devicetree for mm targets

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

 



Add code to support using an embedded DTB for all m68k mm targets as well
as the nommu ones.

Signed-off-by: Greg Ungerer <gerg@xxxxxxxxxxxxxx>
---
 arch/m68k/kernel/setup_mm.c      | 33 ++++++++++++++++++++++++++++++++
 arch/m68k/kernel/vmlinux-std.lds | 10 ++++++++++
 2 files changed, 43 insertions(+)

diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index 15c1a595a1de..ef871a78eb78 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -27,6 +27,8 @@
 #include <linux/nvram.h>
 #include <linux/initrd.h>
 #include <linux/random.h>
+#include <linux/of.h>
+#include <linux/of_fdt.h>
 
 #include <asm/bootinfo.h>
 #include <asm/byteorder.h>
@@ -204,6 +206,32 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record)
 #endif
 }
 
+#ifdef CONFIG_EMBEDDED_DTB
+static void __init m68k_setup_fdt(void)
+{
+	extern void *embedded_dtb;
+	phys_addr_t fdt = (phys_addr_t) &embedded_dtb;
+
+	pr_info("m68k generic DT machine support, FDT blob at 0x%08x\n", fdt);
+	if (!early_init_dt_verify(__va(fdt), fdt)) {
+		pr_err("FDT blob is bad?!\n");
+		return;
+	}
+	early_init_dt_scan_nodes();
+	unflatten_device_tree();
+}
+
+static void __init m68k_dtb_model(void)
+{
+	const char *model;
+	model = of_flat_dt_get_machine_name();
+	if (model)
+		pr_info("DTB reports model \"%s\"\n", model);
+	else
+		pr_warn("DTB has no model type?\n");
+}
+#endif /* CONFIG_EMBEDDED_DTB */
+
 void __init setup_arch(char **cmdline_p)
 {
 	/* The bootinfo is located right after the kernel */
@@ -334,6 +362,11 @@ void __init setup_arch(char **cmdline_p)
 
 	paging_init();
 
+#ifdef CONFIG_EMBEDDED_DTB
+	m68k_setup_fdt();
+	m68k_dtb_model();
+#endif
+
 	if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && m68k_ramdisk.size) {
 		initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
 		initrd_end = initrd_start + m68k_ramdisk.size;
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index 1ccdd04ae462..45389a9a2356 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -43,6 +43,16 @@ SECTIONS
   __init_begin = .;
   INIT_TEXT_SECTION(PAGE_SIZE) :data
   INIT_DATA_SECTION(16)
+
+#ifdef CONFIG_EMBEDDED_DTB
+  STRUCT_ALIGN();
+  .embedded_dtb : {
+	embedded_dtb = .;
+	*(.embedded_dtb)
+	KEEP(*(.embedded_dtb))
+  }
+#endif
+
   .m68k_fixup : {
 	__start_fixup = .;
 	*(.m68k_fixup)
-- 
2.43.0





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

  Powered by Linux