91ac3b22c47f8a8a14dd808db41c1c78b7490079
[openwrt/openwrt.git] / target / linux / ramips / patches-4.14 / 0100-prom_fixes.patch
1 From 67b7bff0fd364c194e653f69baa623ba2141bd4c Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Mon, 4 Aug 2014 18:46:02 +0200
4 Subject: [PATCH 07/53] MIPS: ralink: copy the commandline from the devicetree
5
6 Signed-off-by: John Crispin <blogic@openwrt.org>
7 ---
8 arch/mips/ralink/of.c | 2 ++
9 1 file changed, 2 insertions(+)
10
11 --- a/arch/mips/ralink/of.c
12 +++ b/arch/mips/ralink/of.c
13 @@ -3,7 +3,7 @@
14 * under the terms of the GNU General Public License version 2 as published
15 * by the Free Software Foundation.
16 *
17 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
18 + * Copyright (C) 2008-2014 Imre Kaloz <kaloz@openwrt.org>
19 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
20 * Copyright (C) 2013 John Crispin <john@phrozen.org>
21 */
22 @@ -66,6 +66,19 @@ static int __init early_init_dt_find_mem
23 return 0;
24 }
25
26 +static int chosen_dtb;
27 +
28 +static int __init early_init_dt_find_chosen(unsigned long node, const char *uname,
29 + int depth, void *data)
30 +{
31 + if (depth == 1 && !strcmp(uname, "chosen"))
32 + chosen_dtb = 1;
33 +
34 + return 0;
35 +}
36 +
37 +extern struct boot_param_header __image_dtb;
38 +
39 void __init plat_mem_setup(void)
40 {
41 void *dtb = NULL;
42 @@ -82,7 +95,11 @@ void __init plat_mem_setup(void)
43 else if (__dtb_start != __dtb_end)
44 dtb = (void *)__dtb_start;
45
46 - __dt_setup_arch(dtb);
47 + __dt_setup_arch(&__image_dtb);
48 +
49 + of_scan_flat_dt(early_init_dt_find_chosen, NULL);
50 + if (chosen_dtb)
51 + strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
52
53 strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
54
55 --- a/arch/mips/kernel/head.S
56 +++ b/arch/mips/kernel/head.S
57 @@ -85,6 +85,9 @@ EXPORT(__image_cmdline)
58 .fill 0x400
59 #endif /* CONFIG_IMAGE_CMDLINE_HACK */
60
61 + .ascii "OWRTDTB:"
62 + EXPORT(__image_dtb)
63 + .fill 0x4000
64 __REF
65
66 NESTED(kernel_entry, 16, sp) # kernel entry point