linux-metag.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/9] metag: Remove duplicate DT selection logic
       [not found]   ` <1384859554-27268-1-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
@ 2013-11-19 11:12     ` Geert Uytterhoeven
       [not found]       ` <1384859554-27268-4-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2013-11-19 11:12 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven,
	James Hogan, linux-metag-u79uwXL29TY76Z2rM5mHXA

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-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
Cc: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Cc: linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.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

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 4/9] metag: Remove duplicate DT selection logic
       [not found]       ` <1384859554-27268-4-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
@ 2013-11-19 13:14         ` James Hogan
  0 siblings, 0 replies; 2+ messages in thread
From: James Hogan @ 2013-11-19 13:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-metag-u79uwXL29TY76Z2rM5mHXA

On 19/11/13 11:12, Geert Uytterhoeven wrote:
> 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-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
> Cc: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
> Cc: linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Looks good and seems to work fine.
Acked-by: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>

Thanks
James

--
To unsubscribe from this list: send the line "unsubscribe linux-metag" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-11-19 13:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <5283A000.8090007@gmail.com>
     [not found] ` <1384859554-27268-1-git-send-email-geert@linux-m68k.org>
     [not found]   ` <1384859554-27268-1-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-11-19 11:12     ` [PATCH 4/9] metag: Remove duplicate DT selection logic Geert Uytterhoeven
     [not found]       ` <1384859554-27268-4-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
2013-11-19 13:14         ` James Hogan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).