summaryrefslogtreecommitdiff
path: root/arch/arc/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arc/kernel')
-rw-r--r--arch/arc/kernel/devtree.c15
-rw-r--r--arch/arc/kernel/setup.c2
2 files changed, 17 insertions, 0 deletions
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
index a7d98b3..bdee3a8 100644
--- a/arch/arc/kernel/devtree.c
+++ b/arch/arc/kernel/devtree.c
@@ -106,3 +106,18 @@ struct machine_desc * __init setup_machine_fdt(void *dt)
return mdesc_best;
}
+
+/*
+ * Copy the flattened DT out of .init since unflattening doesn't copy strings
+ * and the normal DT APIs refs them from orig flat DT
+ */
+void __init copy_devtree(void)
+{
+ void *alloc = early_init_dt_alloc_memory_arch(
+ be32_to_cpu(initial_boot_params->totalsize), 64);
+ if (alloc) {
+ memcpy(alloc, initial_boot_params,
+ be32_to_cpu(initial_boot_params->totalsize));
+ initial_boot_params = alloc;
+ }
+}
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index e591c6a..dc0f968 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -354,6 +354,8 @@ void __init setup_arch(char **cmdline_p)
setup_arch_memory();
+ /* copy flat DT out of .init and then unflatten it */
+ copy_devtree();
unflatten_device_tree();
/* Can be issue if someone passes cmd line arg "ro"