lantiq: use upstream mechanism to append device tree file
[openwrt/openwrt.git] / target / linux / lantiq / patches-4.4 / 0120-MIPS-lantiq-add-support-for-device-tree-file-from-bo.patch
1 From a32285ed4ba970b868b7fb49b716d776f4410ef6 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 19 Mar 2016 16:52:46 +0100
4 Subject: [PATCH] MIPS: lantiq: add support for device tree file from boot
5 loader
6
7 This fetches the device tree file like it is specified in the MIPS UHI
8 interface if one was found. This is also used when the device tree file
9 was appended to the kernel image with cat.
10 This code is copied from arch/mips/bmips/setup.c.
11
12 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
13 ---
14 arch/mips/lantiq/prom.c | 13 +++++++++++--
15 1 file changed, 11 insertions(+), 2 deletions(-)
16
17 --- a/arch/mips/lantiq/prom.c
18 +++ b/arch/mips/lantiq/prom.c
19 @@ -65,6 +65,8 @@ static void __init prom_init_cmdline(voi
20
21 void __init plat_mem_setup(void)
22 {
23 + void *dtb;
24 +
25 ioport_resource.start = IOPORT_RESOURCE_START;
26 ioport_resource.end = IOPORT_RESOURCE_END;
27 iomem_resource.start = IOMEM_RESOURCE_START;
28 @@ -72,11 +74,18 @@ void __init plat_mem_setup(void)
29
30 set_io_port_base((unsigned long) KSEG1);
31
32 + if (fw_arg0 == -2) /* UHI interface */
33 + dtb = (void *)fw_arg1;
34 + else if (__dtb_start != __dtb_end)
35 + dtb = (void *)__dtb_start;
36 + else
37 + panic("no dtb found");
38 +
39 /*
40 - * Load the builtin devicetree. This causes the chosen node to be
41 + * Load the devicetree. This causes the chosen node to be
42 * parsed resulting in our memory appearing
43 */
44 - __dt_setup_arch(__dtb_start);
45 + __dt_setup_arch(dtb);
46 }
47
48 void __init device_tree_init(void)