aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/arm/cpus.txt401
-rw-r--r--Documentation/devicetree/bindings/arm/topology.txt474
-rw-r--r--Documentation/devicetree/bindings/interrupt-controller/interrupts.txt29
-rw-r--r--Documentation/devicetree/bindings/vendor-prefixes.txt9
-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
-rw-r--r--drivers/ata/sata_dwc_460ex.c2
-rw-r--r--drivers/ata/sata_fsl.c2
-rw-r--r--drivers/char/bsr.c1
-rw-r--r--drivers/char/hw_random/pasemi-rng.c1
-rw-r--r--drivers/char/hw_random/ppc4xx-rng.c1
-rw-r--r--drivers/clk/clk-ppc-corenet.c1
-rw-r--r--drivers/cpufreq/pasemi-cpufreq.c1
-rw-r--r--drivers/crypto/amcc/crypto4xx_core.c3
-rw-r--r--drivers/crypto/caam/ctrl.c5
-rw-r--r--drivers/crypto/caam/jr.c4
-rw-r--r--drivers/crypto/omap-sham.c2
-rw-r--r--drivers/crypto/talitos.c2
-rw-r--r--drivers/dma/bestcomm/sram.c1
-rw-r--r--drivers/dma/fsldma.c2
-rw-r--r--drivers/dma/mpc512x_dma.c2
-rw-r--r--drivers/dma/ppc4xx/adma.c2
-rw-r--r--drivers/edac/cell_edac.c1
-rw-r--r--drivers/gpio/gpio-mpc8xxx.c1
-rw-r--r--drivers/i2c/busses/i2c-cpm.c2
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c2
-rw-r--r--drivers/i2c/busses/i2c-mpc.c2
-rw-r--r--drivers/i2c/busses/i2c-powermac.c1
-rw-r--r--drivers/input/serio/xilinx_ps2.c8
-rw-r--r--drivers/macintosh/macio_asic.c2
-rw-r--r--drivers/macintosh/rack-meter.c2
-rw-r--r--drivers/macintosh/smu.c1
-rw-r--r--drivers/macintosh/via-pmu.c2
-rw-r--r--drivers/media/platform/fsl-viu.c2
-rw-r--r--drivers/misc/carma/carma-fpga-program.c2
-rw-r--r--drivers/misc/carma/carma-fpga.c2
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c1
-rw-r--r--drivers/mtd/nand/fsl_ifc_nand.c1
-rw-r--r--drivers/mtd/nand/fsl_upm.c1
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c2
-rw-r--r--drivers/mtd/nand/ndfc.c1
-rw-r--r--drivers/mtd/nand/pasemi_nand.c2
-rw-r--r--drivers/mtd/nand/socrates_nand.c1
-rw-r--r--drivers/net/can/grcan.c3
-rw-r--r--drivers/net/can/sja1000/sja1000_of_platform.c1
-rw-r--r--drivers/net/ethernet/arc/emac_main.c10
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/mac-fcc.c4
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/mac-fec.c4
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/mac-scc.c4
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c1
-rw-r--r--drivers/net/ethernet/freescale/fs_enet/mii-fec.c1
-rw-r--r--drivers/net/ethernet/freescale/gianfar.c2
-rw-r--r--drivers/net/ethernet/freescale/ucc_geth.c2
-rw-r--r--drivers/net/ethernet/freescale/xgmac_mdio.c1
-rw-r--r--drivers/net/ethernet/ibm/emac/core.c2
-rw-r--r--drivers/net/ethernet/ibm/emac/mal.c1
-rw-r--r--drivers/net/ethernet/ibm/emac/rgmii.c1
-rw-r--r--drivers/net/ethernet/ibm/emac/tah.c1
-rw-r--r--drivers/net/ethernet/ibm/emac/zmii.c1
-rw-r--r--drivers/net/ethernet/xilinx/ll_temac_main.c1
-rw-r--r--drivers/of/Kconfig1
-rw-r--r--drivers/of/address.c18
-rw-r--r--drivers/of/base.c65
-rw-r--r--drivers/of/fdt.c138
-rw-r--r--drivers/of/irq.c164
-rw-r--r--drivers/of/of_pci.c1
-rw-r--r--drivers/of/of_pci_irq.c41
-rw-r--r--drivers/of/pdt.c1
-rw-r--r--drivers/of/platform.c2
-rw-r--r--drivers/of/selftest.c161
-rw-r--r--drivers/pci/host/pci-mvebu.c15
-rw-r--r--drivers/pcmcia/electra_cf.c2
-rw-r--r--drivers/pcmcia/m8xx_pcmcia.c2
-rw-r--r--drivers/rtc/rtc-mpc5121.c2
-rw-r--r--drivers/spi/spi-fsl-cpm.c1
-rw-r--r--drivers/spi/spi-fsl-espi.c8
-rw-r--r--drivers/spi/spi-mpc512x-psc.c1
-rw-r--r--drivers/spi/spi-ppc4xx.c2
-rw-r--r--drivers/tty/ehv_bytechan.c1
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_core.c4
-rw-r--r--drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c1
-rw-r--r--drivers/tty/serial/pmac_zilog.c2
-rw-r--r--drivers/tty/serial/ucc_uart.c2
-rw-r--r--drivers/usb/gadget/fsl_qe_udc.c1
-rw-r--r--drivers/usb/host/ehci-ppc-of.c2
-rw-r--r--drivers/usb/host/fhci-hcd.c2
-rw-r--r--drivers/usb/host/ohci-ppc-of.c2
-rw-r--r--drivers/video/fsl-diu-fb.c2
-rw-r--r--drivers/virt/fsl_hypervisor.c1
-rw-r--r--drivers/watchdog/gef_wdt.c1
-rw-r--r--drivers/watchdog/mpc8xxx_wdt.c1
-rw-r--r--drivers/watchdog/pika_wdt.c1
-rw-r--r--fs/proc/proc_devtree.c3
-rw-r--r--include/linux/cpu.h3
-rw-r--r--include/linux/of.h17
-rw-r--r--include/linux/of_address.h39
-rw-r--r--include/linux/of_fdt.h19
-rw-r--r--include/linux/of_irq.h47
-rw-r--r--include/linux/of_pci.h5
-rw-r--r--kernel/irq/irqdomain.c13
-rw-r--r--sound/aoa/core/gpio-feature.c3
-rw-r--r--sound/aoa/soundbus/i2sbus/core.c2
-rw-r--r--sound/ppc/pmac.c2
-rw-r--r--sound/ppc/tumbler.c1
-rw-r--r--sound/soc/fsl/fsl_dma.c2
-rw-r--r--sound/soc/fsl/mpc5200_dma.c2
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c2
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c1
-rw-r--r--sound/soc/fsl/p1022_ds.c1
-rw-r--r--sound/soc/fsl/p1022_rdk.c1
212 files changed, 1919 insertions, 1249 deletions
diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index f32494dbfe19..91304353eea4 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -1,77 +1,384 @@
1* ARM CPUs binding description 1=================
2ARM CPUs bindings
3=================
2 4
3The device tree allows to describe the layout of CPUs in a system through 5The device tree allows to describe the layout of CPUs in a system through
4the "cpus" node, which in turn contains a number of subnodes (ie "cpu") 6the "cpus" node, which in turn contains a number of subnodes (ie "cpu")
5defining properties for every cpu. 7defining properties for every cpu.
6 8
7Bindings for CPU nodes follow the ePAPR standard, available from: 9Bindings for CPU nodes follow the ePAPR v1.1 standard, available from:
8 10
9http://devicetree.org 11https://www.power.org/documentation/epapr-version-1-1/
10 12
11For the ARM architecture every CPU node must contain the following properties: 13with updates for 32-bit and 64-bit ARM systems provided in this document.
12 14
13- device_type: must be "cpu" 15================================
14- reg: property matching the CPU MPIDR[23:0] register bits 16Convention used in this document
15 reg[31:24] bits must be set to 0 17================================
16- compatible: should be one of: 18
17 "arm,arm1020" 19This document follows the conventions described in the ePAPR v1.1, with
18 "arm,arm1020e" 20the addition:
19 "arm,arm1022" 21
20 "arm,arm1026" 22- square brackets define bitfields, eg reg[7:0] value of the bitfield in
21 "arm,arm720" 23 the reg property contained in bits 7 down to 0
22 "arm,arm740" 24
23 "arm,arm7tdmi" 25=====================================
24 "arm,arm920" 26cpus and cpu node bindings definition
25 "arm,arm922" 27=====================================
26 "arm,arm925" 28
27 "arm,arm926" 29The ARM architecture, in accordance with the ePAPR, requires the cpus and cpu
28 "arm,arm940" 30nodes to be present and contain the properties described below.
29 "arm,arm946" 31
30 "arm,arm9tdmi" 32- cpus node
31 "arm,cortex-a5" 33
32 "arm,cortex-a7" 34 Description: Container of cpu nodes
33 "arm,cortex-a8" 35
34 "arm,cortex-a9" 36 The node name must be "cpus".
35 "arm,cortex-a15" 37
36 "arm,arm1136" 38 A cpus node must define the following properties:
37 "arm,arm1156" 39
38 "arm,arm1176" 40 - #address-cells
39 "arm,arm11mpcore" 41 Usage: required
40 "faraday,fa526" 42 Value type: <u32>
41 "intel,sa110" 43
42 "intel,sa1100" 44 Definition depends on ARM architecture version and
43 "marvell,feroceon" 45 configuration:
44 "marvell,mohawk" 46
45 "marvell,xsc3" 47 # On uniprocessor ARM architectures previous to v7
46 "marvell,xscale" 48 value must be 1, to enable a simple enumeration
47 49 scheme for processors that do not have a HW CPU
48Example: 50 identification register.
51 # On 32-bit ARM 11 MPcore, ARM v7 or later systems
52 value must be 1, that corresponds to CPUID/MPIDR
53 registers sizes.
54 # On ARM v8 64-bit systems value should be set to 2,
55 that corresponds to the MPIDR_EL1 register size.
56 If MPIDR_EL1[63:32] value is equal to 0 on all CPUs
57 in the system, #address-cells can be set to 1, since
58 MPIDR_EL1[63:32] bits are not used for CPUs
59 identification.
60 - #size-cells
61 Usage: required
62 Value type: <u32>
63 Definition: must be set to 0
64
65- cpu node
66
67 Description: Describes a CPU in an ARM based system
68
69 PROPERTIES
70
71 - device_type
72 Usage: required
73 Value type: <string>
74 Definition: must be "cpu"
75 - reg
76 Usage and definition depend on ARM architecture version and
77 configuration:
78
79 # On uniprocessor ARM architectures previous to v7
80 this property is required and must be set to 0.
81
82 # On ARM 11 MPcore based systems this property is
83 required and matches the CPUID[11:0] register bits.
84
85 Bits [11:0] in the reg cell must be set to
86 bits [11:0] in CPU ID register.
87
88 All other bits in the reg cell must be set to 0.
89
90 # On 32-bit ARM v7 or later systems this property is
91 required and matches the CPU MPIDR[23:0] register
92 bits.
93
94 Bits [23:0] in the reg cell must be set to
95 bits [23:0] in MPIDR.
96
97 All other bits in the reg cell must be set to 0.
98
99 # On ARM v8 64-bit systems this property is required
100 and matches the MPIDR_EL1 register affinity bits.
101
102 * If cpus node's #address-cells property is set to 2
103
104 The first reg cell bits [7:0] must be set to
105 bits [39:32] of MPIDR_EL1.
106
107 The second reg cell bits [23:0] must be set to
108 bits [23:0] of MPIDR_EL1.
109
110 * If cpus node's #address-cells property is set to 1
111
112 The reg cell bits [23:0] must be set to bits [23:0]
113 of MPIDR_EL1.
114
115 All other bits in the reg cells must be set to 0.
116
117 - compatible:
118 Usage: required
119 Value type: <string>
120 Definition: should be one of:
121 "arm,arm710t"
122 "arm,arm720t"
123 "arm,arm740t"
124 "arm,arm7ej-s"
125 "arm,arm7tdmi"
126 "arm,arm7tdmi-s"
127 "arm,arm9es"
128 "arm,arm9ej-s"
129 "arm,arm920t"
130 "arm,arm922t"
131 "arm,arm925"
132 "arm,arm926e-s"
133 "arm,arm926ej-s"
134 "arm,arm940t"
135 "arm,arm946e-s"
136 "arm,arm966e-s"
137 "arm,arm968e-s"
138 "arm,arm9tdmi"
139 "arm,arm1020e"
140 "arm,arm1020t"
141 "arm,arm1022e"
142 "arm,arm1026ej-s"
143 "arm,arm1136j-s"
144 "arm,arm1136jf-s"
145 "arm,arm1156t2-s"
146 "arm,arm1156t2f-s"
147 "arm,arm1176jzf"
148 "arm,arm1176jz-s"
149 "arm,arm1176jzf-s"
150 "arm,arm11mpcore"
151 "arm,cortex-a5"
152 "arm,cortex-a7"
153 "arm,cortex-a8"
154 "arm,cortex-a9"
155 "arm,cortex-a15"
156 "arm,cortex-a53"
157 "arm,cortex-a57"
158 "arm,cortex-m0"
159 "arm,cortex-m0+"
160 "arm,cortex-m1"
161 "arm,cortex-m3"
162 "arm,cortex-m4"
163 "arm,cortex-r4"
164 "arm,cortex-r5"
165 "arm,cortex-r7"
166 "faraday,fa526"
167 "intel,sa110"
168 "intel,sa1100"
169 "marvell,feroceon"
170 "marvell,mohawk"
171 "marvell,pj4a"
172 "marvell,pj4b"
173 "marvell,sheeva-v5"
174 "qcom,krait"
175 "qcom,scorpion"
176 - enable-method
177 Value type: <stringlist>
178 Usage and definition depend on ARM architecture version.
179 # On ARM v8 64-bit this property is required and must
180 be one of:
181 "spin-table"
182 "psci"
183 # On ARM 32-bit systems this property is optional.
184
185 - cpu-release-addr
186 Usage: required for systems that have an "enable-method"
187 property value of "spin-table".
188 Value type: <prop-encoded-array>
189 Definition:
190 # On ARM v8 64-bit systems must be a two cell
191 property identifying a 64-bit zero-initialised
192 memory location.
193
194Example 1 (dual-cluster big.LITTLE system 32-bit):
49 195
50 cpus { 196 cpus {
51 #size-cells = <0>; 197 #size-cells = <0>;
52 #address-cells = <1>; 198 #address-cells = <1>;
53 199
54 CPU0: cpu@0 { 200 cpu@0 {
55 device_type = "cpu"; 201 device_type = "cpu";
56 compatible = "arm,cortex-a15"; 202 compatible = "arm,cortex-a15";
57 reg = <0x0>; 203 reg = <0x0>;
58 }; 204 };
59 205
60 CPU1: cpu@1 { 206 cpu@1 {
61 device_type = "cpu"; 207 device_type = "cpu";
62 compatible = "arm,cortex-a15"; 208 compatible = "arm,cortex-a15";
63 reg = <0x1>; 209 reg = <0x1>;
64 }; 210 };
65 211
66 CPU2: cpu@100 { 212 cpu@100 {
67 device_type = "cpu"; 213 device_type = "cpu";
68 compatible = "arm,cortex-a7"; 214 compatible = "arm,cortex-a7";
69 reg = <0x100>; 215 reg = <0x100>;
70 }; 216 };
71 217
72 CPU3: cpu@101 { 218 cpu@101 {
73 device_type = "cpu"; 219 device_type = "cpu";
74 compatible = "arm,cortex-a7"; 220 compatible = "arm,cortex-a7";
75 reg = <0x101>; 221 reg = <0x101>;
76 }; 222 };
77 }; 223 };
224
225Example 2 (Cortex-A8 uniprocessor 32-bit system):
226
227 cpus {
228 #size-cells = <0>;
229 #address-cells = <1>;
230
231 cpu@0 {
232 device_type = "cpu";
233 compatible = "arm,cortex-a8";
234 reg = <0x0>;
235 };
236 };
237
238Example 3 (ARM 926EJ-S uniprocessor 32-bit system):
239
240 cpus {
241 #size-cells = <0>;
242 #address-cells = <1>;
243
244 cpu@0 {
245 device_type = "cpu";
246 compatible = "arm,arm926ej-s";
247 reg = <0x0>;
248 };
249 };
250
251Example 4 (ARM Cortex-A57 64-bit system):
252
253cpus {
254 #size-cells = <0>;
255 #address-cells = <2>;
256
257 cpu@0 {
258 device_type = "cpu";
259 compatible = "arm,cortex-a57";
260 reg = <0x0 0x0>;
261 enable-method = "spin-table";
262 cpu-release-addr = <0 0x20000000>;
263 };
264
265 cpu@1 {
266 device_type = "cpu";
267 compatible = "arm,cortex-a57";
268 reg = <0x0 0x1>;
269 enable-method = "spin-table";
270 cpu-release-addr = <0 0x20000000>;
271 };
272
273 cpu@100 {
274 device_type = "cpu";
275 compatible = "arm,cortex-a57";
276 reg = <0x0 0x100>;
277 enable-method = "spin-table";
278 cpu-release-addr = <0 0x20000000>;
279 };
280
281 cpu@101 {
282 device_type = "cpu";
283 compatible = "arm,cortex-a57";
284 reg = <0x0 0x101>;
285 enable-method = "spin-table";
286 cpu-release-addr = <0 0x20000000>;
287 };
288
289 cpu@10000 {
290 device_type = "cpu";
291 compatible = "arm,cortex-a57";
292 reg = <0x0 0x10000>;
293 enable-method = "spin-table";
294 cpu-release-addr = <0 0x20000000>;
295 };
296
297 cpu@10001 {
298 device_type = "cpu";
299 compatible = "arm,cortex-a57";
300 reg = <0x0 0x10001>;
301 enable-method = "spin-table";
302 cpu-release-addr = <0 0x20000000>;
303 };
304
305 cpu@10100 {
306 device_type = "cpu";
307 compatible = "arm,cortex-a57";
308 reg = <0x0 0x10100>;
309 enable-method = "spin-table";
310 cpu-release-addr = <0 0x20000000>;
311 };
312
313 cpu@10101 {
314 device_type = "cpu";
315 compatible = "arm,cortex-a57";
316 reg = <0x0 0x10101>;
317 enable-method = "spin-table";
318 cpu-release-addr = <0 0x20000000>;
319 };
320
321 cpu@100000000 {
322 device_type = "cpu";
323 compatible = "arm,cortex-a57";
324 reg = <0x1 0x0>;
325 enable-method = "spin-table";
326 cpu-release-addr = <0 0x20000000>;
327 };
328
329 cpu@100000001 {
330 device_type = "cpu";
331 compatible = "arm,cortex-a57";
332 reg = <0x1 0x1>;
333 enable-method = "spin-table";
334 cpu-release-addr = <0 0x20000000>;
335 };
336
337 cpu@100000100 {
338 device_type = "cpu";
339 compatible = "arm,cortex-a57";
340 reg = <0x1 0x100>;
341 enable-method = "spin-table";
342 cpu-release-addr = <0 0x20000000>;
343 };
344
345 cpu@100000101 {
346 device_type = "cpu";
347 compatible = "arm,cortex-a57";
348 reg = <0x1 0x101>;
349 enable-method = "spin-table";
350 cpu-release-addr = <0 0x20000000>;
351 };
352
353 cpu@100010000 {
354 device_type = "cpu";
355 compatible = "arm,cortex-a57";
356 reg = <0x1 0x10000>;
357 enable-method = "spin-table";
358 cpu-release-addr = <0 0x20000000>;
359 };
360
361 cpu@100010001 {
362 device_type = "cpu";
363 compatible = "arm,cortex-a57";
364 reg = <0x1 0x10001>;
365 enable-method = "spin-table";
366 cpu-release-addr = <0 0x20000000>;
367 };
368
369 cpu@100010100 {
370 device_type = "cpu";
371 compatible = "arm,cortex-a57";
372 reg = <0x1 0x10100>;
373 enable-method = "spin-table";
374 cpu-release-addr = <0 0x20000000>;
375 };
376
377 cpu@100010101 {
378 device_type = "cpu";
379 compatible = "arm,cortex-a57";
380 reg = <0x1 0x10101>;
381 enable-method = "spin-table";
382 cpu-release-addr = <0 0x20000000>;
383 };
384};
diff --git a/Documentation/devicetree/bindings/arm/topology.txt b/Documentation/devicetree/bindings/arm/topology.txt
new file mode 100644
index 000000000000..4aa20e7a424e
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/topology.txt
@@ -0,0 +1,474 @@
1===========================================
2ARM topology binding description
3===========================================
4
5===========================================
61 - Introduction
7===========================================
8
9In an ARM system, the hierarchy of CPUs is defined through three entities that
10are used to describe the layout of physical CPUs in the system:
11
12- cluster
13- core
14- thread
15
16The cpu nodes (bindings defined in [1]) represent the devices that
17correspond to physical CPUs and are to be mapped to the hierarchy levels.
18
19The bottom hierarchy level sits at core or thread level depending on whether
20symmetric multi-threading (SMT) is supported or not.
21
22For instance in a system where CPUs support SMT, "cpu" nodes represent all
23threads existing in the system and map to the hierarchy level "thread" above.
24In systems where SMT is not supported "cpu" nodes represent all cores present
25in the system and map to the hierarchy level "core" above.
26
27ARM topology bindings allow one to associate cpu nodes with hierarchical groups
28corresponding to the system hierarchy; syntactically they are defined as device
29tree nodes.
30
31The remainder of this document provides the topology bindings for ARM, based
32on the ePAPR standard, available from:
33
34http://www.power.org/documentation/epapr-version-1-1/
35
36If not stated otherwise, whenever a reference to a cpu node phandle is made its
37value must point to a cpu node compliant with the cpu node bindings as
38documented in [1].
39A topology description containing phandles to cpu nodes that are not compliant
40with bindings standardized in [1] is therefore considered invalid.
41
42===========================================
432 - cpu-map node
44===========================================
45
46The ARM CPU topology is defined within the cpu-map node, which is a direct
47child of the cpus node and provides a container where the actual topology
48nodes are listed.
49
50- cpu-map node
51
52 Usage: Optional - On ARM SMP systems provide CPUs topology to the OS.
53 ARM uniprocessor systems do not require a topology
54 description and therefore should not define a
55 cpu-map node.
56
57 Description: The cpu-map node is just a container node where its
58 subnodes describe the CPU topology.
59
60 Node name must be "cpu-map".
61
62 The cpu-map node's parent node must be the cpus node.
63
64 The cpu-map node's child nodes can be:
65
66 - one or more cluster nodes
67
68 Any other configuration is considered invalid.
69
70The cpu-map node can only contain three types of child nodes:
71
72- cluster node
73- core node
74- thread node
75
76whose bindings are described in paragraph 3.
77
78The nodes describing the CPU topology (cluster/core/thread) can only be
79defined within the cpu-map node.
80Any other configuration is consider invalid and therefore must be ignored.
81
82===========================================
832.1 - cpu-map child nodes naming convention
84===========================================
85
86cpu-map child nodes must follow a naming convention where the node name
87must be "clusterN", "coreN", "threadN" depending on the node type (ie
88cluster/core/thread) (where N = {0, 1, ...} is the node number; nodes which
89are siblings within a single common parent node must be given a unique and
90sequential N value, starting from 0).
91cpu-map child nodes which do not share a common parent node can have the same
92name (ie same number N as other cpu-map child nodes at different device tree
93levels) since name uniqueness will be guaranteed by the device tree hierarchy.
94
95===========================================
963 - cluster/core/thread node bindings
97===========================================
98
99Bindings for cluster/cpu/thread nodes are defined as follows:
100
101- cluster node
102
103 Description: must be declared within a cpu-map node, one node
104 per cluster. A system can contain several layers of
105 clustering and cluster nodes can be contained in parent
106 cluster nodes.
107
108 The cluster node name must be "clusterN" as described in 2.1 above.
109 A cluster node can not be a leaf node.
110
111 A cluster node's child nodes must be:
112
113 - one or more cluster nodes; or
114 - one or more core nodes
115
116 Any other configuration is considered invalid.
117
118- core node
119
120 Description: must be declared in a cluster node, one node per core in
121 the cluster. If the system does not support SMT, core
122 nodes are leaf nodes, otherwise they become containers of
123 thread nodes.
124
125 The core node name must be "coreN" as described in 2.1 above.
126
127 A core node must be a leaf node if SMT is not supported.
128
129 Properties for core nodes that are leaf nodes:
130
131 - cpu
132 Usage: required
133 Value type: <phandle>
134 Definition: a phandle to the cpu node that corresponds to the
135 core node.
136
137 If a core node is not a leaf node (CPUs supporting SMT) a core node's
138 child nodes can be:
139
140 - one or more thread nodes
141
142 Any other configuration is considered invalid.
143
144- thread node
145
146 Description: must be declared in a core node, one node per thread
147 in the core if the system supports SMT. Thread nodes are
148 always leaf nodes in the device tree.
149
150 The thread node name must be "threadN" as described in 2.1 above.
151
152 A thread node must be a leaf node.
153
154 A thread node must contain the following property:
155
156 - cpu
157 Usage: required
158 Value type: <phandle>
159 Definition: a phandle to the cpu node that corresponds to
160 the thread node.
161
162===========================================
1634 - Example dts
164===========================================
165
166Example 1 (ARM 64-bit, 16-cpu system, two clusters of clusters):
167
168cpus {
169 #size-cells = <0>;
170 #address-cells = <2>;
171
172 cpu-map {
173 cluster0 {
174 cluster0 {
175 core0 {
176 thread0 {
177 cpu = <&CPU0>;
178 };
179 thread1 {
180 cpu = <&CPU1>;
181 };
182 };
183
184 core1 {
185 thread0 {
186 cpu = <&CPU2>;
187 };
188 thread1 {
189 cpu = <&CPU3>;
190 };
191 };
192 };
193
194 cluster1 {
195 core0 {
196 thread0 {
197 cpu = <&CPU4>;
198 };
199 thread1 {
200 cpu = <&CPU5>;
201 };
202 };
203
204 core1 {
205 thread0 {
206 cpu = <&CPU6>;
207 };
208 thread1 {
209 cpu = <&CPU7>;
210 };
211 };
212 };
213 };
214
215 cluster1 {
216 cluster0 {
217 core0 {
218 thread0 {
219 cpu = <&CPU8>;
220 };
221 thread1 {
222 cpu = <&CPU9>;
223 };
224 };
225 core1 {
226 thread0 {
227 cpu = <&CPU10>;
228 };
229 thread1 {
230 cpu = <&CPU11>;
231 };
232 };
233 };
234
235 cluster1 {
236 core0 {
237 thread0 {
238 cpu = <&CPU12>;
239 };
240 thread1 {
241 cpu = <&CPU13>;
242 };
243 };
244 core1 {
245 thread0 {
246 cpu = <&CPU14>;
247 };
248 thread1 {
249 cpu = <&CPU15>;
250 };
251 };
252 };
253 };
254 };
255
256 CPU0: cpu@0 {
257 device_type = "cpu";
258 compatible = "arm,cortex-a57";
259 reg = <0x0 0x0>;
260 enable-method = "spin-table";
261 cpu-release-addr = <0 0x20000000>;
262 };
263
264 CPU1: cpu@1 {
265 device_type = "cpu";
266 compatible = "arm,cortex-a57";
267 reg = <0x0 0x1>;
268 enable-method = "spin-table";
269 cpu-release-addr = <0 0x20000000>;
270 };
271
272 CPU2: cpu@100 {
273 device_type = "cpu";
274 compatible = "arm,cortex-a57";
275 reg = <0x0 0x100>;
276 enable-method = "spin-table";
277 cpu-release-addr = <0 0x20000000>;
278 };
279
280 CPU3: cpu@101 {
281 device_type = "cpu";
282 compatible = "arm,cortex-a57";
283 reg = <0x0 0x101>;
284 enable-method = "spin-table";
285 cpu-release-addr = <0 0x20000000>;
286 };
287
288 CPU4: cpu@10000 {
289 device_type = "cpu";
290 compatible = "arm,cortex-a57";
291 reg = <0x0 0x10000>;
292 enable-method = "spin-table";
293 cpu-release-addr = <0 0x20000000>;
294 };
295
296 CPU5: cpu@10001 {
297 device_type = "cpu";
298 compatible = "arm,cortex-a57";
299 reg = <0x0 0x10001>;
300 enable-method = "spin-table";
301 cpu-release-addr = <0 0x20000000>;
302 };
303
304 CPU6: cpu@10100 {
305 device_type = "cpu";
306 compatible = "arm,cortex-a57";
307 reg = <0x0 0x10100>;
308 enable-method = "spin-table";
309 cpu-release-addr = <0 0x20000000>;
310 };
311
312 CPU7: cpu@10101 {
313 device_type = "cpu";
314 compatible = "arm,cortex-a57";
315 reg = <0x0 0x10101>;
316 enable-method = "spin-table";
317 cpu-release-addr = <0 0x20000000>;
318 };
319
320 CPU8: cpu@100000000 {
321 device_type = "cpu";
322 compatible = "arm,cortex-a57";
323 reg = <0x1 0x0>;
324 enable-method = "spin-table";
325 cpu-release-addr = <0 0x20000000>;
326 };
327
328 CPU9: cpu@100000001 {
329 device_type = "cpu";
330 compatible = "arm,cortex-a57";
331 reg = <0x1 0x1>;
332 enable-method = "spin-table";
333 cpu-release-addr = <0 0x20000000>;
334 };
335
336 CPU10: cpu@100000100 {
337 device_type = "cpu";
338 compatible = "arm,cortex-a57";
339 reg = <0x1 0x100>;
340 enable-method = "spin-table";
341 cpu-release-addr = <0 0x20000000>;
342 };
343
344 CPU11: cpu@100000101 {
345 device_type = "cpu";
346 compatible = "arm,cortex-a57";
347 reg = <0x1 0x101>;
348 enable-method = "spin-table";
349 cpu-release-addr = <0 0x20000000>;
350 };
351
352 CPU12: cpu@100010000 {
353 device_type = "cpu";
354 compatible = "arm,cortex-a57";
355 reg = <0x1 0x10000>;
356 enable-method = "spin-table";
357 cpu-release-addr = <0 0x20000000>;
358 };
359
360 CPU13: cpu@100010001 {
361 device_type = "cpu";
362 compatible = "arm,cortex-a57";
363 reg = <0x1 0x10001>;
364 enable-method = "spin-table";
365 cpu-release-addr = <0 0x20000000>;
366 };
367
368 CPU14: cpu@100010100 {
369 device_type = "cpu";
370 compatible = "arm,cortex-a57";
371 reg = <0x1 0x10100>;
372 enable-method = "spin-table";
373 cpu-release-addr = <0 0x20000000>;
374 };
375
376 CPU15: cpu@100010101 {
377 device_type = "cpu";
378 compatible = "arm,cortex-a57";
379 reg = <0x1 0x10101>;
380 enable-method = "spin-table";
381 cpu-release-addr = <0 0x20000000>;
382 };
383};
384
385Example 2 (ARM 32-bit, dual-cluster, 8-cpu system, no SMT):
386
387cpus {
388 #size-cells = <0>;
389 #address-cells = <1>;
390
391 cpu-map {
392 cluster0 {
393 core0 {
394 cpu = <&CPU0>;
395 };
396 core1 {
397 cpu = <&CPU1>;
398 };
399 core2 {
400 cpu = <&CPU2>;
401 };
402 core3 {
403 cpu = <&CPU3>;
404 };
405 };
406
407 cluster1 {
408 core0 {
409 cpu = <&CPU4>;
410 };
411 core1 {
412 cpu = <&CPU5>;
413 };
414 core2 {
415 cpu = <&CPU6>;
416 };
417 core3 {
418 cpu = <&CPU7>;
419 };
420 };
421 };
422
423 CPU0: cpu@0 {
424 device_type = "cpu";
425 compatible = "arm,cortex-a15";
426 reg = <0x0>;
427 };
428
429 CPU1: cpu@1 {
430 device_type = "cpu";
431 compatible = "arm,cortex-a15";
432 reg = <0x1>;
433 };
434
435 CPU2: cpu@2 {
436 device_type = "cpu";
437 compatible = "arm,cortex-a15";
438 reg = <0x2>;
439 };
440
441 CPU3: cpu@3 {
442 device_type = "cpu";
443 compatible = "arm,cortex-a15";
444 reg = <0x3>;
445 };
446
447 CPU4: cpu@100 {
448 device_type = "cpu";
449 compatible = "arm,cortex-a7";
450 reg = <0x100>;
451 };
452
453 CPU5: cpu@101 {
454 device_type = "cpu";
455 compatible = "arm,cortex-a7";
456 reg = <0x101>;
457 };
458
459 CPU6: cpu@102 {
460 device_type = "cpu";
461 compatible = "arm,cortex-a7";
462 reg = <0x102>;
463 };
464
465 CPU7: cpu@103 {
466 device_type = "cpu";
467 compatible = "arm,cortex-a7";
468 reg = <0x103>;
469 };
470};
471
472===============================================================================
473[1] ARM Linux kernel documentation
474 Documentation/devicetree/bindings/arm/cpus.txt
diff --git a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
index 72a06c0ab1db..1486497a24c1 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
@@ -4,16 +4,33 @@ Specifying interrupt information for devices
41) Interrupt client nodes 41) Interrupt client nodes
5------------------------- 5-------------------------
6 6
7Nodes that describe devices which generate interrupts must contain an 7Nodes that describe devices which generate interrupts must contain an either an
8"interrupts" property. This property must contain a list of interrupt 8"interrupts" property or an "interrupts-extended" property. These properties
9specifiers, one per output interrupt. The format of the interrupt specifier is 9contain a list of interrupt specifiers, one per output interrupt. The format of
10determined by the interrupt controller to which the interrupts are routed; see 10the interrupt specifier is determined by the interrupt controller to which the
11section 2 below for details. 11interrupts are routed; see section 2 below for details.
12
13 Example:
14 interrupt-parent = <&intc1>;
15 interrupts = <5 0>, <6 0>;
12 16
13The "interrupt-parent" property is used to specify the controller to which 17The "interrupt-parent" property is used to specify the controller to which
14interrupts are routed and contains a single phandle referring to the interrupt 18interrupts are routed and contains a single phandle referring to the interrupt
15controller node. This property is inherited, so it may be specified in an 19controller node. This property is inherited, so it may be specified in an
16interrupt client node or in any of its parent nodes. 20interrupt client node or in any of its parent nodes. Interrupts listed in the
21"interrupts" property are always in reference to the node's interrupt parent.
22
23The "interrupts-extended" property is a special form for use when a node needs
24to reference multiple interrupt parents. Each entry in this property contains
25both the parent phandle and the interrupt specifier. "interrupts-extended"
26should only be used when a device has multiple interrupt parents.
27
28 Example:
29 interrupts-extended = <&intc1 5 1>, <&intc2 1 0>;
30
31A device node may contain either "interrupts" or "interrupts-extended", but not
32both. If both properties are present, then the operating system should log an
33error and use only the data in "interrupts".
17 34
182) Interrupt controller nodes 352) Interrupt controller nodes
19----------------------------- 36-----------------------------
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
index 04eab45dd148..ce95ed1c6d3e 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -12,12 +12,15 @@ amcc Applied Micro Circuits Corporation (APM, formally AMCC)
12apm Applied Micro Circuits Corporation (APM) 12apm Applied Micro Circuits Corporation (APM)
13arm ARM Ltd. 13arm ARM Ltd.
14atmel Atmel Corporation 14atmel Atmel Corporation
15auo AU Optronics Corporation
15avago Avago Technologies 16avago Avago Technologies
16bosch Bosch Sensortec GmbH 17bosch Bosch Sensortec GmbH
17brcm Broadcom Corporation 18brcm Broadcom Corporation
18capella Capella Microsystems, Inc 19capella Capella Microsystems, Inc
19cavium Cavium, Inc. 20cavium Cavium, Inc.
21cdns Cadence Design Systems Inc.
20chrp Common Hardware Reference Platform 22chrp Common Hardware Reference Platform
23chunghwa Chunghwa Picture Tubes Ltd.
21cirrus Cirrus Logic, Inc. 24cirrus Cirrus Logic, Inc.
22cortina Cortina Systems, Inc. 25cortina Cortina Systems, Inc.
23dallas Maxim Integrated Products (formerly Dallas Semiconductor) 26dallas Maxim Integrated Products (formerly Dallas Semiconductor)
@@ -46,6 +49,8 @@ nintendo Nintendo
46nvidia NVIDIA 49nvidia NVIDIA
47nxp NXP Semiconductors 50nxp NXP Semiconductors
48onnn ON Semiconductor Corp. 51onnn ON Semiconductor Corp.
52panasonic Panasonic Corporation
53phytec PHYTEC Messtechnik GmbH
49picochip Picochip Ltd 54picochip Picochip Ltd
50powervr PowerVR (deprecated, use img) 55powervr PowerVR (deprecated, use img)
51qca Qualcomm Atheros, Inc. 56qca Qualcomm Atheros, Inc.
@@ -65,12 +70,12 @@ snps Synopsys, Inc.
65st STMicroelectronics 70st STMicroelectronics
66ste ST-Ericsson 71ste ST-Ericsson
67stericsson ST-Ericsson 72stericsson ST-Ericsson
68toumaz Toumaz
69ti Texas Instruments 73ti Texas Instruments
70toshiba Toshiba Corporation 74toshiba Toshiba Corporation
75toumaz Toumaz
71v3 V3 Semiconductor 76v3 V3 Semiconductor
72via VIA Technologies, Inc. 77via VIA Technologies, Inc.
78winbond Winbond Electronics corp.
73wlf Wolfson Microelectronics 79wlf Wolfson Microelectronics
74wm Wondermedia Technologies, Inc. 80wm Wondermedia Technologies, Inc.
75winbond Winbond Electronics corp.
76xlnx Xilinx 81xlnx Xilinx
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
diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
index 2e391730e8be..523524b68022 100644
--- a/drivers/ata/sata_dwc_460ex.c
+++ b/drivers/ata/sata_dwc_460ex.c
@@ -31,6 +31,8 @@
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/device.h> 33#include <linux/device.h>
34#include <linux/of_address.h>
35#include <linux/of_irq.h>
34#include <linux/of_platform.h> 36#include <linux/of_platform.h>
35#include <linux/platform_device.h> 37#include <linux/platform_device.h>
36#include <linux/libata.h> 38#include <linux/libata.h>
diff --git a/drivers/ata/sata_fsl.c b/drivers/ata/sata_fsl.c
index 851bd3f43ac6..fb0b40a191c2 100644
--- a/drivers/ata/sata_fsl.c
+++ b/drivers/ata/sata_fsl.c
@@ -24,6 +24,8 @@
24#include <scsi/scsi_cmnd.h> 24#include <scsi/scsi_cmnd.h>
25#include <linux/libata.h> 25#include <linux/libata.h>
26#include <asm/io.h> 26#include <asm/io.h>
27#include <linux/of_address.h>
28#include <linux/of_irq.h>
27#include <linux/of_platform.h> 29#include <linux/of_platform.h>
28 30
29static unsigned int intr_coalescing_count; 31static unsigned int intr_coalescing_count;
diff --git a/drivers/char/bsr.c b/drivers/char/bsr.c
index 0671e45daa57..8fedbc250414 100644
--- a/drivers/char/bsr.c
+++ b/drivers/char/bsr.c
@@ -21,6 +21,7 @@
21 21
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_address.h>
24#include <linux/of_device.h> 25#include <linux/of_device.h>
25#include <linux/of_platform.h> 26#include <linux/of_platform.h>
26#include <linux/fs.h> 27#include <linux/fs.h>
diff --git a/drivers/char/hw_random/pasemi-rng.c b/drivers/char/hw_random/pasemi-rng.c
index c6df5b29af08..c66279bb6ef3 100644
--- a/drivers/char/hw_random/pasemi-rng.c
+++ b/drivers/char/hw_random/pasemi-rng.c
@@ -24,6 +24,7 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/hw_random.h> 25#include <linux/hw_random.h>
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/of_address.h>
27#include <linux/of_platform.h> 28#include <linux/of_platform.h>
28#include <asm/io.h> 29#include <asm/io.h>
29 30
diff --git a/drivers/char/hw_random/ppc4xx-rng.c b/drivers/char/hw_random/ppc4xx-rng.c
index 732c330805fd..521f76b0934b 100644
--- a/drivers/char/hw_random/ppc4xx-rng.c
+++ b/drivers/char/hw_random/ppc4xx-rng.c
@@ -13,6 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/hw_random.h> 14#include <linux/hw_random.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/of_address.h>
16#include <linux/of_platform.h> 17#include <linux/of_platform.h>
17#include <asm/io.h> 18#include <asm/io.h>
18 19
diff --git a/drivers/clk/clk-ppc-corenet.c b/drivers/clk/clk-ppc-corenet.c
index e9587073bd32..c4f76ed914b0 100644
--- a/drivers/clk/clk-ppc-corenet.c
+++ b/drivers/clk/clk-ppc-corenet.c
@@ -11,6 +11,7 @@
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/of_address.h>
14#include <linux/of_platform.h> 15#include <linux/of_platform.h>
15#include <linux/of.h> 16#include <linux/of.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c
index 534e43a60d1f..f4ec8145b3d1 100644
--- a/drivers/cpufreq/pasemi-cpufreq.c
+++ b/drivers/cpufreq/pasemi-cpufreq.c
@@ -28,6 +28,7 @@
28#include <linux/cpufreq.h> 28#include <linux/cpufreq.h>
29#include <linux/timer.h> 29#include <linux/timer.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/of_address.h>
31 32
32#include <asm/hw_irq.h> 33#include <asm/hw_irq.h>
33#include <asm/io.h> 34#include <asm/io.h>
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index f88e3d8f6b64..efaf6302405f 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -27,6 +27,9 @@
27#include <linux/dma-mapping.h> 27#include <linux/dma-mapping.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/module.h>
31#include <linux/of_address.h>
32#include <linux/of_irq.h>
30#include <linux/of_platform.h> 33#include <linux/of_platform.h>
31#include <linux/slab.h> 34#include <linux/slab.h>
32#include <asm/dcr.h> 35#include <asm/dcr.h>
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index b010d42a1803..bc6d820812b6 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -5,6 +5,9 @@
5 * Copyright 2008-2012 Freescale Semiconductor, Inc. 5 * Copyright 2008-2012 Freescale Semiconductor, Inc.
6 */ 6 */
7 7
8#include <linux/of_address.h>
9#include <linux/of_irq.h>
10
8#include "compat.h" 11#include "compat.h"
9#include "regs.h" 12#include "regs.h"
10#include "intern.h" 13#include "intern.h"
@@ -224,7 +227,7 @@ static int caam_probe(struct platform_device *pdev)
224 topregs = (struct caam_full __iomem *)ctrl; 227 topregs = (struct caam_full __iomem *)ctrl;
225 228
226 /* Get the IRQ of the controller (for security violations only) */ 229 /* Get the IRQ of the controller (for security violations only) */
227 ctrlpriv->secvio_irq = of_irq_to_resource(nprop, 0, NULL); 230 ctrlpriv->secvio_irq = irq_of_parse_and_map(nprop, 0);
228 231
229 /* 232 /*
230 * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel, 233 * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel,
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index 105ba4da6180..bdb786d5a5e5 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -5,6 +5,8 @@
5 * Copyright 2008-2012 Freescale Semiconductor, Inc. 5 * Copyright 2008-2012 Freescale Semiconductor, Inc.
6 */ 6 */
7 7
8#include <linux/of_irq.h>
9
8#include "compat.h" 10#include "compat.h"
9#include "regs.h" 11#include "regs.h"
10#include "jr.h" 12#include "jr.h"
@@ -403,7 +405,7 @@ int caam_jr_probe(struct platform_device *pdev, struct device_node *np,
403 dma_set_mask(jrdev, DMA_BIT_MASK(32)); 405 dma_set_mask(jrdev, DMA_BIT_MASK(32));
404 406
405 /* Identify the interrupt */ 407 /* Identify the interrupt */
406 jrpriv->irq = of_irq_to_resource(np, 0, NULL); 408 jrpriv->irq = irq_of_parse_and_map(np, 0);
407 409
408 /* Now do the platform independent part */ 410 /* Now do the platform independent part */
409 error = caam_jr_init(jrdev); /* now turn on hardware */ 411 error = caam_jr_init(jrdev); /* now turn on hardware */
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 8bdde57f6bb1..e28104b4aab0 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -1818,7 +1818,7 @@ static int omap_sham_get_res_of(struct omap_sham_dev *dd,
1818 goto err; 1818 goto err;
1819 } 1819 }
1820 1820
1821 dd->irq = of_irq_to_resource(node, 0, NULL); 1821 dd->irq = irq_of_parse_and_map(node, 0);
1822 if (!dd->irq) { 1822 if (!dd->irq) {
1823 dev_err(dev, "can't translate OF irq value\n"); 1823 dev_err(dev, "can't translate OF irq value\n");
1824 err = -EINVAL; 1824 err = -EINVAL;
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 661dc3eb1d66..6cd0e6038583 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -32,6 +32,8 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/crypto.h> 33#include <linux/crypto.h>
34#include <linux/hw_random.h> 34#include <linux/hw_random.h>
35#include <linux/of_address.h>
36#include <linux/of_irq.h>
35#include <linux/of_platform.h> 37#include <linux/of_platform.h>
36#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
37#include <linux/io.h> 39#include <linux/io.h>
diff --git a/drivers/dma/bestcomm/sram.c b/drivers/dma/bestcomm/sram.c
index 5e2ed30ba2c4..2074e0e3fa21 100644
--- a/drivers/dma/bestcomm/sram.c
+++ b/drivers/dma/bestcomm/sram.c
@@ -19,6 +19,7 @@
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/ioport.h> 20#include <linux/ioport.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/mmu.h> 25#include <asm/mmu.h>
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index b3f3e90054f2..61517dd0d0b7 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -33,6 +33,8 @@
33#include <linux/delay.h> 33#include <linux/delay.h>
34#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
35#include <linux/dmapool.h> 35#include <linux/dmapool.h>
36#include <linux/of_address.h>
37#include <linux/of_irq.h>
36#include <linux/of_platform.h> 38#include <linux/of_platform.h>
37 39
38#include "dmaengine.h" 40#include "dmaengine.h"
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c
index 2fe435377333..448750da4402 100644
--- a/drivers/dma/mpc512x_dma.c
+++ b/drivers/dma/mpc512x_dma.c
@@ -39,7 +39,9 @@
39#include <linux/interrupt.h> 39#include <linux/interrupt.h>
40#include <linux/io.h> 40#include <linux/io.h>
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <linux/of_address.h>
42#include <linux/of_device.h> 43#include <linux/of_device.h>
44#include <linux/of_irq.h>
43#include <linux/of_platform.h> 45#include <linux/of_platform.h>
44 46
45#include <linux/random.h> 47#include <linux/random.h>
diff --git a/drivers/dma/ppc4xx/adma.c b/drivers/dma/ppc4xx/adma.c
index 370ff8265630..e24b5ef486b5 100644
--- a/drivers/dma/ppc4xx/adma.c
+++ b/drivers/dma/ppc4xx/adma.c
@@ -42,6 +42,8 @@
42#include <linux/uaccess.h> 42#include <linux/uaccess.h>
43#include <linux/proc_fs.h> 43#include <linux/proc_fs.h>
44#include <linux/of.h> 44#include <linux/of.h>
45#include <linux/of_address.h>
46#include <linux/of_irq.h>
45#include <linux/of_platform.h> 47#include <linux/of_platform.h>
46#include <asm/dcr.h> 48#include <asm/dcr.h>
47#include <asm/dcr-regs.h> 49#include <asm/dcr-regs.h>
diff --git a/drivers/edac/cell_edac.c b/drivers/edac/cell_edac.c
index c2eaf334b90b..9ee1c76da7b9 100644
--- a/drivers/edac/cell_edac.c
+++ b/drivers/edac/cell_edac.c
@@ -15,6 +15,7 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/stop_machine.h> 16#include <linux/stop_machine.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/of_address.h>
18#include <asm/machdep.h> 19#include <asm/machdep.h>
19#include <asm/cell-regs.h> 20#include <asm/cell-regs.h>
20 21
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index b350649b9764..914e859e3eda 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -14,6 +14,7 @@
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/of_gpio.h> 16#include <linux/of_gpio.h>
17#include <linux/of_irq.h>
17#include <linux/gpio.h> 18#include <linux/gpio.h>
18#include <linux/slab.h> 19#include <linux/slab.h>
19#include <linux/irq.h> 20#include <linux/irq.h>
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index b2b8aa9adc0e..3e5ea2c87a6e 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -447,7 +447,7 @@ static int cpm_i2c_setup(struct cpm_i2c *cpm)
447 447
448 init_waitqueue_head(&cpm->i2c_wait); 448 init_waitqueue_head(&cpm->i2c_wait);
449 449
450 cpm->irq = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 450 cpm->irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
451 if (!cpm->irq) 451 if (!cpm->irq)
452 return -EINVAL; 452 return -EINVAL;
453 453
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index ff3caa0c28cd..f7444100f397 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -41,6 +41,8 @@
41#include <asm/irq.h> 41#include <asm/irq.h>
42#include <linux/io.h> 42#include <linux/io.h>
43#include <linux/i2c.h> 43#include <linux/i2c.h>
44#include <linux/of_address.h>
45#include <linux/of_irq.h>
44#include <linux/of_platform.h> 46#include <linux/of_platform.h>
45 47
46#include "i2c-ibm_iic.h" 48#include "i2c-ibm_iic.h"
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index b80c76888cab..b6a741caf4f6 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -17,6 +17,8 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/sched.h> 18#include <linux/sched.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/of_address.h>
21#include <linux/of_irq.h>
20#include <linux/of_platform.h> 22#include <linux/of_platform.h>
21#include <linux/slab.h> 23#include <linux/slab.h>
22 24
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
index 37e8cfad625b..8c87f4a9793b 100644
--- a/drivers/i2c/busses/i2c-powermac.c
+++ b/drivers/i2c/busses/i2c-powermac.c
@@ -27,6 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/of_irq.h>
30#include <asm/prom.h> 31#include <asm/prom.h>
31#include <asm/pmac_low_i2c.h> 32#include <asm/pmac_low_i2c.h>
32 33
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index 4b7662a17ae9..dfbcd872f95e 100644
--- a/drivers/input/serio/xilinx_ps2.c
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -25,6 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/of_address.h> 26#include <linux/of_address.h>
27#include <linux/of_device.h> 27#include <linux/of_device.h>
28#include <linux/of_irq.h>
28#include <linux/of_platform.h> 29#include <linux/of_platform.h>
29 30
30#define DRIVER_NAME "xilinx_ps2" 31#define DRIVER_NAME "xilinx_ps2"
@@ -235,12 +236,12 @@ static void sxps2_close(struct serio *pserio)
235 */ 236 */
236static int xps2_of_probe(struct platform_device *ofdev) 237static int xps2_of_probe(struct platform_device *ofdev)
237{ 238{
238 struct resource r_irq; /* Interrupt resources */
239 struct resource r_mem; /* IO mem resources */ 239 struct resource r_mem; /* IO mem resources */
240 struct xps2data *drvdata; 240 struct xps2data *drvdata;
241 struct serio *serio; 241 struct serio *serio;
242 struct device *dev = &ofdev->dev; 242 struct device *dev = &ofdev->dev;
243 resource_size_t remap_size, phys_addr; 243 resource_size_t remap_size, phys_addr;
244 unsigned int irq;
244 int error; 245 int error;
245 246
246 dev_info(dev, "Device Tree Probing \'%s\'\n", 247 dev_info(dev, "Device Tree Probing \'%s\'\n",
@@ -254,7 +255,8 @@ static int xps2_of_probe(struct platform_device *ofdev)
254 } 255 }
255 256
256 /* Get IRQ for the device */ 257 /* Get IRQ for the device */
257 if (!of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq)) { 258 irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
259 if (!irq) {
258 dev_err(dev, "no IRQ found\n"); 260 dev_err(dev, "no IRQ found\n");
259 return -ENODEV; 261 return -ENODEV;
260 } 262 }
@@ -267,7 +269,7 @@ static int xps2_of_probe(struct platform_device *ofdev)
267 } 269 }
268 270
269 spin_lock_init(&drvdata->lock); 271 spin_lock_init(&drvdata->lock);
270 drvdata->irq = r_irq.start; 272 drvdata->irq = irq;
271 drvdata->serio = serio; 273 drvdata->serio = serio;
272 drvdata->dev = dev; 274 drvdata->dev = dev;
273 275
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index ac5c87939860..4f12c6f01fe7 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -24,6 +24,8 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/of_address.h>
28#include <linux/of_irq.h>
27 29
28#include <asm/machdep.h> 30#include <asm/machdep.h>
29#include <asm/macio.h> 31#include <asm/macio.h>
diff --git a/drivers/macintosh/rack-meter.c b/drivers/macintosh/rack-meter.c
index cad0e19b47a2..4192901cab40 100644
--- a/drivers/macintosh/rack-meter.c
+++ b/drivers/macintosh/rack-meter.c
@@ -25,6 +25,8 @@
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/kernel_stat.h> 27#include <linux/kernel_stat.h>
28#include <linux/of_address.h>
29#include <linux/of_irq.h>
28 30
29#include <asm/io.h> 31#include <asm/io.h>
30#include <asm/prom.h> 32#include <asm/prom.h>
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index b3b2d36c009e..23b4a3b28dbc 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -35,6 +35,7 @@
35#include <linux/poll.h> 35#include <linux/poll.h>
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37#include <linux/of_device.h> 37#include <linux/of_device.h>
38#include <linux/of_irq.h>
38#include <linux/of_platform.h> 39#include <linux/of_platform.h>
39#include <linux/slab.h> 40#include <linux/slab.h>
40 41
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 283e1b53c6be..dee88e59f0d3 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -46,6 +46,8 @@
46#include <linux/suspend.h> 46#include <linux/suspend.h>
47#include <linux/cpu.h> 47#include <linux/cpu.h>
48#include <linux/compat.h> 48#include <linux/compat.h>
49#include <linux/of_address.h>
50#include <linux/of_irq.h>
49#include <asm/prom.h> 51#include <asm/prom.h>
50#include <asm/machdep.h> 52#include <asm/machdep.h>
51#include <asm/io.h> 53#include <asm/io.h>
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index fe9898ca3c84..6a232239ee8c 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -21,6 +21,8 @@
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/of_address.h>
25#include <linux/of_irq.h>
24#include <linux/of_platform.h> 26#include <linux/of_platform.h>
25#include <linux/slab.h> 27#include <linux/slab.h>
26#include <media/v4l2-common.h> 28#include <media/v4l2-common.h>
diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c
index c6bd7e84de24..7be89832db19 100644
--- a/drivers/misc/carma/carma-fpga-program.c
+++ b/drivers/misc/carma/carma-fpga-program.c
@@ -10,6 +10,8 @@
10 */ 10 */
11 11
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/of_address.h>
14#include <linux/of_irq.h>
13#include <linux/of_platform.h> 15#include <linux/of_platform.h>
14#include <linux/completion.h> 16#include <linux/completion.h>
15#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
diff --git a/drivers/misc/carma/carma-fpga.c b/drivers/misc/carma/carma-fpga.c
index 7b56563f8b74..08b18f3f5264 100644
--- a/drivers/misc/carma/carma-fpga.c
+++ b/drivers/misc/carma/carma-fpga.c
@@ -88,6 +88,8 @@
88 * interrupt source to the GPIO pin. Tada, we hid the interrupt. :) 88 * interrupt source to the GPIO pin. Tada, we hid the interrupt. :)
89 */ 89 */
90 90
91#include <linux/of_address.h>
92#include <linux/of_irq.h>
91#include <linux/of_platform.h> 93#include <linux/of_platform.h>
92#include <linux/dma-mapping.h> 94#include <linux/dma-mapping.h>
93#include <linux/miscdevice.h> 95#include <linux/miscdevice.h>
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 20657209a472..e59c8860f472 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -28,6 +28,7 @@
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <linux/string.h> 29#include <linux/string.h>
30#include <linux/ioport.h> 30#include <linux/ioport.h>
31#include <linux/of_address.h>
31#include <linux/of_platform.h> 32#include <linux/of_platform.h>
32#include <linux/platform_device.h> 33#include <linux/platform_device.h>
33#include <linux/slab.h> 34#include <linux/slab.h>
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 317a771f1587..2730c78d2bf8 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -24,6 +24,7 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/kernel.h> 26#include <linux/kernel.h>
27#include <linux/of_address.h>
27#include <linux/slab.h> 28#include <linux/slab.h>
28#include <linux/mtd/mtd.h> 29#include <linux/mtd/mtd.h>
29#include <linux/mtd/nand.h> 30#include <linux/mtd/nand.h>
diff --git a/drivers/mtd/nand/fsl_upm.c b/drivers/mtd/nand/fsl_upm.c
index 04e07252d74b..4d203e84e8ca 100644
--- a/drivers/mtd/nand/fsl_upm.c
+++ b/drivers/mtd/nand/fsl_upm.c
@@ -18,6 +18,7 @@
18#include <linux/mtd/nand_ecc.h> 18#include <linux/mtd/nand_ecc.h>
19#include <linux/mtd/partitions.h> 19#include <linux/mtd/partitions.h>
20#include <linux/mtd/mtd.h> 20#include <linux/mtd/mtd.h>
21#include <linux/of_address.h>
21#include <linux/of_platform.h> 22#include <linux/of_platform.h>
22#include <linux/of_gpio.h> 23#include <linux/of_gpio.h>
23#include <linux/io.h> 24#include <linux/io.h>
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 3c60a000b426..439bc3896418 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -36,7 +36,9 @@
36#include <linux/mtd/mtd.h> 36#include <linux/mtd/mtd.h>
37#include <linux/mtd/nand.h> 37#include <linux/mtd/nand.h>
38#include <linux/mtd/partitions.h> 38#include <linux/mtd/partitions.h>
39#include <linux/of_address.h>
39#include <linux/of_device.h> 40#include <linux/of_device.h>
41#include <linux/of_irq.h>
40#include <linux/of_platform.h> 42#include <linux/of_platform.h>
41 43
42#include <asm/mpc5121.h> 44#include <asm/mpc5121.h>
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index 8e148f1478fd..69eaba690a99 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -30,6 +30,7 @@
30#include <linux/mtd/ndfc.h> 30#include <linux/mtd/ndfc.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/mtd/mtd.h> 32#include <linux/mtd/mtd.h>
33#include <linux/of_address.h>
33#include <linux/of_platform.h> 34#include <linux/of_platform.h>
34#include <asm/io.h> 35#include <asm/io.h>
35 36
diff --git a/drivers/mtd/nand/pasemi_nand.c b/drivers/mtd/nand/pasemi_nand.c
index 5a67082c07ee..4d174366a0f0 100644
--- a/drivers/mtd/nand/pasemi_nand.c
+++ b/drivers/mtd/nand/pasemi_nand.c
@@ -28,6 +28,8 @@
28#include <linux/mtd/mtd.h> 28#include <linux/mtd/mtd.h>
29#include <linux/mtd/nand.h> 29#include <linux/mtd/nand.h>
30#include <linux/mtd/nand_ecc.h> 30#include <linux/mtd/nand_ecc.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/platform_device.h> 34#include <linux/platform_device.h>
33#include <linux/pci.h> 35#include <linux/pci.h>
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c
index 09dde7d27178..49bd9155cb19 100644
--- a/drivers/mtd/nand/socrates_nand.c
+++ b/drivers/mtd/nand/socrates_nand.c
@@ -15,6 +15,7 @@
15#include <linux/mtd/mtd.h> 15#include <linux/mtd/mtd.h>
16#include <linux/mtd/nand.h> 16#include <linux/mtd/nand.h>
17#include <linux/mtd/partitions.h> 17#include <linux/mtd/partitions.h>
18#include <linux/of_address.h>
18#include <linux/of_platform.h> 19#include <linux/of_platform.h>
19#include <linux/io.h> 20#include <linux/io.h>
20 21
diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c
index 6aa737a24393..ab506d6cab37 100644
--- a/drivers/net/can/grcan.c
+++ b/drivers/net/can/grcan.c
@@ -34,10 +34,7 @@
34#include <linux/io.h> 34#include <linux/io.h>
35#include <linux/can/dev.h> 35#include <linux/can/dev.h>
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37
38#include <linux/of_platform.h> 37#include <linux/of_platform.h>
39#include <asm/prom.h>
40
41#include <linux/of_irq.h> 38#include <linux/of_irq.h>
42 39
43#include <linux/dma-mapping.h> 40#include <linux/dma-mapping.h>
diff --git a/drivers/net/can/sja1000/sja1000_of_platform.c b/drivers/net/can/sja1000/sja1000_of_platform.c
index 31ad33911167..047accd4ede5 100644
--- a/drivers/net/can/sja1000/sja1000_of_platform.c
+++ b/drivers/net/can/sja1000/sja1000_of_platform.c
@@ -44,7 +44,6 @@
44#include <linux/of_platform.h> 44#include <linux/of_platform.h>
45#include <linux/of_address.h> 45#include <linux/of_address.h>
46#include <linux/of_irq.h> 46#include <linux/of_irq.h>
47#include <asm/prom.h>
48 47
49#include "sja1000.h" 48#include "sja1000.h"
50 49
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index 9e1601487263..d0878526c0c8 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -628,12 +628,12 @@ static const struct net_device_ops arc_emac_netdev_ops = {
628 628
629static int arc_emac_probe(struct platform_device *pdev) 629static int arc_emac_probe(struct platform_device *pdev)
630{ 630{
631 struct resource res_regs, res_irq; 631 struct resource res_regs;
632 struct device_node *phy_node; 632 struct device_node *phy_node;
633 struct arc_emac_priv *priv; 633 struct arc_emac_priv *priv;
634 struct net_device *ndev; 634 struct net_device *ndev;
635 const char *mac_addr; 635 const char *mac_addr;
636 unsigned int id, clock_frequency; 636 unsigned int id, clock_frequency, irq;
637 int err; 637 int err;
638 638
639 if (!pdev->dev.of_node) 639 if (!pdev->dev.of_node)
@@ -661,8 +661,8 @@ static int arc_emac_probe(struct platform_device *pdev)
661 } 661 }
662 662
663 /* Get IRQ from device tree */ 663 /* Get IRQ from device tree */
664 err = of_irq_to_resource(pdev->dev.of_node, 0, &res_irq); 664 irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
665 if (!err) { 665 if (!irq) {
666 dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n"); 666 dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n");
667 return -ENODEV; 667 return -ENODEV;
668 } 668 }
@@ -711,7 +711,7 @@ static int arc_emac_probe(struct platform_device *pdev)
711 goto out; 711 goto out;
712 } 712 }
713 713
714 ndev->irq = res_irq.start; 714 ndev->irq = irq;
715 dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq); 715 dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq);
716 716
717 /* Register interrupt handler for device */ 717 /* Register interrupt handler for device */
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
index 7583a9572bcc..f8b92864fc52 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
@@ -32,7 +32,9 @@
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/phy.h> 34#include <linux/phy.h>
35#include <linux/of_address.h>
35#include <linux/of_device.h> 36#include <linux/of_device.h>
37#include <linux/of_irq.h>
36#include <linux/gfp.h> 38#include <linux/gfp.h>
37 39
38#include <asm/immap_cpm2.h> 40#include <asm/immap_cpm2.h>
@@ -88,7 +90,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
88 struct fs_platform_info *fpi = fep->fpi; 90 struct fs_platform_info *fpi = fep->fpi;
89 int ret = -EINVAL; 91 int ret = -EINVAL;
90 92
91 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 93 fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
92 if (fep->interrupt == NO_IRQ) 94 if (fep->interrupt == NO_IRQ)
93 goto out; 95 goto out;
94 96
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
index 9ae6cdbcac2e..a9a00f39521a 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-fec.c
@@ -31,7 +31,9 @@
31#include <linux/bitops.h> 31#include <linux/bitops.h>
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/of_address.h>
34#include <linux/of_device.h> 35#include <linux/of_device.h>
36#include <linux/of_irq.h>
35#include <linux/gfp.h> 37#include <linux/gfp.h>
36 38
37#include <asm/irq.h> 39#include <asm/irq.h>
@@ -98,7 +100,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
98{ 100{
99 struct platform_device *ofdev = to_platform_device(fep->dev); 101 struct platform_device *ofdev = to_platform_device(fep->dev);
100 102
101 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 103 fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
102 if (fep->interrupt == NO_IRQ) 104 if (fep->interrupt == NO_IRQ)
103 return -EINVAL; 105 return -EINVAL;
104 106
diff --git a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
index 22a02a767069..d37cd4ebac65 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mac-scc.c
@@ -31,6 +31,8 @@
31#include <linux/bitops.h> 31#include <linux/bitops.h>
32#include <linux/fs.h> 32#include <linux/fs.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/of_address.h>
35#include <linux/of_irq.h>
34#include <linux/of_platform.h> 36#include <linux/of_platform.h>
35 37
36#include <asm/irq.h> 38#include <asm/irq.h>
@@ -98,7 +100,7 @@ static int do_pd_setup(struct fs_enet_private *fep)
98{ 100{
99 struct platform_device *ofdev = to_platform_device(fep->dev); 101 struct platform_device *ofdev = to_platform_device(fep->dev);
100 102
101 fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 103 fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0);
102 if (fep->interrupt == NO_IRQ) 104 if (fep->interrupt == NO_IRQ)
103 return -EINVAL; 105 return -EINVAL;
104 106
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
index 844ecfa84d17..67caaacd19ec 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
@@ -22,6 +22,7 @@
22#include <linux/mii.h> 22#include <linux/mii.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/mdio-bitbang.h> 24#include <linux/mdio-bitbang.h>
25#include <linux/of_address.h>
25#include <linux/of_mdio.h> 26#include <linux/of_mdio.h>
26#include <linux/of_platform.h> 27#include <linux/of_platform.h>
27 28
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
index 2f1c46a12f05..ac5d447ff8c4 100644
--- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
+++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c
@@ -31,6 +31,7 @@
31#include <linux/ethtool.h> 31#include <linux/ethtool.h>
32#include <linux/bitops.h> 32#include <linux/bitops.h>
33#include <linux/platform_device.h> 33#include <linux/platform_device.h>
34#include <linux/of_address.h>
34#include <linux/of_platform.h> 35#include <linux/of_platform.h>
35 36
36#include <asm/pgtable.h> 37#include <asm/pgtable.h>
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 9fbe4dda7a0e..ef95c3ae53e6 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -78,6 +78,8 @@
78#include <linux/if_vlan.h> 78#include <linux/if_vlan.h>
79#include <linux/spinlock.h> 79#include <linux/spinlock.h>
80#include <linux/mm.h> 80#include <linux/mm.h>
81#include <linux/of_address.h>
82#include <linux/of_irq.h>
81#include <linux/of_mdio.h> 83#include <linux/of_mdio.h>
82#include <linux/of_platform.h> 84#include <linux/of_platform.h>
83#include <linux/ip.h> 85#include <linux/ip.h>
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index 5930c39672db..64b329fecf3d 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -31,6 +31,8 @@
31#include <linux/mii.h> 31#include <linux/mii.h>
32#include <linux/phy.h> 32#include <linux/phy.h>
33#include <linux/workqueue.h> 33#include <linux/workqueue.h>
34#include <linux/of_address.h>
35#include <linux/of_irq.h>
34#include <linux/of_mdio.h> 36#include <linux/of_mdio.h>
35#include <linux/of_net.h> 37#include <linux/of_net.h>
36#include <linux/of_platform.h> 38#include <linux/of_platform.h>
diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c
index c1b6e7e31aac..d449fcb90199 100644
--- a/drivers/net/ethernet/freescale/xgmac_mdio.c
+++ b/drivers/net/ethernet/freescale/xgmac_mdio.c
@@ -17,6 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/phy.h> 18#include <linux/phy.h>
19#include <linux/mdio.h> 19#include <linux/mdio.h>
20#include <linux/of_address.h>
20#include <linux/of_platform.h> 21#include <linux/of_platform.h>
21#include <linux/of_mdio.h> 22#include <linux/of_mdio.h>
22 23
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 6b5c7222342c..cdf2321f1f0f 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -39,6 +39,8 @@
39#include <linux/bitops.h> 39#include <linux/bitops.h>
40#include <linux/workqueue.h> 40#include <linux/workqueue.h>
41#include <linux/of.h> 41#include <linux/of.h>
42#include <linux/of_address.h>
43#include <linux/of_irq.h>
42#include <linux/of_net.h> 44#include <linux/of_net.h>
43#include <linux/slab.h> 45#include <linux/slab.h>
44 46
diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c
index e7847510eda2..9d75fef6396f 100644
--- a/drivers/net/ethernet/ibm/emac/mal.c
+++ b/drivers/net/ethernet/ibm/emac/mal.c
@@ -27,6 +27,7 @@
27 27
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/of_irq.h>
30 31
31#include "core.h" 32#include "core.h"
32#include <asm/dcr-regs.h> 33#include <asm/dcr-regs.h>
diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/ibm/emac/rgmii.c
index c47e23d6eeaa..4fb2f96da23b 100644
--- a/drivers/net/ethernet/ibm/emac/rgmii.c
+++ b/drivers/net/ethernet/ibm/emac/rgmii.c
@@ -24,6 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/ethtool.h> 26#include <linux/ethtool.h>
27#include <linux/of_address.h>
27#include <asm/io.h> 28#include <asm/io.h>
28 29
29#include "emac.h" 30#include "emac.h"
diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm/emac/tah.c
index c231a4a32c4d..9f24769ed826 100644
--- a/drivers/net/ethernet/ibm/emac/tah.c
+++ b/drivers/net/ethernet/ibm/emac/tah.c
@@ -18,6 +18,7 @@
18 * Free Software Foundation; either version 2 of the License, or (at your 18 * Free Software Foundation; either version 2 of the License, or (at your
19 * option) any later version. 19 * option) any later version.
20 */ 20 */
21#include <linux/of_address.h>
21#include <asm/io.h> 22#include <asm/io.h>
22 23
23#include "emac.h" 24#include "emac.h"
diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ibm/emac/zmii.c
index 4cdf286f7ee3..9ca67a38c062 100644
--- a/drivers/net/ethernet/ibm/emac/zmii.c
+++ b/drivers/net/ethernet/ibm/emac/zmii.c
@@ -24,6 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/ethtool.h> 26#include <linux/ethtool.h>
27#include <linux/of_address.h>
27#include <asm/io.h> 28#include <asm/io.h>
28 29
29#include "emac.h" 30#include "emac.h"
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 0029148077a9..1f2364126323 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -36,6 +36,7 @@
36#include <linux/netdevice.h> 36#include <linux/netdevice.h>
37#include <linux/of.h> 37#include <linux/of.h>
38#include <linux/of_device.h> 38#include <linux/of_device.h>
39#include <linux/of_irq.h>
39#include <linux/of_mdio.h> 40#include <linux/of_mdio.h>
40#include <linux/of_platform.h> 41#include <linux/of_platform.h>
41#include <linux/of_address.h> 42#include <linux/of_address.h>
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 78cc76053328..de6f8990246f 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -17,6 +17,7 @@ config PROC_DEVICETREE
17 17
18config OF_SELFTEST 18config OF_SELFTEST
19 bool "Device Tree Runtime self tests" 19 bool "Device Tree Runtime self tests"
20 depends on OF_IRQ
20 help 21 help
21 This option builds in test cases for the device tree infrastructure 22 This option builds in test cases for the device tree infrastructure
22 that are executed one at boot time, and the results dumped to the 23 that are executed one at boot time, and the results dumped to the
diff --git a/drivers/of/address.c b/drivers/of/address.c
index b55c21890760..4b9317bdb81c 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -489,7 +489,7 @@ static u64 __of_translate_address(struct device_node *dev,
489 int na, ns, pna, pns; 489 int na, ns, pna, pns;
490 u64 result = OF_BAD_ADDR; 490 u64 result = OF_BAD_ADDR;
491 491
492 pr_debug("OF: ** translation for device %s **\n", dev->full_name); 492 pr_debug("OF: ** translation for device %s **\n", of_node_full_name(dev));
493 493
494 /* Increase refcount at current level */ 494 /* Increase refcount at current level */
495 of_node_get(dev); 495 of_node_get(dev);
@@ -504,13 +504,13 @@ static u64 __of_translate_address(struct device_node *dev,
504 bus->count_cells(dev, &na, &ns); 504 bus->count_cells(dev, &na, &ns);
505 if (!OF_CHECK_COUNTS(na, ns)) { 505 if (!OF_CHECK_COUNTS(na, ns)) {
506 printk(KERN_ERR "prom_parse: Bad cell count for %s\n", 506 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
507 dev->full_name); 507 of_node_full_name(dev));
508 goto bail; 508 goto bail;
509 } 509 }
510 memcpy(addr, in_addr, na * 4); 510 memcpy(addr, in_addr, na * 4);
511 511
512 pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n", 512 pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n",
513 bus->name, na, ns, parent->full_name); 513 bus->name, na, ns, of_node_full_name(parent));
514 of_dump_addr("OF: translating address:", addr, na); 514 of_dump_addr("OF: translating address:", addr, na);
515 515
516 /* Translate */ 516 /* Translate */
@@ -532,12 +532,12 @@ static u64 __of_translate_address(struct device_node *dev,
532 pbus->count_cells(dev, &pna, &pns); 532 pbus->count_cells(dev, &pna, &pns);
533 if (!OF_CHECK_COUNTS(pna, pns)) { 533 if (!OF_CHECK_COUNTS(pna, pns)) {
534 printk(KERN_ERR "prom_parse: Bad cell count for %s\n", 534 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
535 dev->full_name); 535 of_node_full_name(dev));
536 break; 536 break;
537 } 537 }
538 538
539 pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n", 539 pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n",
540 pbus->name, pna, pns, parent->full_name); 540 pbus->name, pna, pns, of_node_full_name(parent));
541 541
542 /* Apply bus translation */ 542 /* Apply bus translation */
543 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop)) 543 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop))
@@ -626,6 +626,14 @@ const __be32 *of_get_address(struct device_node *dev, int index, u64 *size,
626} 626}
627EXPORT_SYMBOL(of_get_address); 627EXPORT_SYMBOL(of_get_address);
628 628
629unsigned long __weak pci_address_to_pio(phys_addr_t address)
630{
631 if (address > IO_SPACE_LIMIT)
632 return (unsigned long)-1;
633
634 return (unsigned long) address;
635}
636
629static int __of_address_to_resource(struct device_node *dev, 637static int __of_address_to_resource(struct device_node *dev,
630 const __be32 *addrp, u64 size, unsigned int flags, 638 const __be32 *addrp, u64 size, unsigned int flags,
631 const char *name, struct resource *r) 639 const char *name, struct resource *r)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index aace017fc452..f807d0edabf3 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -74,6 +74,13 @@ int of_n_size_cells(struct device_node *np)
74} 74}
75EXPORT_SYMBOL(of_n_size_cells); 75EXPORT_SYMBOL(of_n_size_cells);
76 76
77#ifdef CONFIG_NUMA
78int __weak of_node_to_nid(struct device_node *np)
79{
80 return numa_node_id();
81}
82#endif
83
77#if defined(CONFIG_OF_DYNAMIC) 84#if defined(CONFIG_OF_DYNAMIC)
78/** 85/**
79 * of_node_get - Increment refcount of a node 86 * of_node_get - Increment refcount of a node
@@ -265,9 +272,9 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun,
265 272
266 ac = of_n_addr_cells(cpun); 273 ac = of_n_addr_cells(cpun);
267 cell = of_get_property(cpun, prop_name, &prop_len); 274 cell = of_get_property(cpun, prop_name, &prop_len);
268 if (!cell) 275 if (!cell || !ac)
269 return false; 276 return false;
270 prop_len /= sizeof(*cell); 277 prop_len /= sizeof(*cell) * ac;
271 for (tid = 0; tid < prop_len; tid++) { 278 for (tid = 0; tid < prop_len; tid++) {
272 hwid = of_read_number(cell, ac); 279 hwid = of_read_number(cell, ac);
273 if (arch_match_cpu_phys_id(cpu, hwid)) { 280 if (arch_match_cpu_phys_id(cpu, hwid)) {
@@ -280,6 +287,31 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun,
280 return false; 287 return false;
281} 288}
282 289
290/*
291 * arch_find_n_match_cpu_physical_id - See if the given device node is
292 * for the cpu corresponding to logical cpu 'cpu'. Return true if so,
293 * else false. If 'thread' is non-NULL, the local thread number within the
294 * core is returned in it.
295 */
296bool __weak arch_find_n_match_cpu_physical_id(struct device_node *cpun,
297 int cpu, unsigned int *thread)
298{
299 /* Check for non-standard "ibm,ppc-interrupt-server#s" property
300 * for thread ids on PowerPC. If it doesn't exist fallback to
301 * standard "reg" property.
302 */
303 if (IS_ENABLED(CONFIG_PPC) &&
304 __of_find_n_match_cpu_property(cpun,
305 "ibm,ppc-interrupt-server#s",
306 cpu, thread))
307 return true;
308
309 if (__of_find_n_match_cpu_property(cpun, "reg", cpu, thread))
310 return true;
311
312 return false;
313}
314
283/** 315/**
284 * of_get_cpu_node - Get device node associated with the given logical CPU 316 * of_get_cpu_node - Get device node associated with the given logical CPU
285 * 317 *
@@ -300,24 +332,10 @@ static bool __of_find_n_match_cpu_property(struct device_node *cpun,
300 */ 332 */
301struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) 333struct device_node *of_get_cpu_node(int cpu, unsigned int *thread)
302{ 334{
303 struct device_node *cpun, *cpus; 335 struct device_node *cpun;
304
305 cpus = of_find_node_by_path("/cpus");
306 if (!cpus)
307 return NULL;
308 336
309 for_each_child_of_node(cpus, cpun) { 337 for_each_node_by_type(cpun, "cpu") {
310 if (of_node_cmp(cpun->type, "cpu")) 338 if (arch_find_n_match_cpu_physical_id(cpun, cpu, thread))
311 continue;
312 /* Check for non-standard "ibm,ppc-interrupt-server#s" property
313 * for thread ids on PowerPC. If it doesn't exist fallback to
314 * standard "reg" property.
315 */
316 if (IS_ENABLED(CONFIG_PPC) &&
317 __of_find_n_match_cpu_property(cpun,
318 "ibm,ppc-interrupt-server#s", cpu, thread))
319 return cpun;
320 if (__of_find_n_match_cpu_property(cpun, "reg", cpu, thread))
321 return cpun; 339 return cpun;
322 } 340 }
323 return NULL; 341 return NULL;
@@ -1174,6 +1192,15 @@ int of_property_count_strings(struct device_node *np, const char *propname)
1174} 1192}
1175EXPORT_SYMBOL_GPL(of_property_count_strings); 1193EXPORT_SYMBOL_GPL(of_property_count_strings);
1176 1194
1195void of_print_phandle_args(const char *msg, const struct of_phandle_args *args)
1196{
1197 int i;
1198 printk("%s %s", msg, of_node_full_name(args->np));
1199 for (i = 0; i < args->args_count; i++)
1200 printk(i ? ",%08x" : ":%08x", args->args[i]);
1201 printk("\n");
1202}
1203
1177static int __of_parse_phandle_with_args(const struct device_node *np, 1204static int __of_parse_phandle_with_args(const struct device_node *np,
1178 const char *list_name, 1205 const char *list_name,
1179 const char *cells_name, 1206 const char *cells_name,
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index a4fa9ad31b8f..2fa024b97c43 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -618,12 +618,72 @@ int __init of_scan_flat_dt_by_path(const char *path,
618 return ret; 618 return ret;
619} 619}
620 620
621const char * __init of_flat_dt_get_machine_name(void)
622{
623 const char *name;
624 unsigned long dt_root = of_get_flat_dt_root();
625
626 name = of_get_flat_dt_prop(dt_root, "model", NULL);
627 if (!name)
628 name = of_get_flat_dt_prop(dt_root, "compatible", NULL);
629 return name;
630}
631
632/**
633 * of_flat_dt_match_machine - Iterate match tables to find matching machine.
634 *
635 * @default_match: A machine specific ptr to return in case of no match.
636 * @get_next_compat: callback function to return next compatible match table.
637 *
638 * Iterate through machine match tables to find the best match for the machine
639 * compatible string in the FDT.
640 */
641const void * __init of_flat_dt_match_machine(const void *default_match,
642 const void * (*get_next_compat)(const char * const**))
643{
644 const void *data = NULL;
645 const void *best_data = default_match;
646 const char *const *compat;
647 unsigned long dt_root;
648 unsigned int best_score = ~1, score = 0;
649
650 dt_root = of_get_flat_dt_root();
651 while ((data = get_next_compat(&compat))) {
652 score = of_flat_dt_match(dt_root, compat);
653 if (score > 0 && score < best_score) {
654 best_data = data;
655 best_score = score;
656 }
657 }
658 if (!best_data) {
659 const char *prop;
660 long size;
661
662 pr_err("\n unrecognized device tree list:\n[ ");
663
664 prop = of_get_flat_dt_prop(dt_root, "compatible", &size);
665 if (prop) {
666 while (size > 0) {
667 printk("'%s' ", prop);
668 size -= strlen(prop) + 1;
669 prop += strlen(prop) + 1;
670 }
671 }
672 printk("]\n\n");
673 return NULL;
674 }
675
676 pr_info("Machine model: %s\n", of_flat_dt_get_machine_name());
677
678 return best_data;
679}
680
621#ifdef CONFIG_BLK_DEV_INITRD 681#ifdef CONFIG_BLK_DEV_INITRD
622/** 682/**
623 * early_init_dt_check_for_initrd - Decode initrd location from flat tree 683 * early_init_dt_check_for_initrd - Decode initrd location from flat tree
624 * @node: reference to node containing initrd location ('chosen') 684 * @node: reference to node containing initrd location ('chosen')
625 */ 685 */
626void __init early_init_dt_check_for_initrd(unsigned long node) 686static void __init early_init_dt_check_for_initrd(unsigned long node)
627{ 687{
628 u64 start, end; 688 u64 start, end;
629 unsigned long len; 689 unsigned long len;
@@ -641,12 +701,15 @@ void __init early_init_dt_check_for_initrd(unsigned long node)
641 return; 701 return;
642 end = of_read_number(prop, len/4); 702 end = of_read_number(prop, len/4);
643 703
644 early_init_dt_setup_initrd_arch(start, end); 704 initrd_start = (unsigned long)__va(start);
705 initrd_end = (unsigned long)__va(end);
706 initrd_below_start_ok = 1;
707
645 pr_debug("initrd_start=0x%llx initrd_end=0x%llx\n", 708 pr_debug("initrd_start=0x%llx initrd_end=0x%llx\n",
646 (unsigned long long)start, (unsigned long long)end); 709 (unsigned long long)start, (unsigned long long)end);
647} 710}
648#else 711#else
649inline void early_init_dt_check_for_initrd(unsigned long node) 712static inline void early_init_dt_check_for_initrd(unsigned long node)
650{ 713{
651} 714}
652#endif /* CONFIG_BLK_DEV_INITRD */ 715#endif /* CONFIG_BLK_DEV_INITRD */
@@ -774,6 +837,25 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
774} 837}
775 838
776#ifdef CONFIG_HAVE_MEMBLOCK 839#ifdef CONFIG_HAVE_MEMBLOCK
840void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
841{
842 const u64 phys_offset = __pa(PAGE_OFFSET);
843 base &= PAGE_MASK;
844 size &= PAGE_MASK;
845 if (base + size < phys_offset) {
846 pr_warning("Ignoring memory block 0x%llx - 0x%llx\n",
847 base, base + size);
848 return;
849 }
850 if (base < phys_offset) {
851 pr_warning("Ignoring memory range 0x%llx - 0x%llx\n",
852 base, phys_offset);
853 size -= phys_offset - base;
854 base = phys_offset;
855 }
856 memblock_add(base, size);
857}
858
777/* 859/*
778 * called from unflatten_device_tree() to bootstrap devicetree itself 860 * called from unflatten_device_tree() to bootstrap devicetree itself
779 * Architectures can override this definition if memblock isn't used 861 * Architectures can override this definition if memblock isn't used
@@ -784,6 +866,32 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align)
784} 866}
785#endif 867#endif
786 868
869bool __init early_init_dt_scan(void *params)
870{
871 if (!params)
872 return false;
873
874 /* Setup flat device-tree pointer */
875 initial_boot_params = params;
876
877 /* check device tree validity */
878 if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) {
879 initial_boot_params = NULL;
880 return false;
881 }
882
883 /* Retrieve various information from the /chosen node */
884 of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
885
886 /* Initialize {size,address}-cells info */
887 of_scan_flat_dt(early_init_dt_scan_root, NULL);
888
889 /* Setup memory, calling early_init_dt_add_memory_arch */
890 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
891
892 return true;
893}
894
787/** 895/**
788 * unflatten_device_tree - create tree of device_nodes from flat blob 896 * unflatten_device_tree - create tree of device_nodes from flat blob
789 * 897 *
@@ -801,4 +909,28 @@ void __init unflatten_device_tree(void)
801 of_alias_scan(early_init_dt_alloc_memory_arch); 909 of_alias_scan(early_init_dt_alloc_memory_arch);
802} 910}
803 911
912/**
913 * unflatten_and_copy_device_tree - copy and create tree of device_nodes from flat blob
914 *
915 * Copies and unflattens the device-tree passed by the firmware, creating the
916 * tree of struct device_node. It also fills the "name" and "type"
917 * pointers of the nodes so the normal device-tree walking functions
918 * can be used. This should only be used when the FDT memory has not been
919 * reserved such is the case when the FDT is built-in to the kernel init
920 * section. If the FDT memory is reserved already then unflatten_device_tree
921 * should be used instead.
922 */
923void __init unflatten_and_copy_device_tree(void)
924{
925 int size = __be32_to_cpu(initial_boot_params->totalsize);
926 void *dt = early_init_dt_alloc_memory_arch(size,
927 __alignof__(struct boot_param_header));
928
929 if (dt) {
930 memcpy(dt, initial_boot_params, size);
931 initial_boot_params = dt;
932 }
933 unflatten_device_tree();
934}
935
804#endif /* CONFIG_OF_EARLY_FLATTREE */ 936#endif /* CONFIG_OF_EARLY_FLATTREE */
diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 1752988d6aa8..786b0b47fae4 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -31,18 +31,17 @@
31 * @dev: Device node of the device whose interrupt is to be mapped 31 * @dev: Device node of the device whose interrupt is to be mapped
32 * @index: Index of the interrupt to map 32 * @index: Index of the interrupt to map
33 * 33 *
34 * This function is a wrapper that chains of_irq_map_one() and 34 * This function is a wrapper that chains of_irq_parse_one() and
35 * irq_create_of_mapping() to make things easier to callers 35 * irq_create_of_mapping() to make things easier to callers
36 */ 36 */
37unsigned int irq_of_parse_and_map(struct device_node *dev, int index) 37unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
38{ 38{
39 struct of_irq oirq; 39 struct of_phandle_args oirq;
40 40
41 if (of_irq_map_one(dev, index, &oirq)) 41 if (of_irq_parse_one(dev, index, &oirq))
42 return 0; 42 return 0;
43 43
44 return irq_create_of_mapping(oirq.controller, oirq.specifier, 44 return irq_create_of_mapping(&oirq);
45 oirq.size);
46} 45}
47EXPORT_SYMBOL_GPL(irq_of_parse_and_map); 46EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
48 47
@@ -79,33 +78,34 @@ struct device_node *of_irq_find_parent(struct device_node *child)
79} 78}
80 79
81/** 80/**
82 * of_irq_map_raw - Low level interrupt tree parsing 81 * of_irq_parse_raw - Low level interrupt tree parsing
83 * @parent: the device interrupt parent 82 * @parent: the device interrupt parent
84 * @intspec: interrupt specifier ("interrupts" property of the device) 83 * @addr: address specifier (start of "reg" property of the device) in be32 format
85 * @ointsize: size of the passed in interrupt specifier 84 * @out_irq: structure of_irq updated by this function
86 * @addr: address specifier (start of "reg" property of the device)
87 * @out_irq: structure of_irq filled by this function
88 * 85 *
89 * Returns 0 on success and a negative number on error 86 * Returns 0 on success and a negative number on error
90 * 87 *
91 * This function is a low-level interrupt tree walking function. It 88 * This function is a low-level interrupt tree walking function. It
92 * can be used to do a partial walk with synthetized reg and interrupts 89 * can be used to do a partial walk with synthetized reg and interrupts
93 * properties, for example when resolving PCI interrupts when no device 90 * properties, for example when resolving PCI interrupts when no device
94 * node exist for the parent. 91 * node exist for the parent. It takes an interrupt specifier structure as
92 * input, walks the tree looking for any interrupt-map properties, translates
93 * the specifier for each map, and then returns the translated map.
95 */ 94 */
96int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 95int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
97 u32 ointsize, const __be32 *addr, struct of_irq *out_irq)
98{ 96{
99 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; 97 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
100 const __be32 *tmp, *imap, *imask; 98 __be32 initial_match_array[MAX_PHANDLE_ARGS];
99 const __be32 *match_array = initial_match_array;
100 const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = ~0 };
101 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; 101 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
102 int imaplen, match, i; 102 int imaplen, match, i;
103 103
104 pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", 104#ifdef DEBUG
105 parent->full_name, be32_to_cpup(intspec), 105 of_print_phandle_args("of_irq_parse_raw: ", out_irq);
106 be32_to_cpup(intspec + 1), ointsize); 106#endif
107 107
108 ipar = of_node_get(parent); 108 ipar = of_node_get(out_irq->np);
109 109
110 /* First get the #interrupt-cells property of the current cursor 110 /* First get the #interrupt-cells property of the current cursor
111 * that tells us how to interpret the passed-in intspec. If there 111 * that tells us how to interpret the passed-in intspec. If there
@@ -126,9 +126,9 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
126 goto fail; 126 goto fail;
127 } 127 }
128 128
129 pr_debug("of_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize); 129 pr_debug("of_irq_parse_raw: ipar=%s, size=%d\n", of_node_full_name(ipar), intsize);
130 130
131 if (ointsize != intsize) 131 if (out_irq->args_count != intsize)
132 return -EINVAL; 132 return -EINVAL;
133 133
134 /* Look for this #address-cells. We have to implement the old linux 134 /* Look for this #address-cells. We have to implement the old linux
@@ -147,6 +147,16 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
147 147
148 pr_debug(" -> addrsize=%d\n", addrsize); 148 pr_debug(" -> addrsize=%d\n", addrsize);
149 149
150 /* Range check so that the temporary buffer doesn't overflow */
151 if (WARN_ON(addrsize + intsize > MAX_PHANDLE_ARGS))
152 goto fail;
153
154 /* Precalculate the match array - this simplifies match loop */
155 for (i = 0; i < addrsize; i++)
156 initial_match_array[i] = addr ? addr[i] : 0;
157 for (i = 0; i < intsize; i++)
158 initial_match_array[addrsize + i] = cpu_to_be32(out_irq->args[i]);
159
150 /* Now start the actual "proper" walk of the interrupt tree */ 160 /* Now start the actual "proper" walk of the interrupt tree */
151 while (ipar != NULL) { 161 while (ipar != NULL) {
152 /* Now check if cursor is an interrupt-controller and if it is 162 /* Now check if cursor is an interrupt-controller and if it is
@@ -155,15 +165,19 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
155 if (of_get_property(ipar, "interrupt-controller", NULL) != 165 if (of_get_property(ipar, "interrupt-controller", NULL) !=
156 NULL) { 166 NULL) {
157 pr_debug(" -> got it !\n"); 167 pr_debug(" -> got it !\n");
158 for (i = 0; i < intsize; i++)
159 out_irq->specifier[i] =
160 of_read_number(intspec +i, 1);
161 out_irq->size = intsize;
162 out_irq->controller = ipar;
163 of_node_put(old); 168 of_node_put(old);
164 return 0; 169 return 0;
165 } 170 }
166 171
172 /*
173 * interrupt-map parsing does not work without a reg
174 * property when #address-cells != 0
175 */
176 if (addrsize && !addr) {
177 pr_debug(" -> no reg passed in when needed !\n");
178 goto fail;
179 }
180
167 /* Now look for an interrupt-map */ 181 /* Now look for an interrupt-map */
168 imap = of_get_property(ipar, "interrupt-map", &imaplen); 182 imap = of_get_property(ipar, "interrupt-map", &imaplen);
169 /* No interrupt map, check for an interrupt parent */ 183 /* No interrupt map, check for an interrupt parent */
@@ -176,34 +190,16 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
176 190
177 /* Look for a mask */ 191 /* Look for a mask */
178 imask = of_get_property(ipar, "interrupt-map-mask", NULL); 192 imask = of_get_property(ipar, "interrupt-map-mask", NULL);
179 193 if (!imask)
180 /* If we were passed no "reg" property and we attempt to parse 194 imask = dummy_imask;
181 * an interrupt-map, then #address-cells must be 0.
182 * Fail if it's not.
183 */
184 if (addr == NULL && addrsize != 0) {
185 pr_debug(" -> no reg passed in when needed !\n");
186 goto fail;
187 }
188 195
189 /* Parse interrupt-map */ 196 /* Parse interrupt-map */
190 match = 0; 197 match = 0;
191 while (imaplen > (addrsize + intsize + 1) && !match) { 198 while (imaplen > (addrsize + intsize + 1) && !match) {
192 /* Compare specifiers */ 199 /* Compare specifiers */
193 match = 1; 200 match = 1;
194 for (i = 0; i < addrsize && match; ++i) { 201 for (i = 0; i < (addrsize + intsize); i++, imaplen--)
195 __be32 mask = imask ? imask[i] 202 match &= !((match_array[i] ^ *imap++) & imask[i]);
196 : cpu_to_be32(0xffffffffu);
197 match = ((addr[i] ^ imap[i]) & mask) == 0;
198 }
199 for (; i < (addrsize + intsize) && match; ++i) {
200 __be32 mask = imask ? imask[i]
201 : cpu_to_be32(0xffffffffu);
202 match =
203 ((intspec[i-addrsize] ^ imap[i]) & mask) == 0;
204 }
205 imap += addrsize + intsize;
206 imaplen -= addrsize + intsize;
207 203
208 pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen); 204 pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen);
209 205
@@ -237,6 +233,8 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
237 newintsize, newaddrsize); 233 newintsize, newaddrsize);
238 234
239 /* Check for malformed properties */ 235 /* Check for malformed properties */
236 if (WARN_ON(newaddrsize + newintsize > MAX_PHANDLE_ARGS))
237 goto fail;
240 if (imaplen < (newaddrsize + newintsize)) 238 if (imaplen < (newaddrsize + newintsize))
241 goto fail; 239 goto fail;
242 240
@@ -248,12 +246,18 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
248 if (!match) 246 if (!match)
249 goto fail; 247 goto fail;
250 248
251 of_node_put(old); 249 /*
252 old = of_node_get(newpar); 250 * Successfully parsed an interrrupt-map translation; copy new
251 * interrupt specifier into the out_irq structure
252 */
253 of_node_put(out_irq->np);
254 out_irq->np = of_node_get(newpar);
255
256 match_array = imap - newaddrsize - newintsize;
257 for (i = 0; i < newintsize; i++)
258 out_irq->args[i] = be32_to_cpup(imap - newintsize + i);
259 out_irq->args_count = intsize = newintsize;
253 addrsize = newaddrsize; 260 addrsize = newaddrsize;
254 intsize = newintsize;
255 intspec = imap - intsize;
256 addr = intspec - addrsize;
257 261
258 skiplevel: 262 skiplevel:
259 /* Iterate again with new parent */ 263 /* Iterate again with new parent */
@@ -264,46 +268,53 @@ int of_irq_map_raw(struct device_node *parent, const __be32 *intspec,
264 } 268 }
265 fail: 269 fail:
266 of_node_put(ipar); 270 of_node_put(ipar);
267 of_node_put(old); 271 of_node_put(out_irq->np);
268 of_node_put(newpar); 272 of_node_put(newpar);
269 273
270 return -EINVAL; 274 return -EINVAL;
271} 275}
272EXPORT_SYMBOL_GPL(of_irq_map_raw); 276EXPORT_SYMBOL_GPL(of_irq_parse_raw);
273 277
274/** 278/**
275 * of_irq_map_one - Resolve an interrupt for a device 279 * of_irq_parse_one - Resolve an interrupt for a device
276 * @device: the device whose interrupt is to be resolved 280 * @device: the device whose interrupt is to be resolved
277 * @index: index of the interrupt to resolve 281 * @index: index of the interrupt to resolve
278 * @out_irq: structure of_irq filled by this function 282 * @out_irq: structure of_irq filled by this function
279 * 283 *
280 * This function resolves an interrupt, walking the tree, for a given 284 * This function resolves an interrupt for a node by walking the interrupt tree,
281 * device-tree node. It's the high level pendant to of_irq_map_raw(). 285 * finding which interrupt controller node it is attached to, and returning the
286 * interrupt specifier that can be used to retrieve a Linux IRQ number.
282 */ 287 */
283int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) 288int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq)
284{ 289{
285 struct device_node *p; 290 struct device_node *p;
286 const __be32 *intspec, *tmp, *addr; 291 const __be32 *intspec, *tmp, *addr;
287 u32 intsize, intlen; 292 u32 intsize, intlen;
288 int res = -EINVAL; 293 int i, res = -EINVAL;
289 294
290 pr_debug("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); 295 pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index);
291 296
292 /* OldWorld mac stuff is "special", handle out of line */ 297 /* OldWorld mac stuff is "special", handle out of line */
293 if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) 298 if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
294 return of_irq_map_oldworld(device, index, out_irq); 299 return of_irq_parse_oldworld(device, index, out_irq);
300
301 /* Get the reg property (if any) */
302 addr = of_get_property(device, "reg", NULL);
295 303
296 /* Get the interrupts property */ 304 /* Get the interrupts property */
297 intspec = of_get_property(device, "interrupts", &intlen); 305 intspec = of_get_property(device, "interrupts", &intlen);
298 if (intspec == NULL) 306 if (intspec == NULL) {
299 return -EINVAL; 307 /* Try the new-style interrupts-extended */
308 res = of_parse_phandle_with_args(device, "interrupts-extended",
309 "#interrupt-cells", index, out_irq);
310 if (res)
311 return -EINVAL;
312 return of_irq_parse_raw(addr, out_irq);
313 }
300 intlen /= sizeof(*intspec); 314 intlen /= sizeof(*intspec);
301 315
302 pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); 316 pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
303 317
304 /* Get the reg property (if any) */
305 addr = of_get_property(device, "reg", NULL);
306
307 /* Look for the interrupt parent. */ 318 /* Look for the interrupt parent. */
308 p = of_irq_find_parent(device); 319 p = of_irq_find_parent(device);
309 if (p == NULL) 320 if (p == NULL)
@@ -321,14 +332,20 @@ int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq
321 if ((index + 1) * intsize > intlen) 332 if ((index + 1) * intsize > intlen)
322 goto out; 333 goto out;
323 334
324 /* Get new specifier and map it */ 335 /* Copy intspec into irq structure */
325 res = of_irq_map_raw(p, intspec + index * intsize, intsize, 336 intspec += index * intsize;
326 addr, out_irq); 337 out_irq->np = p;
338 out_irq->args_count = intsize;
339 for (i = 0; i < intsize; i++)
340 out_irq->args[i] = be32_to_cpup(intspec++);
341
342 /* Check if there are any interrupt-map translations to process */
343 res = of_irq_parse_raw(addr, out_irq);
327 out: 344 out:
328 of_node_put(p); 345 of_node_put(p);
329 return res; 346 return res;
330} 347}
331EXPORT_SYMBOL_GPL(of_irq_map_one); 348EXPORT_SYMBOL_GPL(of_irq_parse_one);
332 349
333/** 350/**
334 * of_irq_to_resource - Decode a node's IRQ and return it as a resource 351 * of_irq_to_resource - Decode a node's IRQ and return it as a resource
@@ -354,8 +371,8 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
354 &name); 371 &name);
355 372
356 r->start = r->end = irq; 373 r->start = r->end = irq;
357 r->flags = IORESOURCE_IRQ; 374 r->flags = IORESOURCE_IRQ | irqd_get_trigger_type(irq_get_irq_data(irq));
358 r->name = name ? name : dev->full_name; 375 r->name = name ? name : of_node_full_name(dev);
359 } 376 }
360 377
361 return irq; 378 return irq;
@@ -368,9 +385,10 @@ EXPORT_SYMBOL_GPL(of_irq_to_resource);
368 */ 385 */
369int of_irq_count(struct device_node *dev) 386int of_irq_count(struct device_node *dev)
370{ 387{
388 struct of_phandle_args irq;
371 int nr = 0; 389 int nr = 0;
372 390
373 while (of_irq_to_resource(dev, nr, NULL)) 391 while (of_irq_parse_one(dev, nr, &irq) == 0)
374 nr++; 392 nr++;
375 393
376 return nr; 394 return nr;
diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c
index e5ca00893c0c..848199633798 100644
--- a/drivers/of/of_pci.c
+++ b/drivers/of/of_pci.c
@@ -2,7 +2,6 @@
2#include <linux/export.h> 2#include <linux/export.h>
3#include <linux/of.h> 3#include <linux/of.h>
4#include <linux/of_pci.h> 4#include <linux/of_pci.h>
5#include <asm/prom.h>
6 5
7static inline int __of_pci_pci_compare(struct device_node *node, 6static inline int __of_pci_pci_compare(struct device_node *node,
8 unsigned int data) 7 unsigned int data)
diff --git a/drivers/of/of_pci_irq.c b/drivers/of/of_pci_irq.c
index 677053813211..8736bc7676c5 100644
--- a/drivers/of/of_pci_irq.c
+++ b/drivers/of/of_pci_irq.c
@@ -2,10 +2,9 @@
2#include <linux/of_pci.h> 2#include <linux/of_pci.h>
3#include <linux/of_irq.h> 3#include <linux/of_irq.h>
4#include <linux/export.h> 4#include <linux/export.h>
5#include <asm/prom.h>
6 5
7/** 6/**
8 * of_irq_map_pci - Resolve the interrupt for a PCI device 7 * of_irq_parse_pci - Resolve the interrupt for a PCI device
9 * @pdev: the device whose interrupt is to be resolved 8 * @pdev: the device whose interrupt is to be resolved
10 * @out_irq: structure of_irq filled by this function 9 * @out_irq: structure of_irq filled by this function
11 * 10 *
@@ -15,7 +14,7 @@
15 * PCI tree until an device-node is found, at which point it will finish 14 * PCI tree until an device-node is found, at which point it will finish
16 * resolving using the OF tree walking. 15 * resolving using the OF tree walking.
17 */ 16 */
18int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) 17int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq)
19{ 18{
20 struct device_node *dn, *ppnode; 19 struct device_node *dn, *ppnode;
21 struct pci_dev *ppdev; 20 struct pci_dev *ppdev;
@@ -30,7 +29,7 @@ int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq)
30 */ 29 */
31 dn = pci_device_to_OF_node(pdev); 30 dn = pci_device_to_OF_node(pdev);
32 if (dn) { 31 if (dn) {
33 rc = of_irq_map_one(dn, 0, out_irq); 32 rc = of_irq_parse_one(dn, 0, out_irq);
34 if (!rc) 33 if (!rc)
35 return rc; 34 return rc;
36 } 35 }
@@ -85,9 +84,37 @@ int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq)
85 pdev = ppdev; 84 pdev = ppdev;
86 } 85 }
87 86
87 out_irq->np = ppnode;
88 out_irq->args_count = 1;
89 out_irq->args[0] = lspec;
88 lspec_be = cpu_to_be32(lspec); 90 lspec_be = cpu_to_be32(lspec);
89 laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); 91 laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8));
90 laddr[1] = laddr[2] = cpu_to_be32(0); 92 laddr[1] = laddr[2] = cpu_to_be32(0);
91 return of_irq_map_raw(ppnode, &lspec_be, 1, laddr, out_irq); 93 return of_irq_parse_raw(laddr, out_irq);
92} 94}
93EXPORT_SYMBOL_GPL(of_irq_map_pci); 95EXPORT_SYMBOL_GPL(of_irq_parse_pci);
96
97/**
98 * of_irq_parse_and_map_pci() - Decode a PCI irq from the device tree and map to a virq
99 * @dev: The pci device needing an irq
100 * @slot: PCI slot number; passed when used as map_irq callback. Unused
101 * @pin: PCI irq pin number; passed when used as map_irq callback. Unused
102 *
103 * @slot and @pin are unused, but included in the function so that this
104 * function can be used directly as the map_irq callback to pci_fixup_irqs().
105 */
106int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin)
107{
108 struct of_phandle_args oirq;
109 int ret;
110
111 ret = of_irq_parse_pci(dev, &oirq);
112 if (ret) {
113 dev_err(&dev->dev, "of_irq_parse_pci() failed with rc=%d\n", ret);
114 return 0; /* Proper return code 0 == NO_IRQ */
115 }
116
117 return irq_create_of_mapping(&oirq);
118}
119EXPORT_SYMBOL_GPL(of_irq_parse_and_map_pci);
120
diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c
index 4ec19cbee57f..7b666736c168 100644
--- a/drivers/of/pdt.c
+++ b/drivers/of/pdt.c
@@ -22,7 +22,6 @@
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <linux/of.h> 23#include <linux/of.h>
24#include <linux/of_pdt.h> 24#include <linux/of_pdt.h>
25#include <asm/prom.h>
26 25
27static struct of_pdt_ops *of_pdt_prom_ops __initdata; 26static struct of_pdt_ops *of_pdt_prom_ops __initdata;
28 27
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index f6dcde220821..fce088e6f54e 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -215,6 +215,8 @@ static struct platform_device *of_platform_device_create_pdata(
215 dev->archdata.dma_mask = 0xffffffffUL; 215 dev->archdata.dma_mask = 0xffffffffUL;
216#endif 216#endif
217 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 217 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
218 if (!dev->dev.dma_mask)
219 dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
218 dev->dev.bus = &platform_bus_type; 220 dev->dev.bus = &platform_bus_type;
219 dev->dev.platform_data = platform_data; 221 dev->dev.platform_data = platform_data;
220 222
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c
index 0eb5c38b4e07..e21012bde639 100644
--- a/drivers/of/selftest.c
+++ b/drivers/of/selftest.c
@@ -9,18 +9,24 @@
9#include <linux/errno.h> 9#include <linux/errno.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/of.h> 11#include <linux/of.h>
12#include <linux/of_irq.h>
12#include <linux/list.h> 13#include <linux/list.h>
13#include <linux/mutex.h> 14#include <linux/mutex.h>
14#include <linux/slab.h> 15#include <linux/slab.h>
15#include <linux/device.h> 16#include <linux/device.h>
16 17
17static bool selftest_passed = true; 18static struct selftest_results {
19 int passed;
20 int failed;
21} selftest_results;
22
18#define selftest(result, fmt, ...) { \ 23#define selftest(result, fmt, ...) { \
19 if (!(result)) { \ 24 if (!(result)) { \
20 pr_err("FAIL %s:%i " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ 25 selftest_results.failed++; \
21 selftest_passed = false; \ 26 pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \
22 } else { \ 27 } else { \
23 pr_info("pass %s:%i\n", __FILE__, __LINE__); \ 28 selftest_results.passed++; \
29 pr_debug("pass %s():%i\n", __func__, __LINE__); \
24 } \ 30 } \
25} 31}
26 32
@@ -131,7 +137,6 @@ static void __init of_selftest_property_match_string(void)
131 struct device_node *np; 137 struct device_node *np;
132 int rc; 138 int rc;
133 139
134 pr_info("start\n");
135 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); 140 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a");
136 if (!np) { 141 if (!np) {
137 pr_err("No testcase data in device tree\n"); 142 pr_err("No testcase data in device tree\n");
@@ -154,6 +159,147 @@ static void __init of_selftest_property_match_string(void)
154 selftest(rc == -EILSEQ, "unterminated string; rc=%i", rc); 159 selftest(rc == -EILSEQ, "unterminated string; rc=%i", rc);
155} 160}
156 161
162static void __init of_selftest_parse_interrupts(void)
163{
164 struct device_node *np;
165 struct of_phandle_args args;
166 int i, rc;
167
168 np = of_find_node_by_path("/testcase-data/interrupts/interrupts0");
169 if (!np) {
170 pr_err("missing testcase data\n");
171 return;
172 }
173
174 for (i = 0; i < 4; i++) {
175 bool passed = true;
176 args.args_count = 0;
177 rc = of_irq_parse_one(np, i, &args);
178
179 passed &= !rc;
180 passed &= (args.args_count == 1);
181 passed &= (args.args[0] == (i + 1));
182
183 selftest(passed, "index %i - data error on node %s rc=%i\n",
184 i, args.np->full_name, rc);
185 }
186 of_node_put(np);
187
188 np = of_find_node_by_path("/testcase-data/interrupts/interrupts1");
189 if (!np) {
190 pr_err("missing testcase data\n");
191 return;
192 }
193
194 for (i = 0; i < 4; i++) {
195 bool passed = true;
196 args.args_count = 0;
197 rc = of_irq_parse_one(np, i, &args);
198
199 /* Test the values from tests-phandle.dtsi */
200 switch (i) {
201 case 0:
202 passed &= !rc;
203 passed &= (args.args_count == 1);
204 passed &= (args.args[0] == 9);
205 break;
206 case 1:
207 passed &= !rc;
208 passed &= (args.args_count == 3);
209 passed &= (args.args[0] == 10);
210 passed &= (args.args[1] == 11);
211 passed &= (args.args[2] == 12);
212 break;
213 case 2:
214 passed &= !rc;
215 passed &= (args.args_count == 2);
216 passed &= (args.args[0] == 13);
217 passed &= (args.args[1] == 14);
218 break;
219 case 3:
220 passed &= !rc;
221 passed &= (args.args_count == 2);
222 passed &= (args.args[0] == 15);
223 passed &= (args.args[1] == 16);
224 break;
225 default:
226 passed = false;
227 }
228 selftest(passed, "index %i - data error on node %s rc=%i\n",
229 i, args.np->full_name, rc);
230 }
231 of_node_put(np);
232}
233
234static void __init of_selftest_parse_interrupts_extended(void)
235{
236 struct device_node *np;
237 struct of_phandle_args args;
238 int i, rc;
239
240 np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0");
241 if (!np) {
242 pr_err("missing testcase data\n");
243 return;
244 }
245
246 for (i = 0; i < 7; i++) {
247 bool passed = true;
248 rc = of_irq_parse_one(np, i, &args);
249
250 /* Test the values from tests-phandle.dtsi */
251 switch (i) {
252 case 0:
253 passed &= !rc;
254 passed &= (args.args_count == 1);
255 passed &= (args.args[0] == 1);
256 break;
257 case 1:
258 passed &= !rc;
259 passed &= (args.args_count == 3);
260 passed &= (args.args[0] == 2);
261 passed &= (args.args[1] == 3);
262 passed &= (args.args[2] == 4);
263 break;
264 case 2:
265 passed &= !rc;
266 passed &= (args.args_count == 2);
267 passed &= (args.args[0] == 5);
268 passed &= (args.args[1] == 6);
269 break;
270 case 3:
271 passed &= !rc;
272 passed &= (args.args_count == 1);
273 passed &= (args.args[0] == 9);
274 break;
275 case 4:
276 passed &= !rc;
277 passed &= (args.args_count == 3);
278 passed &= (args.args[0] == 10);
279 passed &= (args.args[1] == 11);
280 passed &= (args.args[2] == 12);
281 break;
282 case 5:
283 passed &= !rc;
284 passed &= (args.args_count == 2);
285 passed &= (args.args[0] == 13);
286 passed &= (args.args[1] == 14);
287 break;
288 case 6:
289 passed &= !rc;
290 passed &= (args.args_count == 1);
291 passed &= (args.args[0] == 15);
292 break;
293 default:
294 passed = false;
295 }
296
297 selftest(passed, "index %i - data error on node %s rc=%i\n",
298 i, args.np->full_name, rc);
299 }
300 of_node_put(np);
301}
302
157static int __init of_selftest(void) 303static int __init of_selftest(void)
158{ 304{
159 struct device_node *np; 305 struct device_node *np;
@@ -168,7 +314,10 @@ static int __init of_selftest(void)
168 pr_info("start of selftest - you will see error messages\n"); 314 pr_info("start of selftest - you will see error messages\n");
169 of_selftest_parse_phandle_with_args(); 315 of_selftest_parse_phandle_with_args();
170 of_selftest_property_match_string(); 316 of_selftest_property_match_string();
171 pr_info("end of selftest - %s\n", selftest_passed ? "PASS" : "FAIL"); 317 of_selftest_parse_interrupts();
318 of_selftest_parse_interrupts_extended();
319 pr_info("end of selftest - %i passed, %i failed\n",
320 selftest_results.passed, selftest_results.failed);
172 return 0; 321 return 0;
173} 322}
174late_initcall(of_selftest); 323late_initcall(of_selftest);
diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
index 80b2250ea19a..c269e430c760 100644
--- a/drivers/pci/host/pci-mvebu.c
+++ b/drivers/pci/host/pci-mvebu.c
@@ -665,19 +665,6 @@ static int mvebu_pcie_setup(int nr, struct pci_sys_data *sys)
665 return 1; 665 return 1;
666} 666}
667 667
668static int mvebu_pcie_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
669{
670 struct of_irq oirq;
671 int ret;
672
673 ret = of_irq_map_pci(dev, &oirq);
674 if (ret)
675 return ret;
676
677 return irq_create_of_mapping(oirq.controller, oirq.specifier,
678 oirq.size);
679}
680
681static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys) 668static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys)
682{ 669{
683 struct mvebu_pcie *pcie = sys_to_pcie(sys); 670 struct mvebu_pcie *pcie = sys_to_pcie(sys);
@@ -732,7 +719,7 @@ static void mvebu_pcie_enable(struct mvebu_pcie *pcie)
732 hw.private_data = (void **)&pcie; 719 hw.private_data = (void **)&pcie;
733 hw.setup = mvebu_pcie_setup; 720 hw.setup = mvebu_pcie_setup;
734 hw.scan = mvebu_pcie_scan_bus; 721 hw.scan = mvebu_pcie_scan_bus;
735 hw.map_irq = mvebu_pcie_map_irq; 722 hw.map_irq = of_irq_parse_and_map_pci;
736 hw.ops = &mvebu_pcie_ops; 723 hw.ops = &mvebu_pcie_ops;
737 hw.align_resource = mvebu_pcie_align_resource; 724 hw.align_resource = mvebu_pcie_align_resource;
738 hw.add_bus = mvebu_pcie_add_bus; 725 hw.add_bus = mvebu_pcie_add_bus;
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c
index a007321ad314..1b206eac5f93 100644
--- a/drivers/pcmcia/electra_cf.c
+++ b/drivers/pcmcia/electra_cf.c
@@ -30,6 +30,8 @@
30#include <linux/interrupt.h> 30#include <linux/interrupt.h>
31#include <linux/mm.h> 31#include <linux/mm.h>
32#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
33#include <linux/of_address.h>
34#include <linux/of_irq.h>
33#include <linux/of_platform.h> 35#include <linux/of_platform.h>
34#include <linux/slab.h> 36#include <linux/slab.h>
35 37
diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c
index 18c0d8d1ddf7..182034d2ef58 100644
--- a/drivers/pcmcia/m8xx_pcmcia.c
+++ b/drivers/pcmcia/m8xx_pcmcia.c
@@ -48,7 +48,9 @@
48#include <linux/interrupt.h> 48#include <linux/interrupt.h>
49#include <linux/fsl_devices.h> 49#include <linux/fsl_devices.h>
50#include <linux/bitops.h> 50#include <linux/bitops.h>
51#include <linux/of_address.h>
51#include <linux/of_device.h> 52#include <linux/of_device.h>
53#include <linux/of_irq.h>
52#include <linux/of_platform.h> 54#include <linux/of_platform.h>
53 55
54#include <asm/io.h> 56#include <asm/io.h>
diff --git a/drivers/rtc/rtc-mpc5121.c b/drivers/rtc/rtc-mpc5121.c
index 9c8f60903799..dc4f14255cc3 100644
--- a/drivers/rtc/rtc-mpc5121.c
+++ b/drivers/rtc/rtc-mpc5121.c
@@ -14,7 +14,9 @@
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/rtc.h> 15#include <linux/rtc.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/of_address.h>
17#include <linux/of_device.h> 18#include <linux/of_device.h>
19#include <linux/of_irq.h>
18#include <linux/of_platform.h> 20#include <linux/of_platform.h>
19#include <linux/io.h> 21#include <linux/io.h>
20#include <linux/slab.h> 22#include <linux/slab.h>
diff --git a/drivers/spi/spi-fsl-cpm.c b/drivers/spi/spi-fsl-cpm.c
index 58630edb8c21..54b06376f03c 100644
--- a/drivers/spi/spi-fsl-cpm.c
+++ b/drivers/spi/spi-fsl-cpm.c
@@ -20,6 +20,7 @@
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/fsl_devices.h> 21#include <linux/fsl_devices.h>
22#include <linux/dma-mapping.h> 22#include <linux/dma-mapping.h>
23#include <linux/of_address.h>
23#include <asm/cpm.h> 24#include <asm/cpm.h>
24#include <asm/qe.h> 25#include <asm/qe.h>
25 26
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index 43222d7532d1..32200d4f8780 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -16,6 +16,8 @@
16#include <linux/fsl_devices.h> 16#include <linux/fsl_devices.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/of_address.h>
20#include <linux/of_irq.h>
19#include <linux/of_platform.h> 21#include <linux/of_platform.h>
20#include <linux/interrupt.h> 22#include <linux/interrupt.h>
21#include <linux/err.h> 23#include <linux/err.h>
@@ -687,7 +689,7 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
687 struct device_node *np = ofdev->dev.of_node; 689 struct device_node *np = ofdev->dev.of_node;
688 struct spi_master *master; 690 struct spi_master *master;
689 struct resource mem; 691 struct resource mem;
690 struct resource irq; 692 unsigned int irq;
691 int ret = -ENOMEM; 693 int ret = -ENOMEM;
692 694
693 ret = of_mpc8xxx_spi_probe(ofdev); 695 ret = of_mpc8xxx_spi_probe(ofdev);
@@ -702,13 +704,13 @@ static int of_fsl_espi_probe(struct platform_device *ofdev)
702 if (ret) 704 if (ret)
703 goto err; 705 goto err;
704 706
705 ret = of_irq_to_resource(np, 0, &irq); 707 irq = irq_of_parse_and_map(np, 0);
706 if (!ret) { 708 if (!ret) {
707 ret = -EINVAL; 709 ret = -EINVAL;
708 goto err; 710 goto err;
709 } 711 }
710 712
711 master = fsl_espi_probe(dev, &mem, irq.start); 713 master = fsl_espi_probe(dev, &mem, irq);
712 if (IS_ERR(master)) { 714 if (IS_ERR(master)) {
713 ret = PTR_ERR(master); 715 ret = PTR_ERR(master);
714 goto err; 716 goto err;
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index ee6e61cbf7f5..58d5ee0e4443 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -20,6 +20,7 @@
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/of_address.h> 22#include <linux/of_address.h>
23#include <linux/of_irq.h>
23#include <linux/of_platform.h> 24#include <linux/of_platform.h>
24#include <linux/completion.h> 25#include <linux/completion.h>
25#include <linux/io.h> 26#include <linux/io.h>
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index c57740bb70d3..5ee56726f8d0 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -29,6 +29,8 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/errno.h> 30#include <linux/errno.h>
31#include <linux/wait.h> 31#include <linux/wait.h>
32#include <linux/of_address.h>
33#include <linux/of_irq.h>
32#include <linux/of_platform.h> 34#include <linux/of_platform.h>
33#include <linux/of_gpio.h> 35#include <linux/of_gpio.h>
34#include <linux/interrupt.h> 36#include <linux/interrupt.h>
diff --git a/drivers/tty/ehv_bytechan.c b/drivers/tty/ehv_bytechan.c
index 9bffcec5ad82..0419b69e270f 100644
--- a/drivers/tty/ehv_bytechan.c
+++ b/drivers/tty/ehv_bytechan.c
@@ -32,6 +32,7 @@
32#include <linux/poll.h> 32#include <linux/poll.h>
33#include <asm/epapr_hcalls.h> 33#include <asm/epapr_hcalls.h>
34#include <linux/of.h> 34#include <linux/of.h>
35#include <linux/of_irq.h>
35#include <linux/platform_device.h> 36#include <linux/platform_device.h>
36#include <linux/cdev.h> 37#include <linux/cdev.h>
37#include <linux/console.h> 38#include <linux/console.h>
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_core.c b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
index 1a535f70dc41..7d76214612c7 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_core.c
@@ -41,6 +41,8 @@
41#include <linux/bootmem.h> 41#include <linux/bootmem.h>
42#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
43#include <linux/fs_uart_pd.h> 43#include <linux/fs_uart_pd.h>
44#include <linux/of_address.h>
45#include <linux/of_irq.h>
44#include <linux/of_platform.h> 46#include <linux/of_platform.h>
45#include <linux/gpio.h> 47#include <linux/gpio.h>
46#include <linux/of_gpio.h> 48#include <linux/of_gpio.h>
@@ -1207,7 +1209,7 @@ static int cpm_uart_init_port(struct device_node *np,
1207 pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; 1209 pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize;
1208 spin_lock_init(&pinfo->port.lock); 1210 spin_lock_init(&pinfo->port.lock);
1209 1211
1210 pinfo->port.irq = of_irq_to_resource(np, 0, NULL); 1212 pinfo->port.irq = irq_of_parse_and_map(np, 0);
1211 if (pinfo->port.irq == NO_IRQ) { 1213 if (pinfo->port.irq == NO_IRQ) {
1212 ret = -EINVAL; 1214 ret = -EINVAL;
1213 goto out_pram; 1215 goto out_pram;
diff --git a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
index 18f79575894a..527a969b0952 100644
--- a/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
+++ b/drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
@@ -45,6 +45,7 @@
45#include <linux/kernel.h> 45#include <linux/kernel.h>
46 46
47#include <linux/of.h> 47#include <linux/of.h>
48#include <linux/of_address.h>
48 49
49#include "cpm_uart.h" 50#include "cpm_uart.h"
50 51
diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index 95917cefe14f..481b781b26e3 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -57,6 +57,8 @@
57#include <linux/bitops.h> 57#include <linux/bitops.h>
58#include <linux/sysrq.h> 58#include <linux/sysrq.h>
59#include <linux/mutex.h> 59#include <linux/mutex.h>
60#include <linux/of_address.h>
61#include <linux/of_irq.h>
60#include <asm/sections.h> 62#include <asm/sections.h>
61#include <asm/io.h> 63#include <asm/io.h>
62#include <asm/irq.h> 64#include <asm/irq.h>
diff --git a/drivers/tty/serial/ucc_uart.c b/drivers/tty/serial/ucc_uart.c
index 2fd1e1789811..d569ca58bab6 100644
--- a/drivers/tty/serial/ucc_uart.c
+++ b/drivers/tty/serial/ucc_uart.c
@@ -25,6 +25,8 @@
25#include <linux/tty.h> 25#include <linux/tty.h>
26#include <linux/tty_flip.h> 26#include <linux/tty_flip.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/of_address.h>
29#include <linux/of_irq.h>
28#include <linux/of_platform.h> 30#include <linux/of_platform.h>
29#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
30 32
diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index f3bb363f1d4a..807127d56fa3 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -33,6 +33,7 @@
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/moduleparam.h> 34#include <linux/moduleparam.h>
35#include <linux/of_address.h> 35#include <linux/of_address.h>
36#include <linux/of_irq.h>
36#include <linux/of_platform.h> 37#include <linux/of_platform.h>
37#include <linux/dma-mapping.h> 38#include <linux/dma-mapping.h>
38#include <linux/usb/ch9.h> 39#include <linux/usb/ch9.h>
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c
index 6cc5567bf9c8..875d2fcc9e0e 100644
--- a/drivers/usb/host/ehci-ppc-of.c
+++ b/drivers/usb/host/ehci-ppc-of.c
@@ -16,6 +16,8 @@
16#include <linux/signal.h> 16#include <linux/signal.h>
17 17
18#include <linux/of.h> 18#include <linux/of.h>
19#include <linux/of_address.h>
20#include <linux/of_irq.h>
19#include <linux/of_platform.h> 21#include <linux/of_platform.h>
20 22
21 23
diff --git a/drivers/usb/host/fhci-hcd.c b/drivers/usb/host/fhci-hcd.c
index 0b46542591ff..0551c0af0fd1 100644
--- a/drivers/usb/host/fhci-hcd.c
+++ b/drivers/usb/host/fhci-hcd.c
@@ -26,6 +26,8 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/usb.h> 27#include <linux/usb.h>
28#include <linux/usb/hcd.h> 28#include <linux/usb/hcd.h>
29#include <linux/of_address.h>
30#include <linux/of_irq.h>
29#include <linux/of_platform.h> 31#include <linux/of_platform.h>
30#include <linux/of_gpio.h> 32#include <linux/of_gpio.h>
31#include <linux/slab.h> 33#include <linux/slab.h>
diff --git a/drivers/usb/host/ohci-ppc-of.c b/drivers/usb/host/ohci-ppc-of.c
index 75f5a1e2f01e..81f3eba215c1 100644
--- a/drivers/usb/host/ohci-ppc-of.c
+++ b/drivers/usb/host/ohci-ppc-of.c
@@ -14,6 +14,8 @@
14 */ 14 */
15 15
16#include <linux/signal.h> 16#include <linux/signal.h>
17#include <linux/of_address.h>
18#include <linux/of_irq.h>
17#include <linux/of_platform.h> 19#include <linux/of_platform.h>
18 20
19#include <asm/prom.h> 21#include <asm/prom.h>
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 6dd72250111e..b047ec58ac30 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -31,6 +31,8 @@
31#include <linux/uaccess.h> 31#include <linux/uaccess.h>
32#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
33#include <linux/spinlock.h> 33#include <linux/spinlock.h>
34#include <linux/of_address.h>
35#include <linux/of_irq.h>
34 36
35#include <sysdev/fsl_soc.h> 37#include <sysdev/fsl_soc.h>
36#include <linux/fsl-diu-fb.h> 38#include <linux/fsl-diu-fb.h>
diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
index d294f67d6f84..32c8fc5f7a5c 100644
--- a/drivers/virt/fsl_hypervisor.c
+++ b/drivers/virt/fsl_hypervisor.c
@@ -34,6 +34,7 @@
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/poll.h> 35#include <linux/poll.h>
36#include <linux/of.h> 36#include <linux/of.h>
37#include <linux/of_irq.h>
37#include <linux/reboot.h> 38#include <linux/reboot.h>
38#include <linux/uaccess.h> 39#include <linux/uaccess.h>
39#include <linux/notifier.h> 40#include <linux/notifier.h>
diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index 257cfbad21da..3755833430dc 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -34,6 +34,7 @@
34#include <linux/watchdog.h> 34#include <linux/watchdog.h>
35#include <linux/fs.h> 35#include <linux/fs.h>
36#include <linux/of.h> 36#include <linux/of.h>
37#include <linux/of_address.h>
37#include <linux/of_platform.h> 38#include <linux/of_platform.h>
38#include <linux/io.h> 39#include <linux/io.h>
39#include <linux/uaccess.h> 40#include <linux/uaccess.h>
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index da2752063bb7..d0ebebae607c 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -24,6 +24,7 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/timer.h> 25#include <linux/timer.h>
26#include <linux/miscdevice.h> 26#include <linux/miscdevice.h>
27#include <linux/of_address.h>
27#include <linux/of_platform.h> 28#include <linux/of_platform.h>
28#include <linux/module.h> 29#include <linux/module.h>
29#include <linux/watchdog.h> 30#include <linux/watchdog.h>
diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c
index 7d3d471f810c..329bc60ad7a2 100644
--- a/drivers/watchdog/pika_wdt.c
+++ b/drivers/watchdog/pika_wdt.c
@@ -22,6 +22,7 @@
22#include <linux/bitops.h> 22#include <linux/bitops.h>
23#include <linux/uaccess.h> 23#include <linux/uaccess.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/of_address.h>
25#include <linux/of_platform.h> 26#include <linux/of_platform.h>
26 27
27#define DRV_NAME "PIKA-WDT" 28#define DRV_NAME "PIKA-WDT"
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c
index 106a83570630..70779b2fc209 100644
--- a/fs/proc/proc_devtree.c
+++ b/fs/proc/proc_devtree.c
@@ -14,16 +14,13 @@
14#include <linux/of.h> 14#include <linux/of.h>
15#include <linux/export.h> 15#include <linux/export.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <asm/prom.h>
18#include <asm/uaccess.h> 17#include <asm/uaccess.h>
19#include "internal.h" 18#include "internal.h"
20 19
21static inline void set_node_proc_entry(struct device_node *np, 20static inline void set_node_proc_entry(struct device_node *np,
22 struct proc_dir_entry *de) 21 struct proc_dir_entry *de)
23{ 22{
24#ifdef HAVE_ARCH_DEVTREE_FIXUPS
25 np->pde = de; 23 np->pde = de;
26#endif
27} 24}
28 25
29static struct proc_dir_entry *proc_device_tree; 26static struct proc_dir_entry *proc_device_tree;
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 801ff9e73679..fbd25c3c2923 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -18,6 +18,7 @@
18#include <linux/cpumask.h> 18#include <linux/cpumask.h>
19 19
20struct device; 20struct device;
21struct device_node;
21 22
22struct cpu { 23struct cpu {
23 int node_id; /* The node which contains the CPU */ 24 int node_id; /* The node which contains the CPU */
@@ -29,6 +30,8 @@ extern int register_cpu(struct cpu *cpu, int num);
29extern struct device *get_cpu_device(unsigned cpu); 30extern struct device *get_cpu_device(unsigned cpu);
30extern bool cpu_is_hotpluggable(unsigned cpu); 31extern bool cpu_is_hotpluggable(unsigned cpu);
31extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id); 32extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id);
33extern bool arch_find_n_match_cpu_physical_id(struct device_node *cpun,
34 int cpu, unsigned int *thread);
32 35
33extern int cpu_add_dev_attr(struct device_attribute *attr); 36extern int cpu_add_dev_attr(struct device_attribute *attr);
34extern void cpu_remove_dev_attr(struct device_attribute *attr); 37extern void cpu_remove_dev_attr(struct device_attribute *attr);
diff --git a/include/linux/of.h b/include/linux/of.h
index ebf75f760bd3..276c546980d8 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -136,7 +136,9 @@ static inline unsigned long of_read_ulong(const __be32 *cell, int size)
136 return of_read_number(cell, size); 136 return of_read_number(cell, size);
137} 137}
138 138
139#if defined(CONFIG_SPARC)
139#include <asm/prom.h> 140#include <asm/prom.h>
141#endif
140 142
141/* Default #address and #size cells. Allow arch asm/prom.h to override */ 143/* Default #address and #size cells. Allow arch asm/prom.h to override */
142#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT) 144#if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT)
@@ -288,6 +290,7 @@ extern int of_n_size_cells(struct device_node *np);
288extern const struct of_device_id *of_match_node( 290extern const struct of_device_id *of_match_node(
289 const struct of_device_id *matches, const struct device_node *node); 291 const struct of_device_id *matches, const struct device_node *node);
290extern int of_modalias_node(struct device_node *node, char *modalias, int len); 292extern int of_modalias_node(struct device_node *node, char *modalias, int len);
293extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args);
291extern struct device_node *of_parse_phandle(const struct device_node *np, 294extern struct device_node *of_parse_phandle(const struct device_node *np,
292 const char *phandle_name, 295 const char *phandle_name,
293 int index); 296 int index);
@@ -377,6 +380,9 @@ static inline bool of_have_populated_dt(void)
377#define for_each_child_of_node(parent, child) \ 380#define for_each_child_of_node(parent, child) \
378 while (0) 381 while (0)
379 382
383#define for_each_available_child_of_node(parent, child) \
384 while (0)
385
380static inline struct device_node *of_get_child_by_name( 386static inline struct device_node *of_get_child_by_name(
381 const struct device_node *node, 387 const struct device_node *node,
382 const char *name) 388 const char *name)
@@ -552,13 +558,10 @@ static inline const char *of_prop_next_string(struct property *prop,
552#define of_match_node(_matches, _node) NULL 558#define of_match_node(_matches, _node) NULL
553#endif /* CONFIG_OF */ 559#endif /* CONFIG_OF */
554 560
555#ifndef of_node_to_nid 561#if defined(CONFIG_OF) && defined(CONFIG_NUMA)
556static inline int of_node_to_nid(struct device_node *np) 562extern int of_node_to_nid(struct device_node *np);
557{ 563#else
558 return numa_node_id(); 564static inline int of_node_to_nid(struct device_node *device) { return 0; }
559}
560
561#define of_node_to_nid of_node_to_nid
562#endif 565#endif
563 566
564/** 567/**
diff --git a/include/linux/of_address.h b/include/linux/of_address.h
index 4c2e6f26432c..5f6ed6b182b8 100644
--- a/include/linux/of_address.h
+++ b/include/linux/of_address.h
@@ -34,6 +34,10 @@ static inline void of_pci_range_to_resource(struct of_pci_range *range,
34 res->name = np->full_name; 34 res->name = np->full_name;
35} 35}
36 36
37/* Translate a DMA address from device space to CPU space */
38extern u64 of_translate_dma_address(struct device_node *dev,
39 const __be32 *in_addr);
40
37#ifdef CONFIG_OF_ADDRESS 41#ifdef CONFIG_OF_ADDRESS
38extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 42extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
39extern bool of_can_translate_address(struct device_node *dev); 43extern bool of_can_translate_address(struct device_node *dev);
@@ -52,10 +56,7 @@ extern void __iomem *of_iomap(struct device_node *device, int index);
52extern const __be32 *of_get_address(struct device_node *dev, int index, 56extern const __be32 *of_get_address(struct device_node *dev, int index,
53 u64 *size, unsigned int *flags); 57 u64 *size, unsigned int *flags);
54 58
55#ifndef pci_address_to_pio 59extern unsigned long pci_address_to_pio(phys_addr_t addr);
56static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }
57#define pci_address_to_pio pci_address_to_pio
58#endif
59 60
60extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, 61extern int of_pci_range_parser_init(struct of_pci_range_parser *parser,
61 struct device_node *node); 62 struct device_node *node);
@@ -63,13 +64,6 @@ extern struct of_pci_range *of_pci_range_parser_one(
63 struct of_pci_range_parser *parser, 64 struct of_pci_range_parser *parser,
64 struct of_pci_range *range); 65 struct of_pci_range *range);
65#else /* CONFIG_OF_ADDRESS */ 66#else /* CONFIG_OF_ADDRESS */
66#ifndef of_address_to_resource
67static inline int of_address_to_resource(struct device_node *dev, int index,
68 struct resource *r)
69{
70 return -EINVAL;
71}
72#endif
73static inline struct device_node *of_find_matching_node_by_address( 67static inline struct device_node *of_find_matching_node_by_address(
74 struct device_node *from, 68 struct device_node *from,
75 const struct of_device_id *matches, 69 const struct of_device_id *matches,
@@ -77,12 +71,7 @@ static inline struct device_node *of_find_matching_node_by_address(
77{ 71{
78 return NULL; 72 return NULL;
79} 73}
80#ifndef of_iomap 74
81static inline void __iomem *of_iomap(struct device_node *device, int index)
82{
83 return NULL;
84}
85#endif
86static inline const __be32 *of_get_address(struct device_node *dev, int index, 75static inline const __be32 *of_get_address(struct device_node *dev, int index,
87 u64 *size, unsigned int *flags) 76 u64 *size, unsigned int *flags)
88{ 77{
@@ -103,6 +92,22 @@ static inline struct of_pci_range *of_pci_range_parser_one(
103} 92}
104#endif /* CONFIG_OF_ADDRESS */ 93#endif /* CONFIG_OF_ADDRESS */
105 94
95#ifdef CONFIG_OF
96extern int of_address_to_resource(struct device_node *dev, int index,
97 struct resource *r);
98void __iomem *of_iomap(struct device_node *node, int index);
99#else
100static inline int of_address_to_resource(struct device_node *dev, int index,
101 struct resource *r)
102{
103 return -EINVAL;
104}
105
106static inline void __iomem *of_iomap(struct device_node *device, int index)
107{
108 return NULL;
109}
110#endif
106 111
107#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) 112#if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI)
108extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, 113extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h
index a478c62a2aab..0beaee9dac1f 100644
--- a/include/linux/of_fdt.h
+++ b/include/linux/of_fdt.h
@@ -96,31 +96,30 @@ extern int of_scan_flat_dt_by_path(const char *path,
96 96
97extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 97extern int early_init_dt_scan_chosen(unsigned long node, const char *uname,
98 int depth, void *data); 98 int depth, void *data);
99extern void early_init_dt_check_for_initrd(unsigned long node);
100extern int early_init_dt_scan_memory(unsigned long node, const char *uname, 99extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
101 int depth, void *data); 100 int depth, void *data);
102extern void early_init_dt_add_memory_arch(u64 base, u64 size); 101extern void early_init_dt_add_memory_arch(u64 base, u64 size);
103extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 102extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
104extern u64 dt_mem_next_cell(int s, __be32 **cellp); 103extern u64 dt_mem_next_cell(int s, __be32 **cellp);
105 104
106/*
107 * If BLK_DEV_INITRD, the fdt early init code will call this function,
108 * to be provided by the arch code. start and end are specified as
109 * physical addresses.
110 */
111#ifdef CONFIG_BLK_DEV_INITRD
112extern void early_init_dt_setup_initrd_arch(u64 start, u64 end);
113#endif
114
115/* Early flat tree scan hooks */ 105/* Early flat tree scan hooks */
116extern int early_init_dt_scan_root(unsigned long node, const char *uname, 106extern int early_init_dt_scan_root(unsigned long node, const char *uname,
117 int depth, void *data); 107 int depth, void *data);
118 108
109extern bool early_init_dt_scan(void *params);
110
111extern const char *of_flat_dt_get_machine_name(void);
112extern const void *of_flat_dt_match_machine(const void *default_match,
113 const void * (*get_next_compat)(const char * const**));
114
119/* Other Prototypes */ 115/* Other Prototypes */
120extern void unflatten_device_tree(void); 116extern void unflatten_device_tree(void);
117extern void unflatten_and_copy_device_tree(void);
121extern void early_init_devtree(void *); 118extern void early_init_devtree(void *);
122#else /* CONFIG_OF_FLATTREE */ 119#else /* CONFIG_OF_FLATTREE */
120static inline const char *of_flat_dt_get_machine_name(void) { return NULL; }
123static inline void unflatten_device_tree(void) {} 121static inline void unflatten_device_tree(void) {}
122static inline void unflatten_and_copy_device_tree(void) {}
124#endif /* CONFIG_OF_FLATTREE */ 123#endif /* CONFIG_OF_FLATTREE */
125 124
126#endif /* __ASSEMBLY__ */ 125#endif /* __ASSEMBLY__ */
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index fcd63baee5f2..3f23b4472c31 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -8,22 +8,6 @@
8#include <linux/ioport.h> 8#include <linux/ioport.h>
9#include <linux/of.h> 9#include <linux/of.h>
10 10
11/**
12 * of_irq - container for device_node/irq_specifier pair for an irq controller
13 * @controller: pointer to interrupt controller device tree node
14 * @size: size of interrupt specifier
15 * @specifier: array of cells @size long specifing the specific interrupt
16 *
17 * This structure is returned when an interrupt is mapped. The controller
18 * field needs to be put() after use
19 */
20#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
21struct of_irq {
22 struct device_node *controller; /* Interrupt controller node */
23 u32 size; /* Specifier size */
24 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
25};
26
27typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); 11typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
28 12
29/* 13/*
@@ -35,35 +19,38 @@ typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
35#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) 19#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
36extern unsigned int of_irq_workarounds; 20extern unsigned int of_irq_workarounds;
37extern struct device_node *of_irq_dflt_pic; 21extern struct device_node *of_irq_dflt_pic;
38extern int of_irq_map_oldworld(struct device_node *device, int index, 22extern int of_irq_parse_oldworld(struct device_node *device, int index,
39 struct of_irq *out_irq); 23 struct of_phandle_args *out_irq);
40#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 24#else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
41#define of_irq_workarounds (0) 25#define of_irq_workarounds (0)
42#define of_irq_dflt_pic (NULL) 26#define of_irq_dflt_pic (NULL)
43static inline int of_irq_map_oldworld(struct device_node *device, int index, 27static inline int of_irq_parse_oldworld(struct device_node *device, int index,
44 struct of_irq *out_irq) 28 struct of_phandle_args *out_irq)
45{ 29{
46 return -EINVAL; 30 return -EINVAL;
47} 31}
48#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 32#endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
49 33
50 34extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq);
51extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 35extern int of_irq_parse_one(struct device_node *device, int index,
52 u32 ointsize, const __be32 *addr, 36 struct of_phandle_args *out_irq);
53 struct of_irq *out_irq); 37extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
54extern int of_irq_map_one(struct device_node *device, int index,
55 struct of_irq *out_irq);
56extern unsigned int irq_create_of_mapping(struct device_node *controller,
57 const u32 *intspec,
58 unsigned int intsize);
59extern int of_irq_to_resource(struct device_node *dev, int index, 38extern int of_irq_to_resource(struct device_node *dev, int index,
60 struct resource *r); 39 struct resource *r);
61extern int of_irq_count(struct device_node *dev);
62extern int of_irq_to_resource_table(struct device_node *dev, 40extern int of_irq_to_resource_table(struct device_node *dev,
63 struct resource *res, int nr_irqs); 41 struct resource *res, int nr_irqs);
64 42
65extern void of_irq_init(const struct of_device_id *matches); 43extern void of_irq_init(const struct of_device_id *matches);
66 44
45#ifdef CONFIG_OF_IRQ
46extern int of_irq_count(struct device_node *dev);
47#else
48static inline int of_irq_count(struct device_node *dev)
49{
50 return 0;
51}
52#endif
53
67#if defined(CONFIG_OF) 54#if defined(CONFIG_OF)
68/* 55/*
69 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC 56 * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h
index fd9c408631a0..1a1f5ffd5288 100644
--- a/include/linux/of_pci.h
+++ b/include/linux/of_pci.h
@@ -5,8 +5,9 @@
5#include <linux/msi.h> 5#include <linux/msi.h>
6 6
7struct pci_dev; 7struct pci_dev;
8struct of_irq; 8struct of_phandle_args;
9int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq); 9int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq);
10int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin);
10 11
11struct device_node; 12struct device_node;
12struct device_node *of_pci_find_child_device(struct device_node *parent, 13struct device_node *of_pci_find_child_device(struct device_node *parent,
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 706724e9835d..cf68bb36fe58 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -465,27 +465,26 @@ int irq_create_strict_mappings(struct irq_domain *domain, unsigned int irq_base,
465} 465}
466EXPORT_SYMBOL_GPL(irq_create_strict_mappings); 466EXPORT_SYMBOL_GPL(irq_create_strict_mappings);
467 467
468unsigned int irq_create_of_mapping(struct device_node *controller, 468unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
469 const u32 *intspec, unsigned int intsize)
470{ 469{
471 struct irq_domain *domain; 470 struct irq_domain *domain;
472 irq_hw_number_t hwirq; 471 irq_hw_number_t hwirq;
473 unsigned int type = IRQ_TYPE_NONE; 472 unsigned int type = IRQ_TYPE_NONE;
474 unsigned int virq; 473 unsigned int virq;
475 474
476 domain = controller ? irq_find_host(controller) : irq_default_domain; 475 domain = irq_data->np ? irq_find_host(irq_data->np) : irq_default_domain;
477 if (!domain) { 476 if (!domain) {
478 pr_warn("no irq domain found for %s !\n", 477 pr_warn("no irq domain found for %s !\n",
479 of_node_full_name(controller)); 478 of_node_full_name(irq_data->np));
480 return 0; 479 return 0;
481 } 480 }
482 481
483 /* If domain has no translation, then we assume interrupt line */ 482 /* If domain has no translation, then we assume interrupt line */
484 if (domain->ops->xlate == NULL) 483 if (domain->ops->xlate == NULL)
485 hwirq = intspec[0]; 484 hwirq = irq_data->args[0];
486 else { 485 else {
487 if (domain->ops->xlate(domain, controller, intspec, intsize, 486 if (domain->ops->xlate(domain, irq_data->np, irq_data->args,
488 &hwirq, &type)) 487 irq_data->args_count, &hwirq, &type))
489 return 0; 488 return 0;
490 } 489 }
491 490
diff --git a/sound/aoa/core/gpio-feature.c b/sound/aoa/core/gpio-feature.c
index faa317490545..f34153962d07 100644
--- a/sound/aoa/core/gpio-feature.c
+++ b/sound/aoa/core/gpio-feature.c
@@ -10,8 +10,9 @@
10 * registers. 10 * registers.
11 */ 11 */
12 12
13#include <asm/pmac_feature.h> 13#include <linux/of_irq.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <asm/pmac_feature.h>
15#include "../aoa.h" 16#include "../aoa.h"
16 17
17/* TODO: these are lots of global variables 18/* TODO: these are lots of global variables
diff --git a/sound/aoa/soundbus/i2sbus/core.c b/sound/aoa/soundbus/i2sbus/core.c
index 15e76131b501..467836057ee5 100644
--- a/sound/aoa/soundbus/i2sbus/core.c
+++ b/sound/aoa/soundbus/i2sbus/core.c
@@ -11,6 +11,8 @@
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
14#include <linux/of_address.h>
15#include <linux/of_irq.h>
14 16
15#include <sound/core.h> 17#include <sound/core.h>
16 18
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index c93fbbb201fe..7a43c0c38316 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -28,6 +28,8 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/pci.h> 29#include <linux/pci.h>
30#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
31#include <linux/of_address.h>
32#include <linux/of_irq.h>
31#include <sound/core.h> 33#include <sound/core.h>
32#include "pmac.h" 34#include "pmac.h"
33#include <sound/pcm_params.h> 35#include <sound/pcm_params.h>
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index b23354a4ceca..b9ffc17a4799 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -31,6 +31,7 @@
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/string.h> 33#include <linux/string.h>
34#include <linux/of_irq.h>
34#include <sound/core.h> 35#include <sound/core.h>
35#include <asm/io.h> 36#include <asm/io.h>
36#include <asm/irq.h> 37#include <asm/irq.h>
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 9cc5c1f82f09..d1b111e7fc07 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -21,6 +21,8 @@
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/gfp.h> 23#include <linux/gfp.h>
24#include <linux/of_address.h>
25#include <linux/of_irq.h>
24#include <linux/of_platform.h> 26#include <linux/of_platform.h>
25#include <linux/list.h> 27#include <linux/list.h>
26#include <linux/slab.h> 28#include <linux/slab.h>
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 2a847ca494b5..161e5055ce94 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -10,6 +10,8 @@
10#include <linux/of_device.h> 10#include <linux/of_device.h>
11#include <linux/dma-mapping.h> 11#include <linux/dma-mapping.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/of_address.h>
14#include <linux/of_irq.h>
13#include <linux/of_platform.h> 15#include <linux/of_platform.h>
14 16
15#include <sound/soc.h> 17#include <sound/soc.h>
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 3ef7a0c92efa..24eafa2cfbf4 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -291,7 +291,7 @@ static int psc_ac97_of_probe(struct platform_device *op)
291 291
292 rc = snd_soc_set_ac97_ops(&psc_ac97_ops); 292 rc = snd_soc_set_ac97_ops(&psc_ac97_ops);
293 if (rc != 0) { 293 if (rc != 0) {
294 dev_err(&op->dev, "Failed to set AC'97 ops: %d\n", ret); 294 dev_err(&op->dev, "Failed to set AC'97 ops: %d\n", rc);
295 return rc; 295 return rc;
296 } 296 }
297 297
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 228c52e71440..fa756d05b2f7 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/of_address.h>
15#include <linux/of_device.h> 16#include <linux/of_device.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
17#include <sound/soc.h> 18#include <sound/soc.h>
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index ba59c23a137b..f75c3cf0e6de 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/of_address.h>
15#include <linux/of_device.h> 16#include <linux/of_device.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
17#include <sound/soc.h> 18#include <sound/soc.h>
diff --git a/sound/soc/fsl/p1022_rdk.c b/sound/soc/fsl/p1022_rdk.c
index f21551911533..9d89bb028621 100644
--- a/sound/soc/fsl/p1022_rdk.c
+++ b/sound/soc/fsl/p1022_rdk.c
@@ -19,6 +19,7 @@
19 19
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/interrupt.h> 21#include <linux/interrupt.h>
22#include <linux/of_address.h>
22#include <linux/of_device.h> 23#include <linux/of_device.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <sound/soc.h> 25#include <sound/soc.h>