early_init_dt_scan() now takes care of falling back to the built-in DTB. Note that we now have to check ourselves whether original_cmd_line is a DTB or a command line, to keep command line append working. Signed-off-by: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> Cc: James Hogan <james.hogan@xxxxxxxxxx> Cc: linux-metag@xxxxxxxxxxxxxxx --- Untested due to lack of cross-compiler. arch/metag/kernel/setup.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c index 919c782f5479..e3ebfc5f5d77 100644 --- a/arch/metag/kernel/setup.c +++ b/arch/metag/kernel/setup.c @@ -221,6 +221,7 @@ static struct notifier_block metag_panic_block = { void __init setup_arch(char **cmdline_p) { + void *dt = NULL; unsigned long start_pfn; unsigned long text_start = (unsigned long)(&_stext); unsigned long cpu = smp_processor_id(); @@ -242,26 +243,27 @@ void __init setup_arch(char **cmdline_p) #endif /* try interpreting the argument as a device tree */ - machine_desc = setup_machine_fdt(original_cmd_line); - /* if it doesn't look like a device tree it must be a command line */ + if (original_cmd_line && + be32_to_cpup((__be32 *)original_cmd_line) == OF_DT_HEADER) { + dt = original_cmd_line; + original_cmd_line = NULL; + } + + machine_desc = setup_machine_fdt(dt); if (!machine_desc) { -#ifdef CONFIG_METAG_BUILTIN_DTB - /* try the embedded device tree */ - machine_desc = setup_machine_fdt(&__dtb_start); - if (!machine_desc) - panic("Invalid embedded device tree."); -#else /* use the default machine description */ machine_desc = default_machine_desc(); -#endif + } + #ifndef CONFIG_CMDLINE_FORCE + if (original_cmd_line) { /* append the bootloader cmdline to any builtin fdt cmdline */ if (boot_command_line[0] && original_cmd_line[0]) strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); strlcat(boot_command_line, original_cmd_line, COMMAND_LINE_SIZE); -#endif } +#endif setup_meta_clocks(machine_desc->clocks); *cmdline_p = boot_command_line; -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html