ramips: Introduce CONFIG_MIPS_APPENDED_RAW_DTB to arch/mips/ralink
[openwrt/openwrt.git] / target / linux / ramips / patches-4.4 / 997-ralink-Introduce-fw_passed_dtb-to-arch-mips-ralink.patch
1 --- a/arch/mips/ralink/of.c
2 +++ b/arch/mips/ralink/of.c
3 @@ -81,13 +81,23 @@
4
5 void __init plat_mem_setup(void)
6 {
7 + void *dtb = NULL;
8 +
9 set_io_port_base(KSEG1);
10
11 /*
12 * Load the builtin devicetree. This causes the chosen node to be
13 - * parsed resulting in our memory appearing
14 + * parsed resulting in our memory appearing. fw_passed_dtb is used
15 + * by CONFIG_MIPS_APPENDED_RAW_DTB as well.
16 */
17 - __dt_setup_arch(&__image_dtb);
18 + if (fw_passed_dtb)
19 + dtb = (void *)fw_passed_dtb;
20 + else if (__dtb_start != __dtb_end)
21 + dtb = (void *)__dtb_start;
22 + else
23 + dtb = &__image_dtb;
24 +
25 + __dt_setup_arch(dtb);
26
27 of_scan_flat_dt(early_init_dt_find_chosen, NULL);
28 if (chosen_dtb)