aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/cavium-octeon/setup.c20
-rw-r--r--arch/mips/include/asm/mips-boards/generic.h4
-rw-r--r--arch/mips/include/asm/prom.h6
-rw-r--r--arch/mips/kernel/prom.c2
-rw-r--r--arch/mips/lantiq/prom.c15
-rw-r--r--arch/mips/lantiq/prom.h2
-rw-r--r--arch/mips/mti-sead3/sead3-setup.c8
-rw-r--r--arch/mips/netlogic/xlp/dt.c19
-rw-r--r--arch/mips/ralink/of.c29
9 files changed, 19 insertions, 86 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 331b837cec57..f1bec00d5a85 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -1053,36 +1053,26 @@ void prom_free_prom_memory(void)
1053int octeon_prune_device_tree(void); 1053int octeon_prune_device_tree(void);
1054 1054
1055extern const char __dtb_octeon_3xxx_begin; 1055extern const char __dtb_octeon_3xxx_begin;
1056extern const char __dtb_octeon_3xxx_end;
1057extern const char __dtb_octeon_68xx_begin; 1056extern const char __dtb_octeon_68xx_begin;
1058extern const char __dtb_octeon_68xx_end;
1059void __init device_tree_init(void) 1057void __init device_tree_init(void)
1060{ 1058{
1061 int dt_size; 1059 const void *fdt;
1062 struct boot_param_header *fdt;
1063 bool do_prune; 1060 bool do_prune;
1064 1061
1065 if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) { 1062 if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) {
1066 fdt = phys_to_virt(octeon_bootinfo->fdt_addr); 1063 fdt = phys_to_virt(octeon_bootinfo->fdt_addr);
1067 if (fdt_check_header(fdt)) 1064 if (fdt_check_header(fdt))
1068 panic("Corrupt Device Tree passed to kernel."); 1065 panic("Corrupt Device Tree passed to kernel.");
1069 dt_size = be32_to_cpu(fdt->totalsize);
1070 do_prune = false; 1066 do_prune = false;
1071 } else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) { 1067 } else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
1072 fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin; 1068 fdt = &__dtb_octeon_68xx_begin;
1073 dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin;
1074 do_prune = true; 1069 do_prune = true;
1075 } else { 1070 } else {
1076 fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin; 1071 fdt = &__dtb_octeon_3xxx_begin;
1077 dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin;
1078 do_prune = true; 1072 do_prune = true;
1079 } 1073 }
1080 1074
1081 /* Copy the default tree from init memory. */ 1075 initial_boot_params = (void *)fdt;
1082 initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8);
1083 if (initial_boot_params == NULL)
1084 panic("Could not allocate initial_boot_params");
1085 memcpy(initial_boot_params, fdt, dt_size);
1086 1076
1087 if (do_prune) { 1077 if (do_prune) {
1088 octeon_prune_device_tree(); 1078 octeon_prune_device_tree();
@@ -1090,7 +1080,7 @@ void __init device_tree_init(void)
1090 } else { 1080 } else {
1091 pr_info("Using passed Device Tree.\n"); 1081 pr_info("Using passed Device Tree.\n");
1092 } 1082 }
1093 unflatten_device_tree(); 1083 unflatten_and_copy_device_tree();
1094} 1084}
1095 1085
1096static int __initdata disable_octeon_edac_p; 1086static int __initdata disable_octeon_edac_p;
diff --git a/arch/mips/include/asm/mips-boards/generic.h b/arch/mips/include/asm/mips-boards/generic.h
index 48616816bcbc..c904c24550f6 100644
--- a/arch/mips/include/asm/mips-boards/generic.h
+++ b/arch/mips/include/asm/mips-boards/generic.h
@@ -67,10 +67,6 @@
67 67
68extern int mips_revision_sconid; 68extern int mips_revision_sconid;
69 69
70#ifdef CONFIG_OF
71extern struct boot_param_header __dtb_start;
72#endif
73
74#ifdef CONFIG_PCI 70#ifdef CONFIG_PCI
75extern void mips_pcibios_init(void); 71extern void mips_pcibios_init(void);
76#else 72#else
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
index ccd2b75f152c..a9494c0141fb 100644
--- a/arch/mips/include/asm/prom.h
+++ b/arch/mips/include/asm/prom.h
@@ -21,13 +21,13 @@ extern void device_tree_init(void);
21 21
22struct boot_param_header; 22struct boot_param_header;
23 23
24extern void __dt_setup_arch(struct boot_param_header *bph); 24extern void __dt_setup_arch(void *bph);
25 25
26#define dt_setup_arch(sym) \ 26#define dt_setup_arch(sym) \
27({ \ 27({ \
28 extern struct boot_param_header __dtb_##sym##_begin; \ 28 extern char __dtb_##sym##_begin[]; \
29 \ 29 \
30 __dt_setup_arch(&__dtb_##sym##_begin); \ 30 __dt_setup_arch(__dtb_##sym##_begin); \
31}) 31})
32 32
33#else /* CONFIG_OF */ 33#else /* CONFIG_OF */
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 3c3b0df8f48d..5d39bb85bf35 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -47,7 +47,7 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
47 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); 47 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
48} 48}
49 49
50void __init __dt_setup_arch(struct boot_param_header *bph) 50void __init __dt_setup_arch(void *bph)
51{ 51{
52 if (!early_init_dt_scan(bph)) 52 if (!early_init_dt_scan(bph))
53 return; 53 return;
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index 19686c5bc5ed..7447d322d14e 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -71,23 +71,12 @@ void __init plat_mem_setup(void)
71 * Load the builtin devicetree. This causes the chosen node to be 71 * Load the builtin devicetree. This causes the chosen node to be
72 * parsed resulting in our memory appearing 72 * parsed resulting in our memory appearing
73 */ 73 */
74 __dt_setup_arch(&__dtb_start); 74 __dt_setup_arch(__dtb_start);
75} 75}
76 76
77void __init device_tree_init(void) 77void __init device_tree_init(void)
78{ 78{
79 unsigned long base, size; 79 unflatten_and_copy_device_tree();
80
81 if (!initial_boot_params)
82 return;
83
84 base = virt_to_phys((void *)initial_boot_params);
85 size = be32_to_cpu(initial_boot_params->totalsize);
86
87 /* Before we do anything, lets reserve the dt blob */
88 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
89
90 unflatten_device_tree();
91} 80}
92 81
93void __init prom_init(void) 82void __init prom_init(void)
diff --git a/arch/mips/lantiq/prom.h b/arch/mips/lantiq/prom.h
index 8e07b5f28ef1..bfd2d58c1d69 100644
--- a/arch/mips/lantiq/prom.h
+++ b/arch/mips/lantiq/prom.h
@@ -26,6 +26,4 @@ struct ltq_soc_info {
26extern void ltq_soc_detect(struct ltq_soc_info *i); 26extern void ltq_soc_detect(struct ltq_soc_info *i);
27extern void ltq_soc_init(void); 27extern void ltq_soc_init(void);
28 28
29extern struct boot_param_header __dtb_start;
30
31#endif 29#endif
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
index bf7fe48bf2f9..e43f4801a245 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -69,17 +69,17 @@ static void __init parse_memsize_param(void)
69 if (!memsize) 69 if (!memsize)
70 return; 70 return;
71 71
72 offset = fdt_path_offset(&__dtb_start, "/memory"); 72 offset = fdt_path_offset(__dtb_start, "/memory");
73 if (offset > 0) { 73 if (offset > 0) {
74 uint64_t new_value; 74 uint64_t new_value;
75 /* 75 /*
76 * reg contains 2 32-bits BE values, offset and size. We just 76 * reg contains 2 32-bits BE values, offset and size. We just
77 * want to replace the size value without affecting the offset 77 * want to replace the size value without affecting the offset
78 */ 78 */
79 prop_value = fdt_getprop(&__dtb_start, offset, "reg", &prop_len); 79 prop_value = fdt_getprop(__dtb_start, offset, "reg", &prop_len);
80 new_value = be64_to_cpu(*prop_value); 80 new_value = be64_to_cpu(*prop_value);
81 new_value = (new_value & ~0xffffffffllu) | memsize; 81 new_value = (new_value & ~0xffffffffllu) | memsize;
82 fdt_setprop_inplace_u64(&__dtb_start, offset, "reg", new_value); 82 fdt_setprop_inplace_u64(__dtb_start, offset, "reg", new_value);
83 } 83 }
84} 84}
85 85
@@ -92,7 +92,7 @@ void __init plat_mem_setup(void)
92 * Load the builtin devicetree. This causes the chosen node to be 92 * Load the builtin devicetree. This causes the chosen node to be
93 * parsed resulting in our memory appearing 93 * parsed resulting in our memory appearing
94 */ 94 */
95 __dt_setup_arch(&__dtb_start); 95 __dt_setup_arch(__dtb_start);
96} 96}
97 97
98void __init device_tree_init(void) 98void __init device_tree_init(void)
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 5754097b9cde..bdde33147bce 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -42,7 +42,7 @@
42#include <asm/prom.h> 42#include <asm/prom.h>
43 43
44extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], 44extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
45 __dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[], __dtb_start[]; 45 __dtb_xlp_fvp_begin[], __dtb_xlp_gvp_begin[];
46static void *xlp_fdt_blob; 46static void *xlp_fdt_blob;
47 47
48void __init *xlp_dt_init(void *fdtp) 48void __init *xlp_dt_init(void *fdtp)
@@ -87,22 +87,7 @@ void __init xlp_early_init_devtree(void)
87 87
88void __init device_tree_init(void) 88void __init device_tree_init(void)
89{ 89{
90 unsigned long base, size; 90 unflatten_and_copy_device_tree();
91 struct boot_param_header *fdtp = xlp_fdt_blob;
92
93 if (!fdtp)
94 return;
95
96 base = virt_to_phys(fdtp);
97 size = be32_to_cpu(fdtp->totalsize);
98
99 /* Before we do anything, lets reserve the dt blob */
100 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
101
102 unflatten_device_tree();
103
104 /* free the space reserved for the dt blob */
105 free_bootmem(base, size);
106} 91}
107 92
108static struct of_device_id __initdata xlp_ids[] = { 93static struct of_device_id __initdata xlp_ids[] = {
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index eccc5526155e..251395210e23 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -28,8 +28,6 @@
28__iomem void *rt_sysc_membase; 28__iomem void *rt_sysc_membase;
29__iomem void *rt_memc_membase; 29__iomem void *rt_memc_membase;
30 30
31extern struct boot_param_header __dtb_start;
32
33__iomem void *plat_of_remap_node(const char *node) 31__iomem void *plat_of_remap_node(const char *node)
34{ 32{
35 struct resource res; 33 struct resource res;
@@ -52,30 +50,7 @@ __iomem void *plat_of_remap_node(const char *node)
52 50
53void __init device_tree_init(void) 51void __init device_tree_init(void)
54{ 52{
55 unsigned long base, size; 53 unflatten_and_copy_device_tree();
56 void *fdt_copy;
57
58 if (!initial_boot_params)
59 return;
60
61 base = virt_to_phys((void *)initial_boot_params);
62 size = be32_to_cpu(initial_boot_params->totalsize);
63
64 /* Before we do anything, lets reserve the dt blob */
65 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
66
67 /* The strings in the flattened tree are referenced directly by the
68 * device tree, so copy the flattened device tree from init memory
69 * to regular memory.
70 */
71 fdt_copy = alloc_bootmem(size);
72 memcpy(fdt_copy, initial_boot_params, size);
73 initial_boot_params = fdt_copy;
74
75 unflatten_device_tree();
76
77 /* free the space reserved for the dt blob */
78 free_bootmem(base, size);
79} 54}
80 55
81void __init plat_mem_setup(void) 56void __init plat_mem_setup(void)
@@ -86,7 +61,7 @@ void __init plat_mem_setup(void)
86 * Load the builtin devicetree. This causes the chosen node to be 61 * Load the builtin devicetree. This causes the chosen node to be
87 * parsed resulting in our memory appearing 62 * parsed resulting in our memory appearing
88 */ 63 */
89 __dt_setup_arch(&__dtb_start); 64 __dt_setup_arch(__dtb_start);
90 65
91 if (soc_info.mem_size) 66 if (soc_info.mem_size)
92 add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M, 67 add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,