select OF_EARLY_FLATTREE
select IRQ_DOMAIN
+config MIPS_APPENDED_DTB
+ bool "Use appended device tree blob to vmlinux.bin (EXPERIMENTAL)"
+ depends on OF && MIPS_RANCHU
+ help
+ With this option, the boot code will look for a device tree binary
+ DTB) appended to raw vmlinux.bin (without decompressor).
+ (e.g. cat vmlinux.bin <filename>.dtb > vmlinux_w_dtb).
+
+ Beware that there is very little in terms of protection against
+ this option being confused by leftover garbage in memory that might
+ look like a DTB header after a reboot if no actual DTB is appended
+ to vmlinux.bin. Do not leave this option active in a production kernel
+ if you don't intend to always append a DTB.
+
endmenu
config LOCKDEP_SUPPORT
obj-$(CONFIG_GOLDFISH) += switch.o
obj-$(CONFIG_GOLDFISH) += pm.o
-obj-$(CONFIG_MIPS_RANCHU) += ranchu.dtb.o
+ifneq ($(CONFIG_MIPS_APPENDED_DTB), y)
+obj-$(CONFIG_MIPS_RANCHU) += ranchu.dtb.o
$(obj)/%.dtb: $(obj)/%.dts
$(call if_changed,dtc)
+endif
void __init plat_mem_setup(void)
{
/*
- * Load the builtin devicetree. This causes the chosen node to be
+ * Load the builtin or appended devicetree.
+ * This causes the chosen node to be
* parsed resulting in our memory appearing
*/
+#ifdef CONFIG_MIPS_APPENDED_DTB
+ pr_info("Try setup using Appended DTB\n");
+ __dt_setup_arch(&__appended_dtb);
+#else
+ pr_info("Try setup using Built-in DTB\n");
__dt_setup_arch(&__dtb_start);
+#endif
}
void __init device_tree_init(void)
#ifdef CONFIG_OF
extern struct boot_param_header __dtb_start;
+#ifdef CONFIG_MIPS_APPENDED_DTB
+extern struct boot_param_header __appended_dtb;
+#endif
#endif
#ifdef CONFIG_PCI
mtc0 t0, CP0_STATUS
#endif /* CONFIG_MIPS_MT_SMTC */
+#ifdef CONFIG_MIPS_APPENDED_DTB
+ PTR_LA t0, __appended_dtb
+ PTR_LI t3, 0
+
+#ifdef CONFIG_CPU_BIG_ENDIAN
+ PTR_LI t1, 0xd00dfeed
+#else
+ PTR_LI t1, 0xedfe0dd0
+#endif
+ LONG_L t2, (t0)
+ bne t1, t2, not_found
+
+ PTR_LA t3, __appended_dtb
+
+not_found:
+#endif
+
PTR_LA t0, __bss_start # clear .bss
LONG_S zero, (t0)
PTR_LA t1, __bss_stop - LONGSIZE
LONG_S a2, fw_arg2
LONG_S a3, fw_arg3
+#ifdef CONFIG_MIPS_APPENDED_DTB
+ LONG_S t3, initial_boot_params
+#endif
+
MTC0 zero, CP0_CONTEXT # clear context register
PTR_LA $28, init_thread_union
/* Set the SP after an empty pt_regs. */
void __init __dt_setup_arch(struct boot_param_header *bph)
{
if (be32_to_cpu(bph->magic) != OF_DT_HEADER) {
+#ifdef CONFIG_MIPS_APPENDED_DTB
+ pr_err("DTB has bad magic, ignoring appended OF DTB\n");
+#else
pr_err("DTB has bad magic, ignoring builtin OF DTB\n");
+#endif
return;
}
_end = . ;
+#ifdef CONFIG_MIPS_APPENDED_DTB
+ __appended_dtb = .;
+ /* leave space for appended DTB */
+ . = . + 0x100000;
+#endif
+
/* These mark the ABI of the kernel for debuggers. */
.mdebug.abi32 : {
KEEP(*(.mdebug.abi32))