lkml.org 
[lkml]   [2013]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 4/9] metag: Remove duplicate DT selection logic
Date
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@linux-m68k.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-metag@vger.kernel.org
---
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


\
 
 \ /
  Last update: 2013-11-19 13:21    [W:0.172 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site