aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arc/include/asm/mach_desc.h17
-rw-r--r--arch/arc/include/asm/prom.h14
-rw-r--r--arch/arc/kernel/devtree.c97
-rw-r--r--arch/arc/kernel/setup.c6
-rw-r--r--arch/arc/mm/init.c7
-rw-r--r--arch/arm/boot/dts/testcases/tests-interrupts.dtsi58
-rw-r--r--arch/arm/boot/dts/testcases/tests.dtsi1
-rw-r--r--arch/arm/boot/dts/versatile-ab.dts2
-rw-r--r--arch/arm/boot/dts/versatile-pb.dts2
-rw-r--r--arch/arm/include/asm/prom.h2
-rw-r--r--arch/arm/kernel/devtree.c57
-rw-r--r--arch/arm/mach-integrator/pci_v3.c18
-rw-r--r--arch/arm/mach-keystone/platsmp.c1
-rw-r--r--arch/arm/mach-u300/timer.c9
-rw-r--r--arch/arm/mm/init.c13
-rw-r--r--arch/arm64/include/asm/prom.h1
-rw-r--r--arch/arm64/kernel/setup.c60
-rw-r--r--arch/arm64/mm/init.c25
-rw-r--r--arch/c6x/include/asm/prom.h1
-rw-r--r--arch/c6x/include/asm/setup.h2
-rw-r--r--arch/c6x/kernel/devicetree.c29
-rw-r--r--arch/c6x/kernel/setup.c13
-rw-r--r--arch/c6x/kernel/vmlinux.lds.S6
-rw-r--r--arch/hexagon/kernel/setup.c3
-rw-r--r--arch/metag/include/asm/mach/arch.h2
-rw-r--r--arch/metag/include/asm/prom.h23
-rw-r--r--arch/metag/include/asm/setup.h1
-rw-r--r--arch/metag/kernel/devtree.c83
-rw-r--r--arch/metag/kernel/setup.c7
-rw-r--r--arch/metag/mm/init.c9
-rw-r--r--arch/microblaze/include/asm/pci.h2
-rw-r--r--arch/microblaze/include/asm/prom.h39
-rw-r--r--arch/microblaze/kernel/prom.c32
-rw-r--r--arch/microblaze/kernel/setup.c3
-rw-r--r--arch/microblaze/kernel/timer.c1
-rw-r--r--arch/microblaze/pci/pci-common.c73
-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/pci/fixup-lantiq.c13
-rw-r--r--arch/mips/pci/pci-rt3883.c24
-rw-r--r--arch/mips/ralink/of.c1
-rw-r--r--arch/openrisc/include/asm/prom.h22
-rw-r--r--arch/openrisc/kernel/prom.c70
-rw-r--r--arch/openrisc/kernel/setup.c6
-rw-r--r--arch/powerpc/include/asm/prom.h33
-rw-r--r--arch/powerpc/kernel/epapr_paravirt.c1
-rw-r--r--arch/powerpc/kernel/pci-common.c11
-rw-r--r--arch/powerpc/kernel/prom.c9
-rw-r--r--arch/powerpc/platforms/512x/clock.c1
-rw-r--r--arch/powerpc/platforms/512x/pdm360ng.c2
-rw-r--r--arch/powerpc/platforms/82xx/mpc8272_ads.c2
-rw-r--r--arch/powerpc/platforms/82xx/pq2fads.c2
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c2
-rw-r--r--arch/powerpc/platforms/85xx/c293pcie.c1
-rw-r--r--arch/powerpc/platforms/85xx/common.c2
-rw-r--r--arch/powerpc/platforms/85xx/ppa8548.c1
-rw-r--r--arch/powerpc/platforms/85xx/sgy_cts1000.c1
-rw-r--r--arch/powerpc/platforms/85xx/smp.c1
-rw-r--r--arch/powerpc/platforms/85xx/socrates_fpga_pic.c2
-rw-r--r--arch/powerpc/platforms/86xx/pic.c1
-rw-r--r--arch/powerpc/platforms/8xx/ep88xc.c2
-rw-r--r--arch/powerpc/platforms/8xx/mpc86xads_setup.c2
-rw-r--r--arch/powerpc/platforms/8xx/mpc885ads_setup.c2
-rw-r--r--arch/powerpc/platforms/8xx/tqm8xx_setup.c1
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_pciex.c6
-rw-r--r--arch/powerpc/platforms/cell/celleb_scc_sio.c7
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c7
-rw-r--r--arch/powerpc/platforms/cell/spu_manage.c13
-rw-r--r--arch/powerpc/platforms/embedded6xx/flipper-pic.c1
-rw-r--r--arch/powerpc/platforms/embedded6xx/hlwd-pic.c2
-rw-r--r--arch/powerpc/platforms/fsl_uli1575.c12
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c1
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_base.c1
-rw-r--r--arch/powerpc/platforms/powermac/pic.c10
-rw-r--r--arch/powerpc/platforms/powernv/opal-lpc.c1
-rw-r--r--arch/powerpc/platforms/powernv/opal.c1
-rw-r--r--arch/powerpc/platforms/powernv/setup.c1
-rw-r--r--arch/powerpc/platforms/pseries/event_sources.c8
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c2
-rw-r--r--arch/powerpc/sysdev/cpm_common.c1
-rw-r--r--arch/powerpc/sysdev/ehv_pic.c1
-rw-r--r--arch/powerpc/sysdev/fsl_gtm.c11
-rw-r--r--arch/powerpc/sysdev/fsl_pmc.c1
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c2
-rw-r--r--arch/powerpc/sysdev/fsl_rmu.c1
-rw-r--r--arch/powerpc/sysdev/mpic.c8
-rw-r--r--arch/powerpc/sysdev/mpic_msgr.c6
-rw-r--r--arch/powerpc/sysdev/mpic_msi.c8
-rw-r--r--arch/powerpc/sysdev/mpic_timer.c2
-rw-r--r--arch/powerpc/sysdev/of_rtc.c1
-rw-r--r--arch/powerpc/sysdev/ppc4xx_ocm.c1
-rw-r--r--arch/powerpc/sysdev/ppc4xx_soc.c1
-rw-r--r--arch/powerpc/sysdev/xilinx_intc.c2
-rw-r--r--arch/sparc/include/asm/prom.h12
-rw-r--r--arch/sparc/kernel/prom_64.c53
-rw-r--r--arch/x86/include/asm/prom.h5
-rw-r--r--arch/x86/kernel/devicetree.c51
-rw-r--r--arch/xtensa/include/asm/prom.h6
-rw-r--r--arch/xtensa/kernel/setup.c55
104 files changed, 369 insertions, 964 deletions
diff --git a/arch/arc/include/asm/mach_desc.h b/arch/arc/include/asm/mach_desc.h
index 9998dc846ebb..e8993a2be6c2 100644
--- a/arch/arc/include/asm/mach_desc.h
+++ b/arch/arc/include/asm/mach_desc.h
@@ -51,22 +51,12 @@ struct machine_desc {
51/* 51/*
52 * Current machine - only accessible during boot. 52 * Current machine - only accessible during boot.
53 */ 53 */
54extern struct machine_desc *machine_desc; 54extern const struct machine_desc *machine_desc;
55 55
56/* 56/*
57 * Machine type table - also only accessible during boot 57 * Machine type table - also only accessible during boot
58 */ 58 */
59extern struct machine_desc __arch_info_begin[], __arch_info_end[]; 59extern const struct machine_desc __arch_info_begin[], __arch_info_end[];
60#define for_each_machine_desc(p) \
61 for (p = __arch_info_begin; p < __arch_info_end; p++)
62
63static inline struct machine_desc *default_machine_desc(void)
64{
65 /* the default machine is the last one linked in */
66 if (__arch_info_end - 1 < __arch_info_begin)
67 return NULL;
68 return __arch_info_end - 1;
69}
70 60
71/* 61/*
72 * Set of macros to define architecture features. 62 * Set of macros to define architecture features.
@@ -81,7 +71,6 @@ __attribute__((__section__(".arch.info.init"))) = { \
81#define MACHINE_END \ 71#define MACHINE_END \
82}; 72};
83 73
84extern struct machine_desc *setup_machine_fdt(void *dt); 74extern const struct machine_desc *setup_machine_fdt(void *dt);
85extern void __init copy_devtree(void);
86 75
87#endif 76#endif
diff --git a/arch/arc/include/asm/prom.h b/arch/arc/include/asm/prom.h
deleted file mode 100644
index 692d0d0789a7..000000000000
--- a/arch/arc/include/asm/prom.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright (C) 2012 Synopsys, Inc. (www.synopsys.com)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _ASM_ARC_PROM_H_
10#define _ASM_ARC_PROM_H_
11
12#define HAVE_ARCH_DEVTREE_FIXUPS
13
14#endif
diff --git a/arch/arc/kernel/devtree.c b/arch/arc/kernel/devtree.c
index 2340af0e1d6f..b6dc4e21fd32 100644
--- a/arch/arc/kernel/devtree.c
+++ b/arch/arc/kernel/devtree.c
@@ -14,10 +14,22 @@
14#include <linux/memblock.h> 14#include <linux/memblock.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_fdt.h> 16#include <linux/of_fdt.h>
17#include <asm/prom.h>
18#include <asm/clk.h> 17#include <asm/clk.h>
19#include <asm/mach_desc.h> 18#include <asm/mach_desc.h>
20 19
20static const void * __init arch_get_next_mach(const char *const **match)
21{
22 static const struct machine_desc *mdesc = __arch_info_begin;
23 const struct machine_desc *m = mdesc;
24
25 if (m >= __arch_info_end)
26 return NULL;
27
28 mdesc++;
29 *match = m->dt_compat;
30 return m;
31}
32
21/** 33/**
22 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 34 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
23 * @dt: virtual address pointer to dt blob 35 * @dt: virtual address pointer to dt blob
@@ -25,93 +37,24 @@
25 * If a dtb was passed to the kernel, then use it to choose the correct 37 * If a dtb was passed to the kernel, then use it to choose the correct
26 * machine_desc and to setup the system. 38 * machine_desc and to setup the system.
27 */ 39 */
28struct machine_desc * __init setup_machine_fdt(void *dt) 40const struct machine_desc * __init setup_machine_fdt(void *dt)
29{ 41{
30 struct boot_param_header *devtree = dt; 42 const struct machine_desc *mdesc;
31 struct machine_desc *mdesc = NULL, *mdesc_best = NULL;
32 unsigned int score, mdesc_score = ~1;
33 unsigned long dt_root; 43 unsigned long dt_root;
34 const char *model, *compat;
35 void *clk; 44 void *clk;
36 char manufacturer[16];
37 unsigned long len; 45 unsigned long len;
38 46
39 /* check device tree validity */ 47 if (!early_init_dt_scan(dt))
40 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER)
41 return NULL; 48 return NULL;
42 49
43 initial_boot_params = devtree; 50 mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
44 dt_root = of_get_flat_dt_root(); 51 if (!mdesc)
45
46 /*
47 * The kernel could be multi-platform enabled, thus could have many
48 * "baked-in" machine descriptors. Search thru all for the best
49 * "compatible" string match.
50 */
51 for_each_machine_desc(mdesc) {
52 score = of_flat_dt_match(dt_root, mdesc->dt_compat);
53 if (score > 0 && score < mdesc_score) {
54 mdesc_best = mdesc;
55 mdesc_score = score;
56 }
57 }
58 if (!mdesc_best) {
59 const char *prop;
60 long size;
61
62 pr_err("\n unrecognized device tree list:\n[ ");
63
64 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
65 if (prop) {
66 while (size > 0) {
67 printk("'%s' ", prop);
68 size -= strlen(prop) + 1;
69 prop += strlen(prop) + 1;
70 }
71 }
72 printk("]\n\n");
73
74 machine_halt(); 52 machine_halt();
75 }
76
77 /* compat = "<manufacturer>,<model>" */
78 compat = mdesc_best->dt_compat[0];
79
80 model = strchr(compat, ',');
81 if (model)
82 model++;
83
84 strlcpy(manufacturer, compat, model ? model - compat : strlen(compat));
85
86 pr_info("Board \"%s\" from %s (Manufacturer)\n", model, manufacturer);
87
88 /* Retrieve various information from the /chosen node */
89 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
90
91 /* Initialize {size,address}-cells info */
92 of_scan_flat_dt(early_init_dt_scan_root, NULL);
93
94 /* Setup memory, calling early_init_dt_add_memory_arch */
95 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
96 53
54 dt_root = of_get_flat_dt_root();
97 clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len); 55 clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len);
98 if (clk) 56 if (clk)
99 arc_set_core_freq(of_read_ulong(clk, len/4)); 57 arc_set_core_freq(of_read_ulong(clk, len/4));
100 58
101 return mdesc_best; 59 return mdesc;
102}
103
104/*
105 * Copy the flattened DT out of .init since unflattening doesn't copy strings
106 * and the normal DT APIs refs them from orig flat DT
107 */
108void __init copy_devtree(void)
109{
110 void *alloc = early_init_dt_alloc_memory_arch(
111 be32_to_cpu(initial_boot_params->totalsize), 64);
112 if (alloc) {
113 memcpy(alloc, initial_boot_params,
114 be32_to_cpu(initial_boot_params->totalsize));
115 initial_boot_params = alloc;
116 }
117} 60}
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index d9e15f16633e..643eae4436e0 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -21,7 +21,6 @@
21#include <asm/setup.h> 21#include <asm/setup.h>
22#include <asm/page.h> 22#include <asm/page.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/prom.h>
25#include <asm/unwind.h> 24#include <asm/unwind.h>
26#include <asm/clk.h> 25#include <asm/clk.h>
27#include <asm/mach_desc.h> 26#include <asm/mach_desc.h>
@@ -31,7 +30,7 @@
31int running_on_hw = 1; /* vs. on ISS */ 30int running_on_hw = 1; /* vs. on ISS */
32 31
33char __initdata command_line[COMMAND_LINE_SIZE]; 32char __initdata command_line[COMMAND_LINE_SIZE];
34struct machine_desc *machine_desc; 33const struct machine_desc *machine_desc;
35 34
36struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ 35struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
37 36
@@ -345,8 +344,7 @@ void __init setup_arch(char **cmdline_p)
345 setup_arch_memory(); 344 setup_arch_memory();
346 345
347 /* copy flat DT out of .init and then unflatten it */ 346 /* copy flat DT out of .init and then unflatten it */
348 copy_devtree(); 347 unflatten_and_copy_device_tree();
349 unflatten_device_tree();
350 348
351 /* Can be issue if someone passes cmd line arg "ro" 349 /* Can be issue if someone passes cmd line arg "ro"
352 * But that is unlikely so keeping it as it is 350 * But that is unlikely so keeping it as it is
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 81279ec73a6a..55e0a85bea78 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -125,10 +125,3 @@ void __init free_initrd_mem(unsigned long start, unsigned long end)
125 free_reserved_area((void *)start, (void *)end, -1, "initrd"); 125 free_reserved_area((void *)start, (void *)end, -1, "initrd");
126} 126}
127#endif 127#endif
128
129#ifdef CONFIG_OF_FLATTREE
130void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
131{
132 pr_err("%s(%llx, %llx)\n", __func__, start, end);
133}
134#endif /* CONFIG_OF_FLATTREE */
diff --git a/arch/arm/boot/dts/testcases/tests-interrupts.dtsi b/arch/arm/boot/dts/testcases/tests-interrupts.dtsi
new file mode 100644
index 000000000000..c843720bd3e5
--- /dev/null
+++ b/arch/arm/boot/dts/testcases/tests-interrupts.dtsi
@@ -0,0 +1,58 @@
1
2/ {
3 testcase-data {
4 interrupts {
5 #address-cells = <1>;
6 #size-cells = <1>;
7 test_intc0: intc0 {
8 interrupt-controller;
9 #interrupt-cells = <1>;
10 };
11
12 test_intc1: intc1 {
13 interrupt-controller;
14 #interrupt-cells = <3>;
15 };
16
17 test_intc2: intc2 {
18 interrupt-controller;
19 #interrupt-cells = <2>;
20 };
21
22 test_intmap0: intmap0 {
23 #interrupt-cells = <1>;
24 #address-cells = <0>;
25 interrupt-map = <1 &test_intc0 9>,
26 <2 &test_intc1 10 11 12>,
27 <3 &test_intc2 13 14>,
28 <4 &test_intc2 15 16>;
29 };
30
31 test_intmap1: intmap1 {
32 #interrupt-cells = <2>;
33 interrupt-map = <0x5000 1 2 &test_intc0 15>;
34 };
35
36 interrupts0 {
37 interrupt-parent = <&test_intc0>;
38 interrupts = <1>, <2>, <3>, <4>;
39 };
40
41 interrupts1 {
42 interrupt-parent = <&test_intmap0>;
43 interrupts = <1>, <2>, <3>, <4>;
44 };
45
46 interrupts-extended0 {
47 reg = <0x5000 0x100>;
48 interrupts-extended = <&test_intc0 1>,
49 <&test_intc1 2 3 4>,
50 <&test_intc2 5 6>,
51 <&test_intmap0 1>,
52 <&test_intmap0 2>,
53 <&test_intmap0 3>,
54 <&test_intmap1 1 2>;
55 };
56 };
57 };
58};
diff --git a/arch/arm/boot/dts/testcases/tests.dtsi b/arch/arm/boot/dts/testcases/tests.dtsi
index a7c5067622e8..3f123ecc9dd7 100644
--- a/arch/arm/boot/dts/testcases/tests.dtsi
+++ b/arch/arm/boot/dts/testcases/tests.dtsi
@@ -1 +1,2 @@
1/include/ "tests-phandle.dtsi" 1/include/ "tests-phandle.dtsi"
2/include/ "tests-interrupts.dtsi"
diff --git a/arch/arm/boot/dts/versatile-ab.dts b/arch/arm/boot/dts/versatile-ab.dts
index dde75ae8b4b1..e01e5a081def 100644
--- a/arch/arm/boot/dts/versatile-ab.dts
+++ b/arch/arm/boot/dts/versatile-ab.dts
@@ -185,7 +185,7 @@
185 mmc@5000 { 185 mmc@5000 {
186 compatible = "arm,primecell"; 186 compatible = "arm,primecell";
187 reg = < 0x5000 0x1000>; 187 reg = < 0x5000 0x1000>;
188 interrupts = <22 34>; 188 interrupts-extended = <&vic 22 &sic 2>;
189 }; 189 };
190 kmi@6000 { 190 kmi@6000 {
191 compatible = "arm,pl050", "arm,primecell"; 191 compatible = "arm,pl050", "arm,primecell";
diff --git a/arch/arm/boot/dts/versatile-pb.dts b/arch/arm/boot/dts/versatile-pb.dts
index 7e8175269064..f43907c40c93 100644
--- a/arch/arm/boot/dts/versatile-pb.dts
+++ b/arch/arm/boot/dts/versatile-pb.dts
@@ -41,7 +41,7 @@
41 mmc@b000 { 41 mmc@b000 {
42 compatible = "arm,primecell"; 42 compatible = "arm,primecell";
43 reg = <0xb000 0x1000>; 43 reg = <0xb000 0x1000>;
44 interrupts = <23 34>; 44 interrupts-extended = <&vic 23 &sic 2>;
45 }; 45 };
46 }; 46 };
47 }; 47 };
diff --git a/arch/arm/include/asm/prom.h b/arch/arm/include/asm/prom.h
index 4a2985e21969..b681575ad3de 100644
--- a/arch/arm/include/asm/prom.h
+++ b/arch/arm/include/asm/prom.h
@@ -11,8 +11,6 @@
11#ifndef __ASMARM_PROM_H 11#ifndef __ASMARM_PROM_H
12#define __ASMARM_PROM_H 12#define __ASMARM_PROM_H
13 13
14#define HAVE_ARCH_DEVTREE_FIXUPS
15
16#ifdef CONFIG_OF 14#ifdef CONFIG_OF
17 15
18extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys); 16extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index f35906b3d8c9..739c3dfc1da2 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -174,6 +174,19 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
174 return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu); 174 return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu);
175} 175}
176 176
177static const void * __init arch_get_next_mach(const char *const **match)
178{
179 static const struct machine_desc *mdesc = __arch_info_begin;
180 const struct machine_desc *m = mdesc;
181
182 if (m >= __arch_info_end)
183 return NULL;
184
185 mdesc++;
186 *match = m->dt_compat;
187 return m;
188}
189
177/** 190/**
178 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 191 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
179 * @dt_phys: physical address of dt blob 192 * @dt_phys: physical address of dt blob
@@ -183,11 +196,7 @@ bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
183 */ 196 */
184const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) 197const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
185{ 198{
186 struct boot_param_header *devtree;
187 const struct machine_desc *mdesc, *mdesc_best = NULL; 199 const struct machine_desc *mdesc, *mdesc_best = NULL;
188 unsigned int score, mdesc_score = ~1;
189 unsigned long dt_root;
190 const char *model;
191 200
192#ifdef CONFIG_ARCH_MULTIPLATFORM 201#ifdef CONFIG_ARCH_MULTIPLATFORM
193 DT_MACHINE_START(GENERIC_DT, "Generic DT based system") 202 DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
@@ -196,32 +205,20 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
196 mdesc_best = &__mach_desc_GENERIC_DT; 205 mdesc_best = &__mach_desc_GENERIC_DT;
197#endif 206#endif
198 207
199 if (!dt_phys) 208 if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys)))
200 return NULL; 209 return NULL;
201 210
202 devtree = phys_to_virt(dt_phys); 211 mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach);
203 212
204 /* check device tree validity */ 213 if (!mdesc) {
205 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER)
206 return NULL;
207
208 /* Search the mdescs for the 'best' compatible value match */
209 initial_boot_params = devtree;
210 dt_root = of_get_flat_dt_root();
211 for_each_machine_desc(mdesc) {
212 score = of_flat_dt_match(dt_root, mdesc->dt_compat);
213 if (score > 0 && score < mdesc_score) {
214 mdesc_best = mdesc;
215 mdesc_score = score;
216 }
217 }
218 if (!mdesc_best) {
219 const char *prop; 214 const char *prop;
220 long size; 215 long size;
216 unsigned long dt_root;
221 217
222 early_print("\nError: unrecognized/unsupported " 218 early_print("\nError: unrecognized/unsupported "
223 "device tree compatible list:\n[ "); 219 "device tree compatible list:\n[ ");
224 220
221 dt_root = of_get_flat_dt_root();
225 prop = of_get_flat_dt_prop(dt_root, "compatible", &size); 222 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
226 while (size > 0) { 223 while (size > 0) {
227 early_print("'%s' ", prop); 224 early_print("'%s' ", prop);
@@ -233,22 +230,8 @@ const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
233 dump_machine_table(); /* does not return */ 230 dump_machine_table(); /* does not return */
234 } 231 }
235 232
236 model = of_get_flat_dt_prop(dt_root, "model", NULL);
237 if (!model)
238 model = of_get_flat_dt_prop(dt_root, "compatible", NULL);
239 if (!model)
240 model = "<unknown>";
241 pr_info("Machine: %s, model: %s\n", mdesc_best->name, model);
242
243 /* Retrieve various information from the /chosen node */
244 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
245 /* Initialize {size,address}-cells info */
246 of_scan_flat_dt(early_init_dt_scan_root, NULL);
247 /* Setup memory, calling early_init_dt_add_memory_arch */
248 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
249
250 /* Change machine number to match the mdesc we're using */ 233 /* Change machine number to match the mdesc we're using */
251 __machine_arch_type = mdesc_best->nr; 234 __machine_arch_type = mdesc->nr;
252 235
253 return mdesc_best; 236 return mdesc;
254} 237}
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index c9c5a33bc802..c5e01b24d9fb 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -808,22 +808,6 @@ static u8 __init pci_v3_swizzle(struct pci_dev *dev, u8 *pinp)
808 return pci_common_swizzle(dev, pinp); 808 return pci_common_swizzle(dev, pinp);
809} 809}
810 810
811static int __init pci_v3_map_irq_dt(const struct pci_dev *dev, u8 slot, u8 pin)
812{
813 struct of_irq oirq;
814 int ret;
815
816 ret = of_irq_map_pci(dev, &oirq);
817 if (ret) {
818 dev_err(&dev->dev, "of_irq_map_pci() %d\n", ret);
819 /* Proper return code 0 == NO_IRQ */
820 return 0;
821 }
822
823 return irq_create_of_mapping(oirq.controller, oirq.specifier,
824 oirq.size);
825}
826
827static struct hw_pci pci_v3 __initdata = { 811static struct hw_pci pci_v3 __initdata = {
828 .swizzle = pci_v3_swizzle, 812 .swizzle = pci_v3_swizzle,
829 .setup = pci_v3_setup, 813 .setup = pci_v3_setup,
@@ -914,7 +898,7 @@ static int __init pci_v3_probe(struct platform_device *pdev)
914 return -EINVAL; 898 return -EINVAL;
915 } 899 }
916 900
917 pci_v3.map_irq = pci_v3_map_irq_dt; 901 pci_v3.map_irq = of_irq_parse_and_map_pci;
918 pci_common_init_dev(&pdev->dev, &pci_v3); 902 pci_common_init_dev(&pdev->dev, &pci_v3);
919 903
920 return 0; 904 return 0;
diff --git a/arch/arm/mach-keystone/platsmp.c b/arch/arm/mach-keystone/platsmp.c
index c12296157d4a..5cf0683577ea 100644
--- a/arch/arm/mach-keystone/platsmp.c
+++ b/arch/arm/mach-keystone/platsmp.c
@@ -17,7 +17,6 @@
17#include <linux/io.h> 17#include <linux/io.h>
18 18
19#include <asm/smp_plat.h> 19#include <asm/smp_plat.h>
20#include <asm/prom.h>
21 20
22#include "keystone.h" 21#include "keystone.h"
23 22
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index b5db207dfd1e..9a5f9fb352ce 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -358,8 +358,7 @@ static struct delay_timer u300_delay_timer;
358 */ 358 */
359static void __init u300_timer_init_of(struct device_node *np) 359static void __init u300_timer_init_of(struct device_node *np)
360{ 360{
361 struct resource irq_res; 361 unsigned int irq;
362 int irq;
363 struct clk *clk; 362 struct clk *clk;
364 unsigned long rate; 363 unsigned long rate;
365 364
@@ -368,11 +367,11 @@ static void __init u300_timer_init_of(struct device_node *np)
368 panic("could not ioremap system timer\n"); 367 panic("could not ioremap system timer\n");
369 368
370 /* Get the IRQ for the GP1 timer */ 369 /* Get the IRQ for the GP1 timer */
371 irq = of_irq_to_resource(np, 2, &irq_res); 370 irq = irq_of_parse_and_map(np, 2);
372 if (irq <= 0) 371 if (!irq)
373 panic("no IRQ for system timer\n"); 372 panic("no IRQ for system timer\n");
374 373
375 pr_info("U300 GP1 timer @ base: %p, IRQ: %d\n", u300_timer_base, irq); 374 pr_info("U300 GP1 timer @ base: %p, IRQ: %u\n", u300_timer_base, irq);
376 375
377 /* Clock the interrupt controller */ 376 /* Clock the interrupt controller */
378 clk = of_clk_get(np, 0); 377 clk = of_clk_get(np, 0);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 18ec4c504abf..ca907f805c57 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -76,14 +76,6 @@ static int __init parse_tag_initrd2(const struct tag *tag)
76 76
77__tagtable(ATAG_INITRD2, parse_tag_initrd2); 77__tagtable(ATAG_INITRD2, parse_tag_initrd2);
78 78
79#ifdef CONFIG_OF_FLATTREE
80void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
81{
82 phys_initrd_start = start;
83 phys_initrd_size = end - start;
84}
85#endif /* CONFIG_OF_FLATTREE */
86
87/* 79/*
88 * This keeps memory configuration data used by a couple memory 80 * This keeps memory configuration data used by a couple memory
89 * initialization functions, as well as show_mem() for the skipping 81 * initialization functions, as well as show_mem() for the skipping
@@ -350,6 +342,11 @@ void __init arm_memblock_init(struct meminfo *mi,
350 memblock_reserve(__pa(_stext), _end - _stext); 342 memblock_reserve(__pa(_stext), _end - _stext);
351#endif 343#endif
352#ifdef CONFIG_BLK_DEV_INITRD 344#ifdef CONFIG_BLK_DEV_INITRD
345 /* FDT scan will populate initrd_start */
346 if (initrd_start) {
347 phys_initrd_start = __virt_to_phys(initrd_start);
348 phys_initrd_size = initrd_end - initrd_start;
349 }
353 if (phys_initrd_size && 350 if (phys_initrd_size &&
354 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { 351 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) {
355 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n", 352 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n",
diff --git a/arch/arm64/include/asm/prom.h b/arch/arm64/include/asm/prom.h
deleted file mode 100644
index 68b90e682957..000000000000
--- a/arch/arm64/include/asm/prom.h
+++ /dev/null
@@ -1 +0,0 @@
1/* Empty for now */
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 47905598d790..0bc5e4cbc017 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -140,70 +140,18 @@ static void __init setup_processor(void)
140 140
141static void __init setup_machine_fdt(phys_addr_t dt_phys) 141static void __init setup_machine_fdt(phys_addr_t dt_phys)
142{ 142{
143 struct boot_param_header *devtree; 143 if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) {
144 unsigned long dt_root;
145
146 /* Check we have a non-NULL DT pointer */
147 if (!dt_phys) {
148 early_print("\n"
149 "Error: NULL or invalid device tree blob\n"
150 "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
151 "\nPlease check your bootloader.\n");
152
153 while (true)
154 cpu_relax();
155
156 }
157
158 devtree = phys_to_virt(dt_phys);
159
160 /* Check device tree validity */
161 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) {
162 early_print("\n" 144 early_print("\n"
163 "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" 145 "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n"
164 "Expected 0x%x, found 0x%x\n" 146 "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
165 "\nPlease check your bootloader.\n", 147 "\nPlease check your bootloader.\n",
166 dt_phys, devtree, OF_DT_HEADER, 148 dt_phys, phys_to_virt(dt_phys));
167 be32_to_cpu(devtree->magic));
168 149
169 while (true) 150 while (true)
170 cpu_relax(); 151 cpu_relax();
171 } 152 }
172 153
173 initial_boot_params = devtree; 154 machine_name = of_flat_dt_get_machine_name();
174 dt_root = of_get_flat_dt_root();
175
176 machine_name = of_get_flat_dt_prop(dt_root, "model", NULL);
177 if (!machine_name)
178 machine_name = of_get_flat_dt_prop(dt_root, "compatible", NULL);
179 if (!machine_name)
180 machine_name = "<unknown>";
181 pr_info("Machine: %s\n", machine_name);
182
183 /* Retrieve various information from the /chosen node */
184 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
185 /* Initialize {size,address}-cells info */
186 of_scan_flat_dt(early_init_dt_scan_root, NULL);
187 /* Setup memory, calling early_init_dt_add_memory_arch */
188 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
189}
190
191void __init early_init_dt_add_memory_arch(u64 base, u64 size)
192{
193 base &= PAGE_MASK;
194 size &= PAGE_MASK;
195 if (base + size < PHYS_OFFSET) {
196 pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
197 base, base + size);
198 return;
199 }
200 if (base < PHYS_OFFSET) {
201 pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
202 base, PHYS_OFFSET);
203 size -= PHYS_OFFSET - base;
204 base = PHYS_OFFSET;
205 }
206 memblock_add(base, size);
207} 155}
208 156
209/* 157/*
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index de2de5db628d..0cb8742de4f2 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -31,7 +31,6 @@
31#include <linux/sort.h> 31#include <linux/sort.h>
32#include <linux/of_fdt.h> 32#include <linux/of_fdt.h>
33 33
34#include <asm/prom.h>
35#include <asm/sections.h> 34#include <asm/sections.h>
36#include <asm/setup.h> 35#include <asm/setup.h>
37#include <asm/sizes.h> 36#include <asm/sizes.h>
@@ -39,17 +38,9 @@
39 38
40#include "mm.h" 39#include "mm.h"
41 40
42static unsigned long phys_initrd_start __initdata = 0;
43static unsigned long phys_initrd_size __initdata = 0;
44
45phys_addr_t memstart_addr __read_mostly = 0; 41phys_addr_t memstart_addr __read_mostly = 0;
46 42
47void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) 43#ifdef CONFIG_BLK_DEV_INITRD
48{
49 phys_initrd_start = start;
50 phys_initrd_size = end - start;
51}
52
53static int __init early_initrd(char *p) 44static int __init early_initrd(char *p)
54{ 45{
55 unsigned long start, size; 46 unsigned long start, size;
@@ -59,12 +50,13 @@ static int __init early_initrd(char *p)
59 if (*endp == ',') { 50 if (*endp == ',') {
60 size = memparse(endp + 1, NULL); 51 size = memparse(endp + 1, NULL);
61 52
62 phys_initrd_start = start; 53 initrd_start = (unsigned long)__va(start);
63 phys_initrd_size = size; 54 initrd_end = (unsigned long)__va(start + size);
64 } 55 }
65 return 0; 56 return 0;
66} 57}
67early_param("initrd", early_initrd); 58early_param("initrd", early_initrd);
59#endif
68 60
69#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT) 61#define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT)
70 62
@@ -137,13 +129,8 @@ void __init arm64_memblock_init(void)
137 /* Register the kernel text, kernel data and initrd with memblock */ 129 /* Register the kernel text, kernel data and initrd with memblock */
138 memblock_reserve(__pa(_text), _end - _text); 130 memblock_reserve(__pa(_text), _end - _text);
139#ifdef CONFIG_BLK_DEV_INITRD 131#ifdef CONFIG_BLK_DEV_INITRD
140 if (phys_initrd_size) { 132 if (initrd_start)
141 memblock_reserve(phys_initrd_start, phys_initrd_size); 133 memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start);
142
143 /* Now convert initrd to virtual addresses */
144 initrd_start = __phys_to_virt(phys_initrd_start);
145 initrd_end = initrd_start + phys_initrd_size;
146 }
147#endif 134#endif
148 135
149 /* 136 /*
diff --git a/arch/c6x/include/asm/prom.h b/arch/c6x/include/asm/prom.h
deleted file mode 100644
index b4ec95f07518..000000000000
--- a/arch/c6x/include/asm/prom.h
+++ /dev/null
@@ -1 +0,0 @@
1/* dummy prom.h; here to make linux/of.h's #includes happy */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index ecead15872a6..696804475f55 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -14,8 +14,6 @@
14#include <uapi/asm/setup.h> 14#include <uapi/asm/setup.h>
15 15
16#ifndef __ASSEMBLY__ 16#ifndef __ASSEMBLY__
17extern char c6x_command_line[COMMAND_LINE_SIZE];
18
19extern int c6x_add_memory(phys_addr_t start, unsigned long size); 17extern int c6x_add_memory(phys_addr_t start, unsigned long size);
20 18
21extern unsigned long ram_start; 19extern unsigned long ram_start;
diff --git a/arch/c6x/kernel/devicetree.c b/arch/c6x/kernel/devicetree.c
index 9e15ab9199b2..fa3e5741514e 100644
--- a/arch/c6x/kernel/devicetree.c
+++ b/arch/c6x/kernel/devicetree.c
@@ -10,37 +10,8 @@
10 * 10 *
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/of.h>
14#include <linux/of_fdt.h>
15#include <linux/initrd.h>
16#include <linux/memblock.h> 13#include <linux/memblock.h>
17 14
18void __init early_init_devtree(void *params)
19{
20 /* Setup flat device-tree pointer */
21 initial_boot_params = params;
22
23 /* Retrieve various informations from the /chosen node of the
24 * device-tree, including the platform type, initrd location and
25 * size and more ...
26 */
27 of_scan_flat_dt(early_init_dt_scan_chosen, c6x_command_line);
28
29 /* Scan memory nodes and rebuild MEMBLOCKs */
30 of_scan_flat_dt(early_init_dt_scan_root, NULL);
31 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
32}
33
34
35#ifdef CONFIG_BLK_DEV_INITRD
36void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
37{
38 initrd_start = (unsigned long)__va(start);
39 initrd_end = (unsigned long)__va(end);
40 initrd_below_start_ok = 1;
41}
42#endif
43
44void __init early_init_dt_add_memory_arch(u64 base, u64 size) 15void __init early_init_dt_add_memory_arch(u64 base, u64 size)
45{ 16{
46 c6x_add_memory(base, size); 17 c6x_add_memory(base, size);
diff --git a/arch/c6x/kernel/setup.c b/arch/c6x/kernel/setup.c
index f4e72bd8c103..731db4b9014d 100644
--- a/arch/c6x/kernel/setup.c
+++ b/arch/c6x/kernel/setup.c
@@ -68,13 +68,6 @@ unsigned long ram_end;
68static unsigned long dma_start __initdata; 68static unsigned long dma_start __initdata;
69static unsigned long dma_size __initdata; 69static unsigned long dma_size __initdata;
70 70
71char c6x_command_line[COMMAND_LINE_SIZE];
72
73#if defined(CONFIG_CMDLINE_BOOL)
74static const char default_command_line[COMMAND_LINE_SIZE] __section(.cmdline) =
75 CONFIG_CMDLINE;
76#endif
77
78struct cpuinfo_c6x { 71struct cpuinfo_c6x {
79 const char *cpu_name; 72 const char *cpu_name;
80 const char *cpu_voltage; 73 const char *cpu_voltage;
@@ -294,10 +287,8 @@ notrace void __init machine_init(unsigned long dt_ptr)
294 fdt = dtb; 287 fdt = dtb;
295 288
296 /* Do some early initialization based on the flat device tree */ 289 /* Do some early initialization based on the flat device tree */
297 early_init_devtree(fdt); 290 early_init_dt_scan(fdt);
298 291
299 /* parse_early_param needs a boot_command_line */
300 strlcpy(boot_command_line, c6x_command_line, COMMAND_LINE_SIZE);
301 parse_early_param(); 292 parse_early_param();
302} 293}
303 294
@@ -309,7 +300,7 @@ void __init setup_arch(char **cmdline_p)
309 printk(KERN_INFO "Initializing kernel\n"); 300 printk(KERN_INFO "Initializing kernel\n");
310 301
311 /* Initialize command line */ 302 /* Initialize command line */
312 *cmdline_p = c6x_command_line; 303 *cmdline_p = boot_command_line;
313 304
314 memory_end = ram_end; 305 memory_end = ram_end;
315 memory_end &= ~(PAGE_SIZE - 1); 306 memory_end &= ~(PAGE_SIZE - 1);
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S
index 279d80725128..5a6e141d1641 100644
--- a/arch/c6x/kernel/vmlinux.lds.S
+++ b/arch/c6x/kernel/vmlinux.lds.S
@@ -37,12 +37,6 @@ SECTIONS
37 _vectors_end = .; 37 _vectors_end = .;
38 } 38 }
39 39
40 . = ALIGN(0x1000);
41 .cmdline :
42 {
43 *(.cmdline)
44 }
45
46 /* 40 /*
47 * This section contains data which may be shared with other 41 * This section contains data which may be shared with other
48 * cores. It needs to be a fixed offset from PAGE_OFFSET 42 * cores. It needs to be a fixed offset from PAGE_OFFSET
diff --git a/arch/hexagon/kernel/setup.c b/arch/hexagon/kernel/setup.c
index 29d1f1b00016..0e7c1dbb37b2 100644
--- a/arch/hexagon/kernel/setup.c
+++ b/arch/hexagon/kernel/setup.c
@@ -32,9 +32,6 @@
32#include <asm/hexagon_vm.h> 32#include <asm/hexagon_vm.h>
33#include <asm/vm_mmu.h> 33#include <asm/vm_mmu.h>
34#include <asm/time.h> 34#include <asm/time.h>
35#ifdef CONFIG_OF
36#include <asm/prom.h>
37#endif
38 35
39char cmd_line[COMMAND_LINE_SIZE]; 36char cmd_line[COMMAND_LINE_SIZE];
40static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE; 37static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
diff --git a/arch/metag/include/asm/mach/arch.h b/arch/metag/include/asm/mach/arch.h
index 12c5664fea6e..433f94624fa2 100644
--- a/arch/metag/include/asm/mach/arch.h
+++ b/arch/metag/include/asm/mach/arch.h
@@ -53,7 +53,7 @@ struct machine_desc {
53/* 53/*
54 * Current machine - only accessible during boot. 54 * Current machine - only accessible during boot.
55 */ 55 */
56extern struct machine_desc *machine_desc; 56extern const struct machine_desc *machine_desc;
57 57
58/* 58/*
59 * Machine type table - also only accessible during boot 59 * Machine type table - also only accessible during boot
diff --git a/arch/metag/include/asm/prom.h b/arch/metag/include/asm/prom.h
deleted file mode 100644
index d2aa35d2228e..000000000000
--- a/arch/metag/include/asm/prom.h
+++ /dev/null
@@ -1,23 +0,0 @@
1/*
2 * arch/metag/include/asm/prom.h
3 *
4 * Copyright (C) 2012 Imagination Technologies Ltd.
5 *
6 * Based on ARM version:
7 * Copyright (C) 2009 Canonical Ltd. <jeremy.kerr@canonical.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14#ifndef __ASM_METAG_PROM_H
15#define __ASM_METAG_PROM_H
16
17#include <asm/setup.h>
18#define HAVE_ARCH_DEVTREE_FIXUPS
19
20extern struct machine_desc *setup_machine_fdt(void *dt);
21extern void copy_fdt(void);
22
23#endif /* __ASM_METAG_PROM_H */
diff --git a/arch/metag/include/asm/setup.h b/arch/metag/include/asm/setup.h
index e13083b15dd0..e9fdee9452b1 100644
--- a/arch/metag/include/asm/setup.h
+++ b/arch/metag/include/asm/setup.h
@@ -3,6 +3,7 @@
3 3
4#include <uapi/asm/setup.h> 4#include <uapi/asm/setup.h>
5 5
6extern const struct machine_desc *setup_machine_fdt(void *dt);
6void per_cpu_trap_init(unsigned long); 7void per_cpu_trap_init(unsigned long);
7extern void __init dump_machine_table(void); 8extern void __init dump_machine_table(void);
8#endif /* _ASM_METAG_SETUP_H */ 9#endif /* _ASM_METAG_SETUP_H */
diff --git a/arch/metag/kernel/devtree.c b/arch/metag/kernel/devtree.c
index 7cd02529636e..18dd7aea9fdc 100644
--- a/arch/metag/kernel/devtree.c
+++ b/arch/metag/kernel/devtree.c
@@ -34,6 +34,19 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
34 return alloc_bootmem_align(size, align); 34 return alloc_bootmem_align(size, align);
35} 35}
36 36
37static const void * __init arch_get_next_mach(const char *const **match)
38{
39 static const struct machine_desc *mdesc = __arch_info_begin;
40 const struct machine_desc *m = mdesc;
41
42 if (m >= __arch_info_end)
43 return NULL;
44
45 mdesc++;
46 *match = m->dt_compat;
47 return m;
48}
49
37/** 50/**
38 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 51 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel
39 * @dt: virtual address pointer to dt blob 52 * @dt: virtual address pointer to dt blob
@@ -41,74 +54,18 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
41 * If a dtb was passed to the kernel, then use it to choose the correct 54 * If a dtb was passed to the kernel, then use it to choose the correct
42 * machine_desc and to setup the system. 55 * machine_desc and to setup the system.
43 */ 56 */
44struct machine_desc * __init setup_machine_fdt(void *dt) 57const struct machine_desc * __init setup_machine_fdt(void *dt)
45{ 58{
46 struct boot_param_header *devtree = dt; 59 const struct machine_desc *mdesc;
47 struct machine_desc *mdesc, *mdesc_best = NULL;
48 unsigned int score, mdesc_score = ~1;
49 unsigned long dt_root;
50 const char *model;
51 60
52 /* check device tree validity */ 61 /* check device tree validity */
53 if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) 62 if (!early_init_dt_scan(dt))
54 return NULL; 63 return NULL;
55 64
56 /* Search the mdescs for the 'best' compatible value match */ 65 mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach);
57 initial_boot_params = devtree; 66 if (!mdesc)
58 dt_root = of_get_flat_dt_root();
59
60 for_each_machine_desc(mdesc) {
61 score = of_flat_dt_match(dt_root, mdesc->dt_compat);
62 if (score > 0 && score < mdesc_score) {
63 mdesc_best = mdesc;
64 mdesc_score = score;
65 }
66 }
67 if (!mdesc_best) {
68 const char *prop;
69 long size;
70
71 pr_err("\nError: unrecognized/unsupported device tree compatible list:\n[ ");
72
73 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
74 if (prop) {
75 while (size > 0) {
76 printk("'%s' ", prop);
77 size -= strlen(prop) + 1;
78 prop += strlen(prop) + 1;
79 }
80 }
81 printk("]\n\n");
82
83 dump_machine_table(); /* does not return */ 67 dump_machine_table(); /* does not return */
84 } 68 pr_info("Machine name: %s\n", mdesc->name);
85
86 model = of_get_flat_dt_prop(dt_root, "model", NULL);
87 if (!model)
88 model = of_get_flat_dt_prop(dt_root, "compatible", NULL);
89 if (!model)
90 model = "<unknown>";
91 pr_info("Machine: %s, model: %s\n", mdesc_best->name, model);
92
93 /* Retrieve various information from the /chosen node */
94 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
95
96 return mdesc_best;
97}
98 69
99/** 70 return mdesc;
100 * copy_fdt - Copy device tree into non-init memory.
101 *
102 * We must copy the flattened device tree blob into non-init memory because the
103 * unflattened device tree will reference the strings in it directly.
104 */
105void __init copy_fdt(void)
106{
107 void *alloc = early_init_dt_alloc_memory_arch(
108 be32_to_cpu(initial_boot_params->totalsize), 0x40);
109 if (alloc) {
110 memcpy(alloc, initial_boot_params,
111 be32_to_cpu(initial_boot_params->totalsize));
112 initial_boot_params = alloc;
113 }
114} 71}
diff --git a/arch/metag/kernel/setup.c b/arch/metag/kernel/setup.c
index e639bae09645..129c7cdda1ce 100644
--- a/arch/metag/kernel/setup.c
+++ b/arch/metag/kernel/setup.c
@@ -42,7 +42,6 @@
42#include <asm/mmu.h> 42#include <asm/mmu.h>
43#include <asm/mmzone.h> 43#include <asm/mmzone.h>
44#include <asm/processor.h> 44#include <asm/processor.h>
45#include <asm/prom.h>
46#include <asm/sections.h> 45#include <asm/sections.h>
47#include <asm/setup.h> 46#include <asm/setup.h>
48#include <asm/traps.h> 47#include <asm/traps.h>
@@ -115,7 +114,7 @@ extern u32 __dtb_start[];
115extern struct console dash_console; 114extern struct console dash_console;
116#endif 115#endif
117 116
118struct machine_desc *machine_desc __initdata; 117const struct machine_desc *machine_desc __initdata;
119 118
120/* 119/*
121 * Map a Linux CPU number to a hardware thread ID 120 * Map a Linux CPU number to a hardware thread ID
@@ -404,9 +403,7 @@ void __init setup_arch(char **cmdline_p)
404 cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id(); 403 cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id();
405 hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id(); 404 hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id();
406 405
407 /* Copy device tree blob into non-init memory before unflattening */ 406 unflatten_and_copy_device_tree();
408 copy_fdt();
409 unflatten_device_tree();
410 407
411#ifdef CONFIG_SMP 408#ifdef CONFIG_SMP
412 smp_init_cpus(); 409 smp_init_cpus();
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index 123919534b80..249fff66add3 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -12,7 +12,6 @@
12#include <linux/percpu.h> 12#include <linux/percpu.h>
13#include <linux/memblock.h> 13#include <linux/memblock.h>
14#include <linux/initrd.h> 14#include <linux/initrd.h>
15#include <linux/of_fdt.h>
16 15
17#include <asm/setup.h> 16#include <asm/setup.h>
18#include <asm/page.h> 17#include <asm/page.h>
@@ -405,11 +404,3 @@ void free_initrd_mem(unsigned long start, unsigned long end)
405 "initrd"); 404 "initrd");
406} 405}
407#endif 406#endif
408
409#ifdef CONFIG_OF_FLATTREE
410void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
411{
412 pr_err("%s(%llx, %llx)\n",
413 __func__, start, end);
414}
415#endif /* CONFIG_OF_FLATTREE */
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h
index d52abb6812fa..935f9bec414a 100644
--- a/arch/microblaze/include/asm/pci.h
+++ b/arch/microblaze/include/asm/pci.h
@@ -127,8 +127,6 @@ extern void of_scan_pci_bridge(struct device_node *node,
127extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); 127extern void of_scan_bus(struct device_node *node, struct pci_bus *bus);
128extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus); 128extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus);
129 129
130extern int pci_read_irq_line(struct pci_dev *dev);
131
132extern int pci_bus_find_capability(struct pci_bus *bus, 130extern int pci_bus_find_capability(struct pci_bus *bus,
133 unsigned int devfn, int cap); 131 unsigned int devfn, int cap);
134 132
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index 9977816c5ad3..2f03ac815851 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -11,19 +11,10 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14
15#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
16
17#ifndef _ASM_MICROBLAZE_PROM_H 14#ifndef _ASM_MICROBLAZE_PROM_H
18#define _ASM_MICROBLAZE_PROM_H 15#define _ASM_MICROBLAZE_PROM_H
19#ifdef __KERNEL__
20#ifndef __ASSEMBLY__
21
22#include <linux/types.h>
23#include <asm/irq.h>
24#include <linux/atomic.h>
25 16
26#define HAVE_ARCH_DEVTREE_FIXUPS 17#include <linux/of.h>
27 18
28/* Other Prototypes */ 19/* Other Prototypes */
29enum early_consoles { 20enum early_consoles {
@@ -33,32 +24,4 @@ enum early_consoles {
33 24
34extern int of_early_console(void *version); 25extern int of_early_console(void *version);
35 26
36/*
37 * OF address retreival & translation
38 */
39
40#ifdef CONFIG_PCI
41extern unsigned long pci_address_to_pio(phys_addr_t address);
42#define pci_address_to_pio pci_address_to_pio
43#endif /* CONFIG_PCI */
44
45/* Parse the ibm,dma-window property of an OF node into the busno, phys and
46 * size parameters.
47 */
48void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
49 unsigned long *busno, unsigned long *phys, unsigned long *size);
50
51extern void kdump_move_device_tree(void);
52
53#endif /* __ASSEMBLY__ */
54#endif /* __KERNEL__ */
55
56/* These includes are put at the bottom because they may contain things
57 * that are overridden by this file. Ideally they shouldn't be included
58 * by this file, but there are a bunch of .c files that currently depend
59 * on it. Eventually they will be cleaned up. */
60#include <linux/of_fdt.h>
61#include <linux/of_irq.h>
62#include <linux/platform_device.h>
63
64#endif /* _ASM_MICROBLAZE_PROM_H */ 27#endif /* _ASM_MICROBLAZE_PROM_H */
diff --git a/arch/microblaze/kernel/prom.c b/arch/microblaze/kernel/prom.c
index 0c4453f134cb..abdfb10e7eca 100644
--- a/arch/microblaze/kernel/prom.c
+++ b/arch/microblaze/kernel/prom.c
@@ -30,6 +30,7 @@
30#include <linux/debugfs.h> 30#include <linux/debugfs.h>
31#include <linux/irq.h> 31#include <linux/irq.h>
32#include <linux/memblock.h> 32#include <linux/memblock.h>
33#include <linux/of_fdt.h>
33 34
34#include <asm/prom.h> 35#include <asm/prom.h>
35#include <asm/page.h> 36#include <asm/page.h>
@@ -41,11 +42,6 @@
41#include <asm/sections.h> 42#include <asm/sections.h>
42#include <asm/pci-bridge.h> 43#include <asm/pci-bridge.h>
43 44
44void __init early_init_dt_add_memory_arch(u64 base, u64 size)
45{
46 memblock_add(base, size);
47}
48
49#ifdef CONFIG_EARLY_PRINTK 45#ifdef CONFIG_EARLY_PRINTK
50static char *stdout; 46static char *stdout;
51 47
@@ -106,21 +102,10 @@ void __init early_init_devtree(void *params)
106{ 102{
107 pr_debug(" -> early_init_devtree(%p)\n", params); 103 pr_debug(" -> early_init_devtree(%p)\n", params);
108 104
109 /* Setup flat device-tree pointer */ 105 early_init_dt_scan(params);
110 initial_boot_params = params; 106 if (!strlen(boot_command_line))
111 107 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
112 /* Retrieve various informations from the /chosen node of the
113 * device-tree, including the platform type, initrd location and
114 * size, TCE reserve, and more ...
115 */
116 of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
117
118 /* Scan memory nodes and rebuild MEMBLOCKs */
119 of_scan_flat_dt(early_init_dt_scan_root, NULL);
120 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
121 108
122 /* Save command line for /proc/cmdline and then parse parameters */
123 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
124 parse_early_param(); 109 parse_early_param();
125 110
126 memblock_allow_resize(); 111 memblock_allow_resize();
@@ -130,15 +115,6 @@ void __init early_init_devtree(void *params)
130 pr_debug(" <- early_init_devtree()\n"); 115 pr_debug(" <- early_init_devtree()\n");
131} 116}
132 117
133#ifdef CONFIG_BLK_DEV_INITRD
134void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
135{
136 initrd_start = (unsigned long)__va(start);
137 initrd_end = (unsigned long)__va(end);
138 initrd_below_start_ok = 1;
139}
140#endif
141
142/******* 118/*******
143 * 119 *
144 * New implementation of the OF "find" APIs, return a refcounted 120 * New implementation of the OF "find" APIs, return a refcounted
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 0775e036c526..8de8ebc309f1 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -16,6 +16,7 @@
16#include <linux/initrd.h> 16#include <linux/initrd.h>
17#include <linux/console.h> 17#include <linux/console.h>
18#include <linux/debugfs.h> 18#include <linux/debugfs.h>
19#include <linux/of_fdt.h>
19 20
20#include <asm/setup.h> 21#include <asm/setup.h>
21#include <asm/sections.h> 22#include <asm/sections.h>
@@ -50,7 +51,7 @@ char cmd_line[COMMAND_LINE_SIZE] __attribute__ ((section(".data")));
50 51
51void __init setup_arch(char **cmdline_p) 52void __init setup_arch(char **cmdline_p)
52{ 53{
53 *cmdline_p = cmd_line; 54 *cmdline_p = boot_command_line;
54 55
55 console_verbose(); 56 console_verbose();
56 57
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index d7abb71abf61..3e39b1082fdf 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -15,6 +15,7 @@
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/clockchips.h> 16#include <linux/clockchips.h>
17#include <linux/of_address.h> 17#include <linux/of_address.h>
18#include <linux/of_irq.h>
18#include <asm/cpuinfo.h> 19#include <asm/cpuinfo.h>
19#include <linux/cnt32_to_63.h> 20#include <linux/cnt32_to_63.h>
20 21
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c
index 1b93bf0892a0..66804adcacf0 100644
--- a/arch/microblaze/pci/pci-common.c
+++ b/arch/microblaze/pci/pci-common.c
@@ -29,6 +29,7 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/of.h> 30#include <linux/of.h>
31#include <linux/of_address.h> 31#include <linux/of_address.h>
32#include <linux/of_irq.h>
32#include <linux/of_pci.h> 33#include <linux/of_pci.h>
33#include <linux/export.h> 34#include <linux/export.h>
34 35
@@ -193,76 +194,6 @@ void pcibios_set_master(struct pci_dev *dev)
193} 194}
194 195
195/* 196/*
196 * Reads the interrupt pin to determine if interrupt is use by card.
197 * If the interrupt is used, then gets the interrupt line from the
198 * openfirmware and sets it in the pci_dev and pci_config line.
199 */
200int pci_read_irq_line(struct pci_dev *pci_dev)
201{
202 struct of_irq oirq;
203 unsigned int virq;
204
205 /* The current device-tree that iSeries generates from the HV
206 * PCI informations doesn't contain proper interrupt routing,
207 * and all the fallback would do is print out crap, so we
208 * don't attempt to resolve the interrupts here at all, some
209 * iSeries specific fixup does it.
210 *
211 * In the long run, we will hopefully fix the generated device-tree
212 * instead.
213 */
214 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
215
216#ifdef DEBUG
217 memset(&oirq, 0xff, sizeof(oirq));
218#endif
219 /* Try to get a mapping from the device-tree */
220 if (of_irq_map_pci(pci_dev, &oirq)) {
221 u8 line, pin;
222
223 /* If that fails, lets fallback to what is in the config
224 * space and map that through the default controller. We
225 * also set the type to level low since that's what PCI
226 * interrupts are. If your platform does differently, then
227 * either provide a proper interrupt tree or don't use this
228 * function.
229 */
230 if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &pin))
231 return -1;
232 if (pin == 0)
233 return -1;
234 if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, &line) ||
235 line == 0xff || line == 0) {
236 return -1;
237 }
238 pr_debug(" No map ! Using line %d (pin %d) from PCI config\n",
239 line, pin);
240
241 virq = irq_create_mapping(NULL, line);
242 if (virq)
243 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
244 } else {
245 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
246 oirq.size, oirq.specifier[0], oirq.specifier[1],
247 of_node_full_name(oirq.controller));
248
249 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
250 oirq.size);
251 }
252 if (!virq) {
253 pr_debug(" Failed to map !\n");
254 return -1;
255 }
256
257 pr_debug(" Mapped to linux irq %d\n", virq);
258
259 pci_dev->irq = virq;
260
261 return 0;
262}
263EXPORT_SYMBOL(pci_read_irq_line);
264
265/*
266 * Platform support for /proc/bus/pci/X/Y mmap()s, 197 * Platform support for /proc/bus/pci/X/Y mmap()s,
267 * modelled on the sparc64 implementation by Dave Miller. 198 * modelled on the sparc64 implementation by Dave Miller.
268 * -- paulus. 199 * -- paulus.
@@ -960,7 +891,7 @@ void pcibios_setup_bus_devices(struct pci_bus *bus)
960 dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET; 891 dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET;
961 892
962 /* Read default IRQs and fixup if necessary */ 893 /* Read default IRQs and fixup if necessary */
963 pci_read_irq_line(dev); 894 dev->irq = of_irq_parse_and_map_pci(dev, 0, 0);
964 } 895 }
965} 896}
966 897
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/pci/fixup-lantiq.c b/arch/mips/pci/fixup-lantiq.c
index 6c829df28dc7..c2ce41ea61d7 100644
--- a/arch/mips/pci/fixup-lantiq.c
+++ b/arch/mips/pci/fixup-lantiq.c
@@ -25,16 +25,5 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
25 25
26int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 26int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
27{ 27{
28 struct of_irq dev_irq; 28 return of_irq_parse_and_map_pci(dev, slot, pin);
29 int irq;
30
31 if (of_irq_map_pci(dev, &dev_irq)) {
32 dev_err(&dev->dev, "trying to map irq for unknown slot:%d pin:%d\n",
33 slot, pin);
34 return 0;
35 }
36 irq = irq_create_of_mapping(dev_irq.controller, dev_irq.specifier,
37 dev_irq.size);
38 dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, irq);
39 return irq;
40} 29}
diff --git a/arch/mips/pci/pci-rt3883.c b/arch/mips/pci/pci-rt3883.c
index 95c9d41382e7..adeff2bfe4cd 100644
--- a/arch/mips/pci/pci-rt3883.c
+++ b/arch/mips/pci/pci-rt3883.c
@@ -583,29 +583,7 @@ err_put_intc_node:
583 583
584int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 584int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
585{ 585{
586 struct of_irq dev_irq; 586 return of_irq_parse_and_map_pci(dev, slot, pin);
587 int err;
588 int irq;
589
590 err = of_irq_map_pci(dev, &dev_irq);
591 if (err) {
592 pr_err("pci %s: unable to get irq map, err=%d\n",
593 pci_name((struct pci_dev *) dev), err);
594 return 0;
595 }
596
597 irq = irq_create_of_mapping(dev_irq.controller,
598 dev_irq.specifier,
599 dev_irq.size);
600
601 if (irq == 0)
602 pr_crit("pci %s: no irq found for pin %u\n",
603 pci_name((struct pci_dev *) dev), pin);
604 else
605 pr_info("pci %s: using irq %d for pin %u\n",
606 pci_name((struct pci_dev *) dev), irq, pin);
607
608 return irq;
609} 587}
610 588
611int pcibios_plat_dev_init(struct pci_dev *dev) 589int pcibios_plat_dev_init(struct pci_dev *dev)
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 15f21ea96121..eccc5526155e 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
diff --git a/arch/openrisc/include/asm/prom.h b/arch/openrisc/include/asm/prom.h
deleted file mode 100644
index 93c9980e1b6b..000000000000
--- a/arch/openrisc/include/asm/prom.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * OpenRISC Linux
3 *
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
7 *
8 * OpenRISC implementation:
9 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
10 * et al.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 */
17#ifndef _ASM_OPENRISC_PROM_H
18#define _ASM_OPENRISC_PROM_H
19
20#define HAVE_ARCH_DEVTREE_FIXUPS
21
22#endif /* _ASM_OPENRISC_PROM_H */
diff --git a/arch/openrisc/kernel/prom.c b/arch/openrisc/kernel/prom.c
index a63e76872f84..6a44340d1b18 100644
--- a/arch/openrisc/kernel/prom.c
+++ b/arch/openrisc/kernel/prom.c
@@ -18,83 +18,15 @@
18 * 18 *
19 */ 19 */
20 20
21#include <stdarg.h>
22#include <linux/kernel.h>
23#include <linux/string.h>
24#include <linux/init.h> 21#include <linux/init.h>
25#include <linux/threads.h>
26#include <linux/spinlock.h>
27#include <linux/types.h> 22#include <linux/types.h>
28#include <linux/pci.h>
29#include <linux/stringify.h>
30#include <linux/delay.h>
31#include <linux/initrd.h>
32#include <linux/bitops.h>
33#include <linux/module.h>
34#include <linux/kexec.h>
35#include <linux/debugfs.h>
36#include <linux/irq.h>
37#include <linux/memblock.h> 23#include <linux/memblock.h>
38#include <linux/of_fdt.h> 24#include <linux/of_fdt.h>
39 25
40#include <asm/prom.h>
41#include <asm/page.h> 26#include <asm/page.h>
42#include <asm/processor.h>
43#include <asm/irq.h>
44#include <linux/io.h>
45#include <asm/mmu.h>
46#include <asm/pgtable.h>
47#include <asm/sections.h>
48#include <asm/setup.h>
49
50extern char cmd_line[COMMAND_LINE_SIZE];
51
52void __init early_init_dt_add_memory_arch(u64 base, u64 size)
53{
54 size &= PAGE_MASK;
55 memblock_add(base, size);
56}
57 27
58void __init early_init_devtree(void *params) 28void __init early_init_devtree(void *params)
59{ 29{
60 void *alloc; 30 early_init_dt_scan(params);
61
62 /* Setup flat device-tree pointer */
63 initial_boot_params = params;
64
65
66 /* Retrieve various informations from the /chosen node of the
67 * device-tree, including the platform type, initrd location and
68 * size, TCE reserve, and more ...
69 */
70 of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line);
71
72 /* Scan memory nodes and rebuild MEMBLOCKs */
73 of_scan_flat_dt(early_init_dt_scan_root, NULL);
74 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
75
76 /* Save command line for /proc/cmdline and then parse parameters */
77 strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
78
79 memblock_allow_resize(); 31 memblock_allow_resize();
80
81 /* We must copy the flattend device tree from init memory to regular
82 * memory because the device tree references the strings in it
83 * directly.
84 */
85
86 alloc = __va(memblock_alloc(initial_boot_params->totalsize, PAGE_SIZE));
87
88 memcpy(alloc, initial_boot_params, initial_boot_params->totalsize);
89
90 initial_boot_params = alloc;
91}
92
93#ifdef CONFIG_BLK_DEV_INITRD
94void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
95{
96 initrd_start = (unsigned long)__va(start);
97 initrd_end = (unsigned long)__va(end);
98 initrd_below_start_ok = 1;
99} 32}
100#endif
diff --git a/arch/openrisc/kernel/setup.c b/arch/openrisc/kernel/setup.c
index d7359ffbcbdd..09a769b69572 100644
--- a/arch/openrisc/kernel/setup.c
+++ b/arch/openrisc/kernel/setup.c
@@ -50,8 +50,6 @@
50 50
51#include "vmlinux.h" 51#include "vmlinux.h"
52 52
53char __initdata cmd_line[COMMAND_LINE_SIZE] = CONFIG_CMDLINE;
54
55static unsigned long __init setup_memory(void) 53static unsigned long __init setup_memory(void)
56{ 54{
57 unsigned long bootmap_size; 55 unsigned long bootmap_size;
@@ -285,7 +283,7 @@ void __init setup_arch(char **cmdline_p)
285{ 283{
286 unsigned long max_low_pfn; 284 unsigned long max_low_pfn;
287 285
288 unflatten_device_tree(); 286 unflatten_and_copy_device_tree();
289 287
290 setup_cpuinfo(); 288 setup_cpuinfo();
291 289
@@ -316,7 +314,7 @@ void __init setup_arch(char **cmdline_p)
316 conswitchp = &dummy_con; 314 conswitchp = &dummy_con;
317#endif 315#endif
318 316
319 *cmdline_p = cmd_line; 317 *cmdline_p = boot_command_line;
320 318
321 printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n"); 319 printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n");
322} 320}
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index bf09e5a065b8..d977b9b78696 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -1,4 +1,3 @@
1#include <linux/of.h> /* linux/of.h gets to determine #include ordering */
2#ifndef _POWERPC_PROM_H 1#ifndef _POWERPC_PROM_H
3#define _POWERPC_PROM_H 2#define _POWERPC_PROM_H
4#ifdef __KERNEL__ 3#ifdef __KERNEL__
@@ -20,21 +19,17 @@
20#include <asm/irq.h> 19#include <asm/irq.h>
21#include <linux/atomic.h> 20#include <linux/atomic.h>
22 21
23#define HAVE_ARCH_DEVTREE_FIXUPS 22/* These includes should be removed once implicit includes are cleaned up. */
23#include <linux/of.h>
24#include <linux/of_fdt.h>
25#include <linux/of_address.h>
26#include <linux/of_irq.h>
27#include <linux/platform_device.h>
24 28
25/* 29/*
26 * OF address retreival & translation 30 * OF address retreival & translation
27 */ 31 */
28 32
29/* Translate a DMA address from device space to CPU space */
30extern u64 of_translate_dma_address(struct device_node *dev,
31 const __be32 *in_addr);
32
33#ifdef CONFIG_PCI
34extern unsigned long pci_address_to_pio(phys_addr_t address);
35#define pci_address_to_pio pci_address_to_pio
36#endif /* CONFIG_PCI */
37
38/* Parse the ibm,dma-window property of an OF node into the busno, phys and 33/* Parse the ibm,dma-window property of an OF node into the busno, phys and
39 * size parameters. 34 * size parameters.
40 */ 35 */
@@ -44,13 +39,6 @@ void of_parse_dma_window(struct device_node *dn, const __be32 *dma_window,
44 39
45extern void kdump_move_device_tree(void); 40extern void kdump_move_device_tree(void);
46 41
47#ifdef CONFIG_NUMA
48extern int of_node_to_nid(struct device_node *device);
49#else
50static inline int of_node_to_nid(struct device_node *device) { return 0; }
51#endif
52#define of_node_to_nid of_node_to_nid
53
54extern void of_instantiate_rtc(void); 42extern void of_instantiate_rtc(void);
55 43
56extern int of_get_ibm_chip_id(struct device_node *np); 44extern int of_get_ibm_chip_id(struct device_node *np);
@@ -140,14 +128,5 @@ struct of_drconf_cell {
140 */ 128 */
141extern unsigned char ibm_architecture_vec[]; 129extern unsigned char ibm_architecture_vec[];
142 130
143/* These includes are put at the bottom because they may contain things
144 * that are overridden by this file. Ideally they shouldn't be included
145 * by this file, but there are a bunch of .c files that currently depend
146 * on it. Eventually they will be cleaned up. */
147#include <linux/of_fdt.h>
148#include <linux/of_address.h>
149#include <linux/of_irq.h>
150#include <linux/platform_device.h>
151
152#endif /* __KERNEL__ */ 131#endif /* __KERNEL__ */
153#endif /* _POWERPC_PROM_H */ 132#endif /* _POWERPC_PROM_H */
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index 6300c13bbde4..7898be90f2dc 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_fdt.h>
21#include <asm/epapr_hcalls.h> 22#include <asm/epapr_hcalls.h>
22#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
23#include <asm/code-patching.h> 24#include <asm/code-patching.h>
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 905a24bb7acc..a1e3e40ca3fd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -228,7 +228,7 @@ int pcibios_add_platform_entries(struct pci_dev *pdev)
228 */ 228 */
229static int pci_read_irq_line(struct pci_dev *pci_dev) 229static int pci_read_irq_line(struct pci_dev *pci_dev)
230{ 230{
231 struct of_irq oirq; 231 struct of_phandle_args oirq;
232 unsigned int virq; 232 unsigned int virq;
233 233
234 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev)); 234 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev));
@@ -237,7 +237,7 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
237 memset(&oirq, 0xff, sizeof(oirq)); 237 memset(&oirq, 0xff, sizeof(oirq));
238#endif 238#endif
239 /* Try to get a mapping from the device-tree */ 239 /* Try to get a mapping from the device-tree */
240 if (of_irq_map_pci(pci_dev, &oirq)) { 240 if (of_irq_parse_pci(pci_dev, &oirq)) {
241 u8 line, pin; 241 u8 line, pin;
242 242
243 /* If that fails, lets fallback to what is in the config 243 /* If that fails, lets fallback to what is in the config
@@ -263,11 +263,10 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
263 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); 263 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW);
264 } else { 264 } else {
265 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 265 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n",
266 oirq.size, oirq.specifier[0], oirq.specifier[1], 266 oirq.args_count, oirq.args[0], oirq.args[1],
267 of_node_full_name(oirq.controller)); 267 of_node_full_name(oirq.np));
268 268
269 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 269 virq = irq_create_of_mapping(&oirq);
270 oirq.size);
271 } 270 }
272 if(virq == NO_IRQ) { 271 if(virq == NO_IRQ) {
273 pr_debug(" Failed to map !\n"); 272 pr_debug(" Failed to map !\n");
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 4432fd86a6d2..f3a47098fb8e 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -546,15 +546,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
546 memblock_add(base, size); 546 memblock_add(base, size);
547} 547}
548 548
549#ifdef CONFIG_BLK_DEV_INITRD
550void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
551{
552 initrd_start = (unsigned long)__va(start);
553 initrd_end = (unsigned long)__va(end);
554 initrd_below_start_ok = 1;
555}
556#endif
557
558static void __init early_reserve_mem_dt(void) 549static void __init early_reserve_mem_dt(void)
559{ 550{
560 unsigned long i, len, dt_root; 551 unsigned long i, len, dt_root;
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index e504166e089a..fd8a37653417 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -24,6 +24,7 @@
24#include <linux/mutex.h> 24#include <linux/mutex.h>
25#include <linux/io.h> 25#include <linux/io.h>
26 26
27#include <linux/of_address.h>
27#include <linux/of_platform.h> 28#include <linux/of_platform.h>
28#include <asm/mpc5xxx.h> 29#include <asm/mpc5xxx.h>
29#include <asm/mpc5121.h> 30#include <asm/mpc5121.h>
diff --git a/arch/powerpc/platforms/512x/pdm360ng.c b/arch/powerpc/platforms/512x/pdm360ng.c
index 24b314d7bd5f..116f2325b20b 100644
--- a/arch/powerpc/platforms/512x/pdm360ng.c
+++ b/arch/powerpc/platforms/512x/pdm360ng.c
@@ -14,6 +14,8 @@
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/of_address.h>
18#include <linux/of_fdt.h>
17#include <linux/of_platform.h> 19#include <linux/of_platform.h>
18 20
19#include <asm/machdep.h> 21#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index 30394b409b3f..6a14cf50f4a2 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -16,6 +16,8 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/interrupt.h> 17#include <linux/interrupt.h>
18#include <linux/fsl_devices.h> 18#include <linux/fsl_devices.h>
19#include <linux/of_address.h>
20#include <linux/of_fdt.h>
19#include <linux/of_platform.h> 21#include <linux/of_platform.h>
20#include <linux/io.h> 22#include <linux/io.h>
21 23
diff --git a/arch/powerpc/platforms/82xx/pq2fads.c b/arch/powerpc/platforms/82xx/pq2fads.c
index e1dceeec4994..e5f82ec8df17 100644
--- a/arch/powerpc/platforms/82xx/pq2fads.c
+++ b/arch/powerpc/platforms/82xx/pq2fads.c
@@ -15,6 +15,8 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/fsl_devices.h> 17#include <linux/fsl_devices.h>
18#include <linux/of_address.h>
19#include <linux/of_fdt.h>
18#include <linux/of_platform.h> 20#include <linux/of_platform.h>
19 21
20#include <asm/io.h> 22#include <asm/io.h>
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 1d769a29249f..3d9716ccd327 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -20,6 +20,8 @@
20#include <linux/freezer.h> 20#include <linux/freezer.h>
21#include <linux/suspend.h> 21#include <linux/suspend.h>
22#include <linux/fsl_devices.h> 22#include <linux/fsl_devices.h>
23#include <linux/of_address.h>
24#include <linux/of_irq.h>
23#include <linux/of_platform.h> 25#include <linux/of_platform.h>
24#include <linux/export.h> 26#include <linux/export.h>
25 27
diff --git a/arch/powerpc/platforms/85xx/c293pcie.c b/arch/powerpc/platforms/85xx/c293pcie.c
index 6208e49142bf..213d5b815827 100644
--- a/arch/powerpc/platforms/85xx/c293pcie.c
+++ b/arch/powerpc/platforms/85xx/c293pcie.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/stddef.h> 12#include <linux/stddef.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/of_fdt.h>
14#include <linux/of_platform.h> 15#include <linux/of_platform.h>
15 16
16#include <asm/machdep.h> 17#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index d0861a0d8360..eba78c85303f 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -5,6 +5,8 @@
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8
9#include <linux/of_irq.h>
8#include <linux/of_platform.h> 10#include <linux/of_platform.h>
9 11
10#include <sysdev/cpm2_pic.h> 12#include <sysdev/cpm2_pic.h>
diff --git a/arch/powerpc/platforms/85xx/ppa8548.c b/arch/powerpc/platforms/85xx/ppa8548.c
index 6a7704b92c3b..3daff7c63569 100644
--- a/arch/powerpc/platforms/85xx/ppa8548.c
+++ b/arch/powerpc/platforms/85xx/ppa8548.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/reboot.h> 20#include <linux/reboot.h>
21#include <linux/seq_file.h> 21#include <linux/seq_file.h>
22#include <linux/of_fdt.h>
22#include <linux/of_platform.h> 23#include <linux/of_platform.h>
23 24
24#include <asm/machdep.h> 25#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/85xx/sgy_cts1000.c b/arch/powerpc/platforms/85xx/sgy_cts1000.c
index 7179726ba5c5..b9197cea1854 100644
--- a/arch/powerpc/platforms/85xx/sgy_cts1000.c
+++ b/arch/powerpc/platforms/85xx/sgy_cts1000.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/of_gpio.h> 18#include <linux/of_gpio.h>
19#include <linux/of_irq.h>
19#include <linux/workqueue.h> 20#include <linux/workqueue.h>
20#include <linux/reboot.h> 21#include <linux/reboot.h>
21#include <linux/interrupt.h> 22#include <linux/interrupt.h>
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index 281b7f01df63..393f975ab397 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/of_address.h>
18#include <linux/kexec.h> 19#include <linux/kexec.h>
19#include <linux/highmem.h> 20#include <linux/highmem.h>
20#include <linux/cpu.h> 21#include <linux/cpu.h>
diff --git a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
index 3bbbf7489487..55a9682b9529 100644
--- a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
+++ b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
@@ -9,6 +9,8 @@
9 */ 9 */
10 10
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/of_address.h>
13#include <linux/of_irq.h>
12#include <linux/of_platform.h> 14#include <linux/of_platform.h>
13#include <linux/io.h> 15#include <linux/io.h>
14 16
diff --git a/arch/powerpc/platforms/86xx/pic.c b/arch/powerpc/platforms/86xx/pic.c
index 9982f57c98b9..d5b98c0f958a 100644
--- a/arch/powerpc/platforms/86xx/pic.c
+++ b/arch/powerpc/platforms/86xx/pic.c
@@ -10,6 +10,7 @@
10#include <linux/stddef.h> 10#include <linux/stddef.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/of_irq.h>
13#include <linux/of_platform.h> 14#include <linux/of_platform.h>
14 15
15#include <asm/mpic.h> 16#include <asm/mpic.h>
diff --git a/arch/powerpc/platforms/8xx/ep88xc.c b/arch/powerpc/platforms/8xx/ep88xc.c
index 7d9ac6040d63..e62166681d08 100644
--- a/arch/powerpc/platforms/8xx/ep88xc.c
+++ b/arch/powerpc/platforms/8xx/ep88xc.c
@@ -10,6 +10,8 @@
10 */ 10 */
11 11
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/of_address.h>
14#include <linux/of_fdt.h>
13#include <linux/of_platform.h> 15#include <linux/of_platform.h>
14 16
15#include <asm/machdep.h> 17#include <asm/machdep.h>
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
index 866feff83c91..63084640c5c5 100644
--- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c
@@ -15,6 +15,8 @@
15 */ 15 */
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/of_address.h>
19#include <linux/of_fdt.h>
18#include <linux/of_platform.h> 20#include <linux/of_platform.h>
19 21
20#include <asm/io.h> 22#include <asm/io.h>
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index 5d98398c2f5e..c1262581b63c 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -25,6 +25,8 @@
25#include <linux/fs_uart_pd.h> 25#include <linux/fs_uart_pd.h>
26#include <linux/fsl_devices.h> 26#include <linux/fsl_devices.h>
27#include <linux/mii.h> 27#include <linux/mii.h>
28#include <linux/of_address.h>
29#include <linux/of_fdt.h>
28#include <linux/of_platform.h> 30#include <linux/of_platform.h>
29 31
30#include <asm/delay.h> 32#include <asm/delay.h>
diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
index ef0778a0ca8f..251aba8759e4 100644
--- a/arch/powerpc/platforms/8xx/tqm8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
@@ -28,6 +28,7 @@
28#include <linux/fs_uart_pd.h> 28#include <linux/fs_uart_pd.h>
29#include <linux/fsl_devices.h> 29#include <linux/fsl_devices.h>
30#include <linux/mii.h> 30#include <linux/mii.h>
31#include <linux/of_fdt.h>
31#include <linux/of_platform.h> 32#include <linux/of_platform.h>
32 33
33#include <asm/delay.h> 34#include <asm/delay.h>
diff --git a/arch/powerpc/platforms/cell/celleb_scc_pciex.c b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
index 14be2bd358b8..4278acfa2ede 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_pciex.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_pciex.c
@@ -486,7 +486,6 @@ static __init int celleb_setup_pciex(struct device_node *node,
486 struct pci_controller *phb) 486 struct pci_controller *phb)
487{ 487{
488 struct resource r; 488 struct resource r;
489 struct of_irq oirq;
490 int virq; 489 int virq;
491 490
492 /* SMMIO registers; used inside this file */ 491 /* SMMIO registers; used inside this file */
@@ -507,12 +506,11 @@ static __init int celleb_setup_pciex(struct device_node *node,
507 phb->ops = &scc_pciex_pci_ops; 506 phb->ops = &scc_pciex_pci_ops;
508 507
509 /* internal interrupt handler */ 508 /* internal interrupt handler */
510 if (of_irq_map_one(node, 1, &oirq)) { 509 virq = irq_of_parse_and_map(node, 1);
510 if (!virq) {
511 pr_err("PCIEXC:Failed to map irq\n"); 511 pr_err("PCIEXC:Failed to map irq\n");
512 goto error; 512 goto error;
513 } 513 }
514 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
515 oirq.size);
516 if (request_irq(virq, pciex_handle_internal_irq, 514 if (request_irq(virq, pciex_handle_internal_irq,
517 0, "pciex", (void *)phb)) { 515 0, "pciex", (void *)phb)) {
518 pr_err("PCIEXC:Failed to request irq\n"); 516 pr_err("PCIEXC:Failed to request irq\n");
diff --git a/arch/powerpc/platforms/cell/celleb_scc_sio.c b/arch/powerpc/platforms/cell/celleb_scc_sio.c
index 9c339ec646f5..c8eb57193826 100644
--- a/arch/powerpc/platforms/cell/celleb_scc_sio.c
+++ b/arch/powerpc/platforms/cell/celleb_scc_sio.c
@@ -45,7 +45,7 @@ static int __init txx9_serial_init(void)
45 struct device_node *node; 45 struct device_node *node;
46 int i; 46 int i;
47 struct uart_port req; 47 struct uart_port req;
48 struct of_irq irq; 48 struct of_phandle_args irq;
49 struct resource res; 49 struct resource res;
50 50
51 for_each_compatible_node(node, "serial", "toshiba,sio-scc") { 51 for_each_compatible_node(node, "serial", "toshiba,sio-scc") {
@@ -53,7 +53,7 @@ static int __init txx9_serial_init(void)
53 if (!(txx9_serial_bitmap & (1<<i))) 53 if (!(txx9_serial_bitmap & (1<<i)))
54 continue; 54 continue;
55 55
56 if (of_irq_map_one(node, i, &irq)) 56 if (of_irq_parse_one(node, i, &irq))
57 continue; 57 continue;
58 if (of_address_to_resource(node, 58 if (of_address_to_resource(node,
59 txx9_scc_tab[i].index, &res)) 59 txx9_scc_tab[i].index, &res))
@@ -66,8 +66,7 @@ static int __init txx9_serial_init(void)
66#ifdef CONFIG_SERIAL_TXX9_CONSOLE 66#ifdef CONFIG_SERIAL_TXX9_CONSOLE
67 req.membase = ioremap(req.mapbase, 0x24); 67 req.membase = ioremap(req.mapbase, 0x24);
68#endif 68#endif
69 req.irq = irq_create_of_mapping(irq.controller, 69 req.irq = irq_create_of_mapping(&irq);
70 irq.specifier, irq.size);
71 req.flags |= UPF_IOREMAP | UPF_BUGGY_UART 70 req.flags |= UPF_IOREMAP | UPF_BUGGY_UART
72 /*HAVE_CTS_LINE*/; 71 /*HAVE_CTS_LINE*/;
73 req.uartclk = 83300000; 72 req.uartclk = 83300000;
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 8e299447127e..1f72f4ab6353 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -235,12 +235,9 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
235 /* First, we check whether we have a real "interrupts" in the device 235 /* First, we check whether we have a real "interrupts" in the device
236 * tree in case the device-tree is ever fixed 236 * tree in case the device-tree is ever fixed
237 */ 237 */
238 struct of_irq oirq; 238 virq = irq_of_parse_and_map(pic->host->of_node, 0);
239 if (of_irq_map_one(pic->host->of_node, 0, &oirq) == 0) { 239 if (virq)
240 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
241 oirq.size);
242 return virq; 240 return virq;
243 }
244 241
245 /* Now do the horrible hacks */ 242 /* Now do the horrible hacks */
246 tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL); 243 tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL);
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c
index 2bb6977c0a5a..c3327f3d8cf7 100644
--- a/arch/powerpc/platforms/cell/spu_manage.c
+++ b/arch/powerpc/platforms/cell/spu_manage.c
@@ -177,21 +177,20 @@ out:
177 177
178static int __init spu_map_interrupts(struct spu *spu, struct device_node *np) 178static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
179{ 179{
180 struct of_irq oirq; 180 struct of_phandle_args oirq;
181 int ret; 181 int ret;
182 int i; 182 int i;
183 183
184 for (i=0; i < 3; i++) { 184 for (i=0; i < 3; i++) {
185 ret = of_irq_map_one(np, i, &oirq); 185 ret = of_irq_parse_one(np, i, &oirq);
186 if (ret) { 186 if (ret) {
187 pr_debug("spu_new: failed to get irq %d\n", i); 187 pr_debug("spu_new: failed to get irq %d\n", i);
188 goto err; 188 goto err;
189 } 189 }
190 ret = -EINVAL; 190 ret = -EINVAL;
191 pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0], 191 pr_debug(" irq %d no 0x%x on %s\n", i, oirq.args[0],
192 oirq.controller->full_name); 192 oirq.np->full_name);
193 spu->irqs[i] = irq_create_of_mapping(oirq.controller, 193 spu->irqs[i] = irq_create_of_mapping(&oirq);
194 oirq.specifier, oirq.size);
195 if (spu->irqs[i] == NO_IRQ) { 194 if (spu->irqs[i] == NO_IRQ) {
196 pr_debug("spu_new: failed to map it !\n"); 195 pr_debug("spu_new: failed to map it !\n");
197 goto err; 196 goto err;
@@ -200,7 +199,7 @@ static int __init spu_map_interrupts(struct spu *spu, struct device_node *np)
200 return 0; 199 return 0;
201 200
202err: 201err:
203 pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier, 202 pr_debug("failed to map irq %x for spu %s\n", *oirq.args,
204 spu->name); 203 spu->name);
205 for (; i >= 0; i--) { 204 for (; i >= 0; i--) {
206 if (spu->irqs[i] != NO_IRQ) 205 if (spu->irqs[i] != NO_IRQ)
diff --git a/arch/powerpc/platforms/embedded6xx/flipper-pic.c b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
index 53d6eee01963..4cde8e7da4b8 100644
--- a/arch/powerpc/platforms/embedded6xx/flipper-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_address.h>
21#include <asm/io.h> 22#include <asm/io.h>
22 23
23#include "flipper-pic.h" 24#include "flipper-pic.h"
diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
index 6f61e21b3617..6c03034dbbd3 100644
--- a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -18,6 +18,8 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_address.h>
22#include <linux/of_irq.h>
21#include <asm/io.h> 23#include <asm/io.h>
22 24
23#include "hlwd-pic.h" 25#include "hlwd-pic.h"
diff --git a/arch/powerpc/platforms/fsl_uli1575.c b/arch/powerpc/platforms/fsl_uli1575.c
index 92ac9b52b32d..b97f6f3d3c5b 100644
--- a/arch/powerpc/platforms/fsl_uli1575.c
+++ b/arch/powerpc/platforms/fsl_uli1575.c
@@ -321,8 +321,7 @@ static void hpcd_final_uli5288(struct pci_dev *dev)
321{ 321{
322 struct pci_controller *hose = pci_bus_to_host(dev->bus); 322 struct pci_controller *hose = pci_bus_to_host(dev->bus);
323 struct device_node *hosenode = hose ? hose->dn : NULL; 323 struct device_node *hosenode = hose ? hose->dn : NULL;
324 struct of_irq oirq; 324 struct of_phandle_args oirq;
325 int virq, pin = 2;
326 u32 laddr[3]; 325 u32 laddr[3];
327 326
328 if (!machine_is(mpc86xx_hpcd)) 327 if (!machine_is(mpc86xx_hpcd))
@@ -331,12 +330,13 @@ static void hpcd_final_uli5288(struct pci_dev *dev)
331 if (!hosenode) 330 if (!hosenode)
332 return; 331 return;
333 332
333 oirq.np = hosenode;
334 oirq.args[0] = 2;
335 oirq.args_count = 1;
334 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8); 336 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8);
335 laddr[1] = laddr[2] = 0; 337 laddr[1] = laddr[2] = 0;
336 of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq); 338 of_irq_parse_raw(laddr, &oirq);
337 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 339 dev->irq = irq_create_of_mapping(&oirq);
338 oirq.size);
339 dev->irq = virq;
340} 340}
341 341
342DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575); 342DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575);
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 0237ab782fb8..15adee544638 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -30,6 +30,7 @@
30#include <linux/ioport.h> 30#include <linux/ioport.h>
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <linux/phy.h> 32#include <linux/phy.h>
33#include <linux/of_address.h>
33#include <linux/of_mdio.h> 34#include <linux/of_mdio.h>
34#include <linux/of_platform.h> 35#include <linux/of_platform.h>
35 36
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
index f5e3cda6660e..e49d07f3d542 100644
--- a/arch/powerpc/platforms/powermac/pfunc_base.c
+++ b/arch/powerpc/platforms/powermac/pfunc_base.c
@@ -4,6 +4,7 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/interrupt.h> 5#include <linux/interrupt.h>
6#include <linux/spinlock.h> 6#include <linux/spinlock.h>
7#include <linux/of_irq.h>
7 8
8#include <asm/pmac_feature.h> 9#include <asm/pmac_feature.h>
9#include <asm/pmac_pfunc.h> 10#include <asm/pmac_pfunc.h>
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 31036b56670e..4c24bf60d39d 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -393,8 +393,8 @@ static void __init pmac_pic_probe_oldstyle(void)
393#endif 393#endif
394} 394}
395 395
396int of_irq_map_oldworld(struct device_node *device, int index, 396int of_irq_parse_oldworld(struct device_node *device, int index,
397 struct of_irq *out_irq) 397 struct of_phandle_args *out_irq)
398{ 398{
399 const u32 *ints = NULL; 399 const u32 *ints = NULL;
400 int intlen; 400 int intlen;
@@ -422,9 +422,9 @@ int of_irq_map_oldworld(struct device_node *device, int index,
422 if (index >= intlen) 422 if (index >= intlen)
423 return -EINVAL; 423 return -EINVAL;
424 424
425 out_irq->controller = NULL; 425 out_irq->np = NULL;
426 out_irq->specifier[0] = ints[index]; 426 out_irq->args[0] = ints[index];
427 out_irq->size = 1; 427 out_irq->args_count = 1;
428 428
429 return 0; 429 return 0;
430} 430}
diff --git a/arch/powerpc/platforms/powernv/opal-lpc.c b/arch/powerpc/platforms/powernv/opal-lpc.c
index a7614bb14e17..e7e59e4f9892 100644
--- a/arch/powerpc/platforms/powernv/opal-lpc.c
+++ b/arch/powerpc/platforms/powernv/opal-lpc.c
@@ -17,6 +17,7 @@
17#include <asm/firmware.h> 17#include <asm/firmware.h>
18#include <asm/xics.h> 18#include <asm/xics.h>
19#include <asm/opal.h> 19#include <asm/opal.h>
20#include <asm/prom.h>
20 21
21static int opal_lpc_chip_id = -1; 22static int opal_lpc_chip_id = -1;
22 23
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index b56c243aaee9..1c798cd55372 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_fdt.h>
16#include <linux/of_platform.h> 17#include <linux/of_platform.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/notifier.h> 19#include <linux/notifier.h>
diff --git a/arch/powerpc/platforms/powernv/setup.c b/arch/powerpc/platforms/powernv/setup.c
index e239dcfa224c..19884b2a51b4 100644
--- a/arch/powerpc/platforms/powernv/setup.c
+++ b/arch/powerpc/platforms/powernv/setup.c
@@ -23,6 +23,7 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/seq_file.h> 24#include <linux/seq_file.h>
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/of_fdt.h>
26#include <linux/interrupt.h> 27#include <linux/interrupt.h>
27#include <linux/bug.h> 28#include <linux/bug.h>
28 29
diff --git a/arch/powerpc/platforms/pseries/event_sources.c b/arch/powerpc/platforms/pseries/event_sources.c
index 2605c310166a..18380e8f6dfe 100644
--- a/arch/powerpc/platforms/pseries/event_sources.c
+++ b/arch/powerpc/platforms/pseries/event_sources.c
@@ -25,7 +25,7 @@ void request_event_sources_irqs(struct device_node *np,
25 const char *name) 25 const char *name)
26{ 26{
27 int i, index, count = 0; 27 int i, index, count = 0;
28 struct of_irq oirq; 28 struct of_phandle_args oirq;
29 const u32 *opicprop; 29 const u32 *opicprop;
30 unsigned int opicplen; 30 unsigned int opicplen;
31 unsigned int virqs[16]; 31 unsigned int virqs[16];
@@ -55,13 +55,11 @@ void request_event_sources_irqs(struct device_node *np,
55 /* Else use normal interrupt tree parsing */ 55 /* Else use normal interrupt tree parsing */
56 else { 56 else {
57 /* First try to do a proper OF tree parsing */ 57 /* First try to do a proper OF tree parsing */
58 for (index = 0; of_irq_map_one(np, index, &oirq) == 0; 58 for (index = 0; of_irq_parse_one(np, index, &oirq) == 0;
59 index++) { 59 index++) {
60 if (count > 15) 60 if (count > 15)
61 break; 61 break;
62 virqs[count] = irq_create_of_mapping(oirq.controller, 62 virqs[count] = irq_create_of_mapping(&oirq);
63 oirq.specifier,
64 oirq.size);
65 if (virqs[count] == NO_IRQ) { 63 if (virqs[count] == NO_IRQ) {
66 pr_err("event-sources: Unable to allocate " 64 pr_err("event-sources: Unable to allocate "
67 "interrupt number for %s\n", 65 "interrupt number for %s\n",
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 9a432de363b8..9590dbb756f2 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -10,12 +10,14 @@
10 */ 10 */
11 11
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/of_address.h>
13#include <linux/memblock.h> 14#include <linux/memblock.h>
14#include <linux/vmalloc.h> 15#include <linux/vmalloc.h>
15#include <linux/memory.h> 16#include <linux/memory.h>
16 17
17#include <asm/firmware.h> 18#include <asm/firmware.h>
18#include <asm/machdep.h> 19#include <asm/machdep.h>
20#include <asm/prom.h>
19#include <asm/sparsemem.h> 21#include <asm/sparsemem.h>
20 22
21static unsigned long get_memblock_size(void) 23static unsigned long get_memblock_size(void)
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 4dd534194ae8..4f7869571290 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -22,6 +22,7 @@
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/export.h> 23#include <linux/export.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/of_address.h>
25#include <linux/slab.h> 26#include <linux/slab.h>
26 27
27#include <asm/udbg.h> 28#include <asm/udbg.h>
diff --git a/arch/powerpc/sysdev/ehv_pic.c b/arch/powerpc/sysdev/ehv_pic.c
index 9cd0e60716fe..b74085cea1af 100644
--- a/arch/powerpc/sysdev/ehv_pic.c
+++ b/arch/powerpc/sysdev/ehv_pic.c
@@ -19,6 +19,7 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_address.h>
22 23
23#include <asm/io.h> 24#include <asm/io.h>
24#include <asm/irq.h> 25#include <asm/irq.h>
diff --git a/arch/powerpc/sysdev/fsl_gtm.c b/arch/powerpc/sysdev/fsl_gtm.c
index 0eb871cc3437..06ac3c61b3d0 100644
--- a/arch/powerpc/sysdev/fsl_gtm.c
+++ b/arch/powerpc/sysdev/fsl_gtm.c
@@ -19,6 +19,8 @@
19#include <linux/list.h> 19#include <linux/list.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_address.h>
23#include <linux/of_irq.h>
22#include <linux/spinlock.h> 24#include <linux/spinlock.h>
23#include <linux/bitops.h> 25#include <linux/bitops.h>
24#include <linux/slab.h> 26#include <linux/slab.h>
@@ -401,16 +403,15 @@ static int __init fsl_gtm_init(void)
401 gtm->clock = *clock; 403 gtm->clock = *clock;
402 404
403 for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) { 405 for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) {
404 int ret; 406 unsigned int irq;
405 struct resource irq;
406 407
407 ret = of_irq_to_resource(np, i, &irq); 408 irq = irq_of_parse_and_map(np, i);
408 if (ret == NO_IRQ) { 409 if (irq == NO_IRQ) {
409 pr_err("%s: not enough interrupts specified\n", 410 pr_err("%s: not enough interrupts specified\n",
410 np->full_name); 411 np->full_name);
411 goto err; 412 goto err;
412 } 413 }
413 gtm->timers[i].irq = irq.start; 414 gtm->timers[i].irq = irq;
414 gtm->timers[i].gtm = gtm; 415 gtm->timers[i].gtm = gtm;
415 } 416 }
416 417
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c
index 592a0f8d527a..8cf4aa0e3a25 100644
--- a/arch/powerpc/sysdev/fsl_pmc.c
+++ b/arch/powerpc/sysdev/fsl_pmc.c
@@ -18,6 +18,7 @@
18#include <linux/suspend.h> 18#include <linux/suspend.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/device.h> 20#include <linux/device.h>
21#include <linux/of_address.h>
21#include <linux/of_platform.h> 22#include <linux/of_platform.h>
22 23
23struct pmc_regs { 24struct pmc_regs {
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index e2fb3171f41b..95dd892e9904 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -28,6 +28,8 @@
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/of_address.h>
32#include <linux/of_irq.h>
31#include <linux/of_platform.h> 33#include <linux/of_platform.h>
32#include <linux/delay.h> 34#include <linux/delay.h>
33#include <linux/slab.h> 35#include <linux/slab.h>
diff --git a/arch/powerpc/sysdev/fsl_rmu.c b/arch/powerpc/sysdev/fsl_rmu.c
index 14bd5221f28a..00e224a1048c 100644
--- a/arch/powerpc/sysdev/fsl_rmu.c
+++ b/arch/powerpc/sysdev/fsl_rmu.c
@@ -27,6 +27,7 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/dma-mapping.h> 28#include <linux/dma-mapping.h>
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/of_irq.h>
30#include <linux/of_platform.h> 31#include <linux/of_platform.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
32 33
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index bdcb8588e492..0e166ed4cd16 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -535,7 +535,7 @@ static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase,
535 mpic->fixups[irq].data = readl(base + 4) | 0x80000000; 535 mpic->fixups[irq].data = readl(base + 4) | 0x80000000;
536 } 536 }
537} 537}
538 538
539 539
540static void __init mpic_scan_ht_pics(struct mpic *mpic) 540static void __init mpic_scan_ht_pics(struct mpic *mpic)
541{ 541{
@@ -1481,7 +1481,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1481 * as a default instead of the value read from the HW. 1481 * as a default instead of the value read from the HW.
1482 */ 1482 */
1483 last_irq = (greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK) 1483 last_irq = (greg_feature & MPIC_GREG_FEATURE_LAST_SRC_MASK)
1484 >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT; 1484 >> MPIC_GREG_FEATURE_LAST_SRC_SHIFT;
1485 if (isu_size) 1485 if (isu_size)
1486 last_irq = isu_size * MPIC_MAX_ISU - 1; 1486 last_irq = isu_size * MPIC_MAX_ISU - 1;
1487 of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq); 1487 of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq);
@@ -1631,7 +1631,7 @@ void __init mpic_init(struct mpic *mpic)
1631 /* start with vector = source number, and masked */ 1631 /* start with vector = source number, and masked */
1632 u32 vecpri = MPIC_VECPRI_MASK | i | 1632 u32 vecpri = MPIC_VECPRI_MASK | i |
1633 (8 << MPIC_VECPRI_PRIORITY_SHIFT); 1633 (8 << MPIC_VECPRI_PRIORITY_SHIFT);
1634 1634
1635 /* check if protected */ 1635 /* check if protected */
1636 if (mpic->protected && test_bit(i, mpic->protected)) 1636 if (mpic->protected && test_bit(i, mpic->protected))
1637 continue; 1637 continue;
@@ -1640,7 +1640,7 @@ void __init mpic_init(struct mpic *mpic)
1640 mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu); 1640 mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu);
1641 } 1641 }
1642 } 1642 }
1643 1643
1644 /* Init spurious vector */ 1644 /* Init spurious vector */
1645 mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec); 1645 mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec);
1646 1646
diff --git a/arch/powerpc/sysdev/mpic_msgr.c b/arch/powerpc/sysdev/mpic_msgr.c
index c75325865a85..2c9b52aa266c 100644
--- a/arch/powerpc/sysdev/mpic_msgr.c
+++ b/arch/powerpc/sysdev/mpic_msgr.c
@@ -237,15 +237,13 @@ static int mpic_msgr_probe(struct platform_device *dev)
237 raw_spin_lock_init(&msgr->lock); 237 raw_spin_lock_init(&msgr->lock);
238 238
239 if (receive_mask & (1 << i)) { 239 if (receive_mask & (1 << i)) {
240 struct resource irq; 240 msgr->irq = irq_of_parse_and_map(np, irq_index);
241 241 if (msgr->irq == NO_IRQ) {
242 if (of_irq_to_resource(np, irq_index, &irq) == NO_IRQ) {
243 dev_err(&dev->dev, 242 dev_err(&dev->dev,
244 "Missing interrupt specifier"); 243 "Missing interrupt specifier");
245 kfree(msgr); 244 kfree(msgr);
246 return -EFAULT; 245 return -EFAULT;
247 } 246 }
248 msgr->irq = irq.start;
249 irq_index += 1; 247 irq_index += 1;
250 } else { 248 } else {
251 msgr->irq = NO_IRQ; 249 msgr->irq = NO_IRQ;
diff --git a/arch/powerpc/sysdev/mpic_msi.c b/arch/powerpc/sysdev/mpic_msi.c
index bbf342c88314..7dc39f35a4cc 100644
--- a/arch/powerpc/sysdev/mpic_msi.c
+++ b/arch/powerpc/sysdev/mpic_msi.c
@@ -35,7 +35,7 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
35 const struct irq_domain_ops *ops = mpic->irqhost->ops; 35 const struct irq_domain_ops *ops = mpic->irqhost->ops;
36 struct device_node *np; 36 struct device_node *np;
37 int flags, index, i; 37 int flags, index, i;
38 struct of_irq oirq; 38 struct of_phandle_args oirq;
39 39
40 pr_debug("mpic: found U3, guessing msi allocator setup\n"); 40 pr_debug("mpic: found U3, guessing msi allocator setup\n");
41 41
@@ -63,9 +63,9 @@ static int mpic_msi_reserve_u3_hwirqs(struct mpic *mpic)
63 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name); 63 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name);
64 64
65 index = 0; 65 index = 0;
66 while (of_irq_map_one(np, index++, &oirq) == 0) { 66 while (of_irq_parse_one(np, index++, &oirq) == 0) {
67 ops->xlate(mpic->irqhost, NULL, oirq.specifier, 67 ops->xlate(mpic->irqhost, NULL, oirq.args,
68 oirq.size, &hwirq, &flags); 68 oirq.args_count, &hwirq, &flags);
69 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq); 69 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq);
70 } 70 }
71 } 71 }
diff --git a/arch/powerpc/sysdev/mpic_timer.c b/arch/powerpc/sysdev/mpic_timer.c
index c06db92a4fb1..22d7d57eead9 100644
--- a/arch/powerpc/sysdev/mpic_timer.c
+++ b/arch/powerpc/sysdev/mpic_timer.c
@@ -19,7 +19,9 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/of.h> 21#include <linux/of.h>
22#include <linux/of_address.h>
22#include <linux/of_device.h> 23#include <linux/of_device.h>
24#include <linux/of_irq.h>
23#include <linux/syscore_ops.h> 25#include <linux/syscore_ops.h>
24#include <sysdev/fsl_soc.h> 26#include <sysdev/fsl_soc.h>
25#include <asm/io.h> 27#include <asm/io.h>
diff --git a/arch/powerpc/sysdev/of_rtc.c b/arch/powerpc/sysdev/of_rtc.c
index c9e803f3e267..6f54b54b1328 100644
--- a/arch/powerpc/sysdev/of_rtc.c
+++ b/arch/powerpc/sysdev/of_rtc.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/of.h> 12#include <linux/of.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/of_address.h>
14#include <linux/of_platform.h> 15#include <linux/of_platform.h>
15#include <linux/slab.h> 16#include <linux/slab.h>
16 17
diff --git a/arch/powerpc/sysdev/ppc4xx_ocm.c b/arch/powerpc/sysdev/ppc4xx_ocm.c
index 1b15f93479c3..b7c43453236d 100644
--- a/arch/powerpc/sysdev/ppc4xx_ocm.c
+++ b/arch/powerpc/sysdev/ppc4xx_ocm.c
@@ -26,6 +26,7 @@
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/of.h> 28#include <linux/of.h>
29#include <linux/of_address.h>
29#include <asm/rheap.h> 30#include <asm/rheap.h>
30#include <asm/ppc4xx_ocm.h> 31#include <asm/ppc4xx_ocm.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
diff --git a/arch/powerpc/sysdev/ppc4xx_soc.c b/arch/powerpc/sysdev/ppc4xx_soc.c
index 0debcc31ad70..5c77c9ba33aa 100644
--- a/arch/powerpc/sysdev/ppc4xx_soc.c
+++ b/arch/powerpc/sysdev/ppc4xx_soc.c
@@ -19,6 +19,7 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/of_irq.h>
22#include <linux/of_platform.h> 23#include <linux/of_platform.h>
23 24
24#include <asm/dcr.h> 25#include <asm/dcr.h>
diff --git a/arch/powerpc/sysdev/xilinx_intc.c b/arch/powerpc/sysdev/xilinx_intc.c
index 8d73c3c0bee6..83f943a8e0db 100644
--- a/arch/powerpc/sysdev/xilinx_intc.c
+++ b/arch/powerpc/sysdev/xilinx_intc.c
@@ -23,6 +23,8 @@
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/irq.h> 24#include <linux/irq.h>
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/of_address.h>
27#include <linux/of_irq.h>
26#include <asm/io.h> 28#include <asm/io.h>
27#include <asm/processor.h> 29#include <asm/processor.h>
28#include <asm/i8259.h> 30#include <asm/i8259.h>
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index 67c62578d170..11ebd659e7b6 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -43,10 +43,6 @@ extern int of_getintprop_default(struct device_node *np,
43 const char *name, 43 const char *name,
44 int def); 44 int def);
45extern int of_find_in_proplist(const char *list, const char *match, int len); 45extern int of_find_in_proplist(const char *list, const char *match, int len);
46#ifdef CONFIG_NUMA
47extern int of_node_to_nid(struct device_node *dp);
48#define of_node_to_nid of_node_to_nid
49#endif
50 46
51extern void prom_build_devicetree(void); 47extern void prom_build_devicetree(void);
52extern void of_populate_present_mask(void); 48extern void of_populate_present_mask(void);
@@ -63,13 +59,5 @@ extern char *of_console_options;
63extern void irq_trans_init(struct device_node *dp); 59extern void irq_trans_init(struct device_node *dp);
64extern char *build_path_component(struct device_node *dp); 60extern char *build_path_component(struct device_node *dp);
65 61
66/* SPARC has local implementations */
67extern int of_address_to_resource(struct device_node *dev, int index,
68 struct resource *r);
69#define of_address_to_resource of_address_to_resource
70
71void __iomem *of_iomap(struct device_node *node, int index);
72#define of_iomap of_iomap
73
74#endif /* __KERNEL__ */ 62#endif /* __KERNEL__ */
75#endif /* _SPARC_PROM_H */ 63#endif /* _SPARC_PROM_H */
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index d397d7fc5c28..6b39125eb927 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -373,6 +373,59 @@ static const char *get_mid_prop(void)
373 return (tlb_type == spitfire ? "upa-portid" : "portid"); 373 return (tlb_type == spitfire ? "upa-portid" : "portid");
374} 374}
375 375
376bool arch_find_n_match_cpu_physical_id(struct device_node *cpun,
377 int cpu, unsigned int *thread)
378{
379 const char *mid_prop = get_mid_prop();
380 int this_cpu_id;
381
382 /* On hypervisor based platforms we interrogate the 'reg'
383 * property. On everything else we look for a 'upa-portis',
384 * 'portid', or 'cpuid' property.
385 */
386
387 if (tlb_type == hypervisor) {
388 struct property *prop = of_find_property(cpun, "reg", NULL);
389 u32 *regs;
390
391 if (!prop) {
392 pr_warn("CPU node missing reg property\n");
393 return false;
394 }
395 regs = prop->value;
396 this_cpu_id = regs[0] & 0x0fffffff;
397 } else {
398 this_cpu_id = of_getintprop_default(cpun, mid_prop, -1);
399
400 if (this_cpu_id < 0) {
401 mid_prop = "cpuid";
402 this_cpu_id = of_getintprop_default(cpun, mid_prop, -1);
403 }
404 if (this_cpu_id < 0) {
405 pr_warn("CPU node missing cpu ID property\n");
406 return false;
407 }
408 }
409 if (this_cpu_id == cpu) {
410 if (thread) {
411 int proc_id = cpu_data(cpu).proc_id;
412
413 /* On sparc64, the cpu thread information is obtained
414 * either from OBP or the machine description. We've
415 * actually probed this information already long before
416 * this interface gets called so instead of interrogating
417 * both the OF node and the MDESC again, just use what
418 * we discovered already.
419 */
420 if (proc_id < 0)
421 proc_id = 0;
422 *thread = proc_id;
423 }
424 return true;
425 }
426 return false;
427}
428
376static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), int arg) 429static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), int arg)
377{ 430{
378 struct device_node *dp; 431 struct device_node *dp;
diff --git a/arch/x86/include/asm/prom.h b/arch/x86/include/asm/prom.h
index bade6ac3b14f..fbeb06ed0eaa 100644
--- a/arch/x86/include/asm/prom.h
+++ b/arch/x86/include/asm/prom.h
@@ -39,10 +39,5 @@ static inline void x86_dtb_init(void) { }
39 39
40extern char cmd_line[COMMAND_LINE_SIZE]; 40extern char cmd_line[COMMAND_LINE_SIZE];
41 41
42#define pci_address_to_pio pci_address_to_pio
43unsigned long pci_address_to_pio(phys_addr_t addr);
44
45#define HAVE_ARCH_DEVTREE_FIXUPS
46
47#endif /* __ASSEMBLY__ */ 42#endif /* __ASSEMBLY__ */
48#endif 43#endif
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 376dc7873447..d35078ea1446 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -20,22 +20,13 @@
20#include <asm/hpet.h> 20#include <asm/hpet.h>
21#include <asm/apic.h> 21#include <asm/apic.h>
22#include <asm/pci_x86.h> 22#include <asm/pci_x86.h>
23#include <asm/setup.h>
23 24
24__initdata u64 initial_dtb; 25__initdata u64 initial_dtb;
25char __initdata cmd_line[COMMAND_LINE_SIZE]; 26char __initdata cmd_line[COMMAND_LINE_SIZE];
26 27
27int __initdata of_ioapic; 28int __initdata of_ioapic;
28 29
29unsigned long pci_address_to_pio(phys_addr_t address)
30{
31 /*
32 * The ioport address can be directly used by inX / outX
33 */
34 BUG_ON(address >= (1 << 16));
35 return (unsigned long)address;
36}
37EXPORT_SYMBOL_GPL(pci_address_to_pio);
38
39void __init early_init_dt_scan_chosen_arch(unsigned long node) 30void __init early_init_dt_scan_chosen_arch(unsigned long node)
40{ 31{
41 BUG(); 32 BUG();
@@ -51,15 +42,6 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
51 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); 42 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
52} 43}
53 44
54#ifdef CONFIG_BLK_DEV_INITRD
55void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
56{
57 initrd_start = (unsigned long)__va(start);
58 initrd_end = (unsigned long)__va(end);
59 initrd_below_start_ok = 1;
60}
61#endif
62
63void __init add_dtb(u64 data) 45void __init add_dtb(u64 data)
64{ 46{
65 initial_dtb = data + offsetof(struct setup_data, data); 47 initial_dtb = data + offsetof(struct setup_data, data);
@@ -105,7 +87,6 @@ struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
105 87
106static int x86_of_pci_irq_enable(struct pci_dev *dev) 88static int x86_of_pci_irq_enable(struct pci_dev *dev)
107{ 89{
108 struct of_irq oirq;
109 u32 virq; 90 u32 virq;
110 int ret; 91 int ret;
111 u8 pin; 92 u8 pin;
@@ -116,12 +97,7 @@ static int x86_of_pci_irq_enable(struct pci_dev *dev)
116 if (!pin) 97 if (!pin)
117 return 0; 98 return 0;
118 99
119 ret = of_irq_map_pci(dev, &oirq); 100 virq = of_irq_parse_and_map_pci(dev, 0, 0);
120 if (ret)
121 return ret;
122
123 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
124 oirq.size);
125 if (virq == 0) 101 if (virq == 0)
126 return -EINVAL; 102 return -EINVAL;
127 dev->irq = virq; 103 dev->irq = virq;
@@ -230,7 +206,7 @@ static void __init dtb_apic_setup(void)
230static void __init x86_flattree_get_config(void) 206static void __init x86_flattree_get_config(void)
231{ 207{
232 u32 size, map_len; 208 u32 size, map_len;
233 void *new_dtb; 209 struct boot_param_header *dt;
234 210
235 if (!initial_dtb) 211 if (!initial_dtb)
236 return; 212 return;
@@ -238,24 +214,17 @@ static void __init x86_flattree_get_config(void)
238 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), 214 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK),
239 (u64)sizeof(struct boot_param_header)); 215 (u64)sizeof(struct boot_param_header));
240 216
241 initial_boot_params = early_memremap(initial_dtb, map_len); 217 dt = early_memremap(initial_dtb, map_len);
242 size = be32_to_cpu(initial_boot_params->totalsize); 218 size = be32_to_cpu(dt->totalsize);
243 if (map_len < size) { 219 if (map_len < size) {
244 early_iounmap(initial_boot_params, map_len); 220 early_iounmap(dt, map_len);
245 initial_boot_params = early_memremap(initial_dtb, size); 221 dt = early_memremap(initial_dtb, size);
246 map_len = size; 222 map_len = size;
247 } 223 }
248 224
249 new_dtb = alloc_bootmem(size); 225 initial_boot_params = dt;
250 memcpy(new_dtb, initial_boot_params, size); 226 unflatten_and_copy_device_tree();
251 early_iounmap(initial_boot_params, map_len); 227 early_iounmap(dt, map_len);
252
253 initial_boot_params = new_dtb;
254
255 /* root level address cells */
256 of_scan_flat_dt(early_init_dt_scan_root, NULL);
257
258 unflatten_device_tree();
259} 228}
260#else 229#else
261static inline void x86_flattree_get_config(void) { } 230static inline void x86_flattree_get_config(void) { }
diff --git a/arch/xtensa/include/asm/prom.h b/arch/xtensa/include/asm/prom.h
deleted file mode 100644
index f3d7cd2c0de7..000000000000
--- a/arch/xtensa/include/asm/prom.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _XTENSA_ASM_PROM_H
2#define _XTENSA_ASM_PROM_H
3
4#define HAVE_ARCH_DEVTREE_FIXUPS
5
6#endif /* _XTENSA_ASM_PROM_H */
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 946fb8d06c8b..6e2b6638122d 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -21,11 +21,8 @@
21#include <linux/screen_info.h> 21#include <linux/screen_info.h>
22#include <linux/bootmem.h> 22#include <linux/bootmem.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24
25#ifdef CONFIG_OF
26#include <linux/of_fdt.h> 24#include <linux/of_fdt.h>
27#include <linux/of_platform.h> 25#include <linux/of_platform.h>
28#endif
29 26
30#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 27#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
31# include <linux/console.h> 28# include <linux/console.h>
@@ -64,8 +61,8 @@ extern struct rtc_ops no_rtc_ops;
64struct rtc_ops *rtc_ops; 61struct rtc_ops *rtc_ops;
65 62
66#ifdef CONFIG_BLK_DEV_INITRD 63#ifdef CONFIG_BLK_DEV_INITRD
67extern void *initrd_start; 64extern unsigned long initrd_start;
68extern void *initrd_end; 65extern unsigned long initrd_end;
69int initrd_is_mapped = 0; 66int initrd_is_mapped = 0;
70extern int initrd_below_start_ok; 67extern int initrd_below_start_ok;
71#endif 68#endif
@@ -152,8 +149,8 @@ static int __init parse_tag_initrd(const bp_tag_t* tag)
152{ 149{
153 meminfo_t* mi; 150 meminfo_t* mi;
154 mi = (meminfo_t*)(tag->data); 151 mi = (meminfo_t*)(tag->data);
155 initrd_start = __va(mi->start); 152 initrd_start = (unsigned long)__va(mi->start);
156 initrd_end = __va(mi->end); 153 initrd_end = (unsigned long)__va(mi->end);
157 154
158 return 0; 155 return 0;
159} 156}
@@ -170,13 +167,6 @@ static int __init parse_tag_fdt(const bp_tag_t *tag)
170 167
171__tagtable(BP_TAG_FDT, parse_tag_fdt); 168__tagtable(BP_TAG_FDT, parse_tag_fdt);
172 169
173void __init early_init_dt_setup_initrd_arch(u64 start, u64 end)
174{
175 initrd_start = (void *)__va(start);
176 initrd_end = (void *)__va(end);
177 initrd_below_start_ok = 1;
178}
179
180#endif /* CONFIG_OF */ 170#endif /* CONFIG_OF */
181 171
182#endif /* CONFIG_BLK_DEV_INITRD */ 172#endif /* CONFIG_BLK_DEV_INITRD */
@@ -222,9 +212,13 @@ static int __init parse_bootparam(const bp_tag_t* tag)
222} 212}
223 213
224#ifdef CONFIG_OF 214#ifdef CONFIG_OF
215bool __initdata dt_memory_scan = false;
225 216
226void __init early_init_dt_add_memory_arch(u64 base, u64 size) 217void __init early_init_dt_add_memory_arch(u64 base, u64 size)
227{ 218{
219 if (!dt_memory_scan)
220 return;
221
228 size &= PAGE_MASK; 222 size &= PAGE_MASK;
229 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size); 223 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size);
230} 224}
@@ -236,31 +230,13 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
236 230
237void __init early_init_devtree(void *params) 231void __init early_init_devtree(void *params)
238{ 232{
239 /* Setup flat device-tree pointer */
240 initial_boot_params = params;
241
242 /* Retrieve various informations from the /chosen node of the
243 * device-tree, including the platform type, initrd location and
244 * size, TCE reserve, and more ...
245 */
246 if (!command_line[0])
247 of_scan_flat_dt(early_init_dt_scan_chosen, command_line);
248
249 /* Scan memory nodes and rebuild MEMBLOCKs */
250 of_scan_flat_dt(early_init_dt_scan_root, NULL);
251 if (sysmem.nr_banks == 0) 233 if (sysmem.nr_banks == 0)
252 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 234 dt_memory_scan = true;
253}
254 235
255static void __init copy_devtree(void) 236 early_init_dt_scan(params);
256{ 237
257 void *alloc = early_init_dt_alloc_memory_arch( 238 if (!command_line[0])
258 be32_to_cpu(initial_boot_params->totalsize), 8); 239 strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE);
259 if (alloc) {
260 memcpy(alloc, initial_boot_params,
261 be32_to_cpu(initial_boot_params->totalsize));
262 initial_boot_params = alloc;
263 }
264} 240}
265 241
266static int __init xtensa_device_probe(void) 242static int __init xtensa_device_probe(void)
@@ -525,10 +501,7 @@ void __init setup_arch(char **cmdline_p)
525 501
526 bootmem_init(); 502 bootmem_init();
527 503
528#ifdef CONFIG_OF 504 unflatten_and_copy_device_tree();
529 copy_devtree();
530 unflatten_device_tree();
531#endif
532 505
533 platform_setup(cmdline_p); 506 platform_setup(cmdline_p);
534 507