aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/include/asm/netlogic/xlp-hal/xlp.h1
-rw-r--r--arch/mips/include/asm/prom.h14
-rw-r--r--arch/mips/kernel/prom.c60
-rw-r--r--arch/mips/lantiq/prom.c1
-rw-r--r--arch/mips/mti-sead3/sead3-setup.c2
-rw-r--r--arch/mips/netlogic/xlp/dt.c18
-rw-r--r--arch/mips/netlogic/xlp/setup.c2
-rw-r--r--arch/mips/ralink/of.c1
8 files changed, 22 insertions, 77 deletions
diff --git a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
index 17daffb280a3..470f2095b346 100644
--- a/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
+++ b/arch/mips/include/asm/netlogic/xlp-hal/xlp.h
@@ -69,6 +69,7 @@ void nlm_hal_init(void);
69int xlp_get_dram_map(int n, uint64_t *dram_map); 69int xlp_get_dram_map(int n, uint64_t *dram_map);
70 70
71/* Device tree related */ 71/* Device tree related */
72void xlp_early_init_devtree(void);
72void *xlp_dt_init(void *fdtp); 73void *xlp_dt_init(void *fdtp);
73 74
74static inline int cpu_is_xlpii(void) 75static inline int cpu_is_xlpii(void)
diff --git a/arch/mips/include/asm/prom.h b/arch/mips/include/asm/prom.h
index 1e7e0961064b..ccd2b75f152c 100644
--- a/arch/mips/include/asm/prom.h
+++ b/arch/mips/include/asm/prom.h
@@ -17,22 +17,8 @@
17#include <linux/types.h> 17#include <linux/types.h>
18#include <asm/bootinfo.h> 18#include <asm/bootinfo.h>
19 19
20extern int early_init_dt_scan_memory_arch(unsigned long node,
21 const char *uname, int depth, void *data);
22
23extern void device_tree_init(void); 20extern void device_tree_init(void);
24 21
25static inline unsigned long pci_address_to_pio(phys_addr_t address)
26{
27 /*
28 * The ioport address can be directly used by inX() / outX()
29 */
30 BUG_ON(address > IO_SPACE_LIMIT);
31
32 return (unsigned long) address;
33}
34#define pci_address_to_pio pci_address_to_pio
35
36struct boot_param_header; 22struct boot_param_header;
37 23
38extern void __dt_setup_arch(struct boot_param_header *bph); 24extern void __dt_setup_arch(struct boot_param_header *bph);
diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c
index 0fa0b69cdd53..3c3b0df8f48d 100644
--- a/arch/mips/kernel/prom.c
+++ b/arch/mips/kernel/prom.c
@@ -13,12 +13,9 @@
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/bootmem.h> 15#include <linux/bootmem.h>
16#include <linux/initrd.h>
17#include <linux/debugfs.h> 16#include <linux/debugfs.h>
18#include <linux/of.h> 17#include <linux/of.h>
19#include <linux/of_fdt.h> 18#include <linux/of_fdt.h>
20#include <linux/of_irq.h>
21#include <linux/of_platform.h>
22 19
23#include <asm/page.h> 20#include <asm/page.h>
24#include <asm/prom.h> 21#include <asm/prom.h>
@@ -40,13 +37,6 @@ char *mips_get_machine_name(void)
40} 37}
41 38
42#ifdef CONFIG_OF 39#ifdef CONFIG_OF
43int __init early_init_dt_scan_memory_arch(unsigned long node,
44 const char *uname, int depth,
45 void *data)
46{
47 return early_init_dt_scan_memory(node, uname, depth, data);
48}
49
50void __init early_init_dt_add_memory_arch(u64 base, u64 size) 40void __init early_init_dt_add_memory_arch(u64 base, u64 size)
51{ 41{
52 return add_memory_region(base, size, BOOT_MEM_RAM); 42 return add_memory_region(base, size, BOOT_MEM_RAM);
@@ -57,57 +47,11 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
57 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); 47 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
58} 48}
59 49
60#ifdef CONFIG_BLK_DEV_INITRD
61void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
62{
63 initrd_start = (unsigned long)__va(start);
64 initrd_end = (unsigned long)__va(end);
65 initrd_below_start_ok = 1;
66}
67#endif
68
69int __init early_init_dt_scan_model(unsigned long node, const char *uname,
70 int depth, void *data)
71{
72 if (!depth) {
73 char *model = of_get_flat_dt_prop(node, "model", NULL);
74
75 if (model)
76 mips_set_machine_name(model);
77 }
78 return 0;
79}
80
81void __init early_init_devtree(void *params)
82{
83 /* Setup flat device-tree pointer */
84 initial_boot_params = params;
85
86 /* Retrieve various informations from the /chosen node of the
87 * device-tree, including the platform type, initrd location and
88 * size, and more ...
89 */
90 of_scan_flat_dt(early_init_dt_scan_chosen, arcs_cmdline);
91
92
93 /* Scan memory nodes */
94 of_scan_flat_dt(early_init_dt_scan_root, NULL);
95 of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL);
96
97 /* try to load the mips machine name */
98 of_scan_flat_dt(early_init_dt_scan_model, NULL);
99}
100
101void __init __dt_setup_arch(struct boot_param_header *bph) 50void __init __dt_setup_arch(struct boot_param_header *bph)
102{ 51{
103 if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { 52 if (!early_init_dt_scan(bph))
104 pr_err("DTB has bad magic, ignoring builtin OF DTB\n");
105
106 return; 53 return;
107 }
108
109 initial_boot_params = bph;
110 54
111 early_init_devtree(initial_boot_params); 55 mips_set_machine_name(of_flat_dt_get_machine_name());
112} 56}
113#endif 57#endif
diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
index 49c460370285..19686c5bc5ed 100644
--- a/arch/mips/lantiq/prom.c
+++ b/arch/mips/lantiq/prom.c
@@ -14,6 +14,7 @@
14 14
15#include <asm/bootinfo.h> 15#include <asm/bootinfo.h>
16#include <asm/time.h> 16#include <asm/time.h>
17#include <asm/prom.h>
17 18
18#include <lantiq.h> 19#include <lantiq.h>
19 20
diff --git a/arch/mips/mti-sead3/sead3-setup.c b/arch/mips/mti-sead3/sead3-setup.c
index b5059dc899f4..928ba84c8a78 100644
--- a/arch/mips/mti-sead3/sead3-setup.c
+++ b/arch/mips/mti-sead3/sead3-setup.c
@@ -10,6 +10,8 @@
10#include <linux/of_fdt.h> 10#include <linux/of_fdt.h>
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12 12
13#include <asm/prom.h>
14
13#include <asm/mips-boards/generic.h> 15#include <asm/mips-boards/generic.h>
14 16
15const char *get_system_type(void) 17const char *get_system_type(void)
diff --git a/arch/mips/netlogic/xlp/dt.c b/arch/mips/netlogic/xlp/dt.c
index 88df445dda76..8316d5454b17 100644
--- a/arch/mips/netlogic/xlp/dt.c
+++ b/arch/mips/netlogic/xlp/dt.c
@@ -39,8 +39,11 @@
39#include <linux/of_platform.h> 39#include <linux/of_platform.h>
40#include <linux/of_device.h> 40#include <linux/of_device.h>
41 41
42#include <asm/prom.h>
43
42extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], 44extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[],
43 __dtb_xlp_fvp_begin[], __dtb_start[]; 45 __dtb_xlp_fvp_begin[], __dtb_start[];
46static void *xlp_fdt_blob;
44 47
45void __init *xlp_dt_init(void *fdtp) 48void __init *xlp_dt_init(void *fdtp)
46{ 49{
@@ -67,19 +70,26 @@ void __init *xlp_dt_init(void *fdtp)
67 break; 70 break;
68 } 71 }
69 } 72 }
70 initial_boot_params = fdtp; 73 xlp_fdt_blob = fdtp;
71 return fdtp; 74 return fdtp;
72} 75}
73 76
77void __init xlp_early_init_devtree(void)
78{
79 __dt_setup_arch(xlp_fdt_blob);
80 strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE);
81}
82
74void __init device_tree_init(void) 83void __init device_tree_init(void)
75{ 84{
76 unsigned long base, size; 85 unsigned long base, size;
86 struct boot_param_header *fdtp = xlp_fdt_blob;
77 87
78 if (!initial_boot_params) 88 if (!fdtp)
79 return; 89 return;
80 90
81 base = virt_to_phys((void *)initial_boot_params); 91 base = virt_to_phys(fdtp);
82 size = be32_to_cpu(initial_boot_params->totalsize); 92 size = be32_to_cpu(fdtp->totalsize);
83 93
84 /* Before we do anything, lets reserve the dt blob */ 94 /* Before we do anything, lets reserve the dt blob */
85 reserve_bootmem(base, size, BOOTMEM_DEFAULT); 95 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index 76a7131e486e..6d981bb337ec 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -98,7 +98,7 @@ void __init plat_mem_setup(void)
98 pm_power_off = nlm_linux_exit; 98 pm_power_off = nlm_linux_exit;
99 99
100 /* memory and bootargs from DT */ 100 /* memory and bootargs from DT */
101 early_init_devtree(initial_boot_params); 101 xlp_early_init_devtree();
102 102
103 if (boot_mem_map.nr_map == 0) { 103 if (boot_mem_map.nr_map == 0) {
104 pr_info("Using DRAM BARs for memory map.\n"); 104 pr_info("Using DRAM BARs for memory map.\n");
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index ce38d11f9da5..58c4fd52202e 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -21,6 +21,7 @@
21#include <asm/reboot.h> 21#include <asm/reboot.h>
22#include <asm/bootinfo.h> 22#include <asm/bootinfo.h>
23#include <asm/addrspace.h> 23#include <asm/addrspace.h>
24#include <asm/prom.h>
24 25
25#include "common.h" 26#include "common.h"
26 27