Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux

Pull devicetree updates from Rob Herring:
"DeviceTree updates for 3.13. This is a bit larger pull request than
usual for this cycle with lots of clean-up.

- Cross arch clean-up and consolidation of early DT scanning code.
- Clean-up and removal of arch prom.h headers. Makes arch specific
prom.h optional on all but Sparc.
- Addition of interrupts-extended property for devices connected to
multiple interrupt controllers.
- Refactoring of DT interrupt parsing code in preparation for
deferred probe of interrupts.
- ARM cpu and cpu topology bindings documentation.
- Various DT vendor binding documentation updates"

* tag 'devicetree-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (82 commits)
powerpc: add missing explicit OF includes for ppc
dt/irq: add empty of_irq_count for !OF_IRQ
dt: disable self-tests for !OF_IRQ
of: irq: Fix interrupt-map entry matching
MIPS: Netlogic: replace early_init_devtree() call
of: Add Panasonic Corporation vendor prefix
of: Add Chunghwa Picture Tubes Ltd. vendor prefix
of: Add AU Optronics Corporation vendor prefix
of/irq: Fix potential buffer overflow
of/irq: Fix bug in interrupt parsing refactor.
of: set dma_mask to point to coherent_dma_mask
of: add vendor prefix for PHYTEC Messtechnik GmbH
DT: sort vendor-prefixes.txt
of: Add vendor prefix for Cadence
of: Add empty for_each_available_child_of_node() macro definition
arm/versatile: Fix versatile irq specifications.
of/irq: create interrupts-extended property
microblaze/pci: Drop PowerPC-ism from irq parsing
of/irq: Create of_irq_parse_and_map_pci() to consolidate arch code.
of/irq: Use irq_of_parse_and_map()
...

+1918 -1248
+350 -43
Documentation/devicetree/bindings/arm/cpus.txt
··· 1 - * ARM CPUs binding description 1 + ================= 2 + ARM CPUs bindings 3 + ================= 2 4 3 5 The device tree allows to describe the layout of CPUs in a system through 4 6 the "cpus" node, which in turn contains a number of subnodes (ie "cpu") 5 7 defining properties for every cpu. 6 8 7 - Bindings for CPU nodes follow the ePAPR standard, available from: 9 + Bindings for CPU nodes follow the ePAPR v1.1 standard, available from: 8 10 9 - http://devicetree.org 11 + https://www.power.org/documentation/epapr-version-1-1/ 10 12 11 - For the ARM architecture every CPU node must contain the following properties: 13 + with updates for 32-bit and 64-bit ARM systems provided in this document. 12 14 13 - - device_type: must be "cpu" 14 - - reg: property matching the CPU MPIDR[23:0] register bits 15 - reg[31:24] bits must be set to 0 16 - - compatible: should be one of: 17 - "arm,arm1020" 18 - "arm,arm1020e" 19 - "arm,arm1022" 20 - "arm,arm1026" 21 - "arm,arm720" 22 - "arm,arm740" 23 - "arm,arm7tdmi" 24 - "arm,arm920" 25 - "arm,arm922" 26 - "arm,arm925" 27 - "arm,arm926" 28 - "arm,arm940" 29 - "arm,arm946" 30 - "arm,arm9tdmi" 31 - "arm,cortex-a5" 32 - "arm,cortex-a7" 33 - "arm,cortex-a8" 34 - "arm,cortex-a9" 35 - "arm,cortex-a15" 36 - "arm,arm1136" 37 - "arm,arm1156" 38 - "arm,arm1176" 39 - "arm,arm11mpcore" 40 - "faraday,fa526" 41 - "intel,sa110" 42 - "intel,sa1100" 43 - "marvell,feroceon" 44 - "marvell,mohawk" 45 - "marvell,xsc3" 46 - "marvell,xscale" 15 + ================================ 16 + Convention used in this document 17 + ================================ 47 18 48 - Example: 19 + This document follows the conventions described in the ePAPR v1.1, with 20 + the addition: 21 + 22 + - square brackets define bitfields, eg reg[7:0] value of the bitfield in 23 + the reg property contained in bits 7 down to 0 24 + 25 + ===================================== 26 + cpus and cpu node bindings definition 27 + ===================================== 28 + 29 + The ARM architecture, in accordance with the ePAPR, requires the cpus and cpu 30 + nodes to be present and contain the properties described below. 31 + 32 + - cpus node 33 + 34 + Description: Container of cpu nodes 35 + 36 + The node name must be "cpus". 37 + 38 + A cpus node must define the following properties: 39 + 40 + - #address-cells 41 + Usage: required 42 + Value type: <u32> 43 + 44 + Definition depends on ARM architecture version and 45 + configuration: 46 + 47 + # On uniprocessor ARM architectures previous to v7 48 + value must be 1, to enable a simple enumeration 49 + scheme for processors that do not have a HW CPU 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 + 194 + Example 1 (dual-cluster big.LITTLE system 32-bit): 49 195 50 196 cpus { 51 197 #size-cells = <0>; 52 198 #address-cells = <1>; 53 199 54 - CPU0: cpu@0 { 200 + cpu@0 { 55 201 device_type = "cpu"; 56 202 compatible = "arm,cortex-a15"; 57 203 reg = <0x0>; 58 204 }; 59 205 60 - CPU1: cpu@1 { 206 + cpu@1 { 61 207 device_type = "cpu"; 62 208 compatible = "arm,cortex-a15"; 63 209 reg = <0x1>; 64 210 }; 65 211 66 - CPU2: cpu@100 { 212 + cpu@100 { 67 213 device_type = "cpu"; 68 214 compatible = "arm,cortex-a7"; 69 215 reg = <0x100>; 70 216 }; 71 217 72 - CPU3: cpu@101 { 218 + cpu@101 { 73 219 device_type = "cpu"; 74 220 compatible = "arm,cortex-a7"; 75 221 reg = <0x101>; 76 222 }; 77 223 }; 224 + 225 + Example 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 + 238 + Example 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 + 251 + Example 4 (ARM Cortex-A57 64-bit system): 252 + 253 + cpus { 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 + };
+474
Documentation/devicetree/bindings/arm/topology.txt
··· 1 + =========================================== 2 + ARM topology binding description 3 + =========================================== 4 + 5 + =========================================== 6 + 1 - Introduction 7 + =========================================== 8 + 9 + In an ARM system, the hierarchy of CPUs is defined through three entities that 10 + are used to describe the layout of physical CPUs in the system: 11 + 12 + - cluster 13 + - core 14 + - thread 15 + 16 + The cpu nodes (bindings defined in [1]) represent the devices that 17 + correspond to physical CPUs and are to be mapped to the hierarchy levels. 18 + 19 + The bottom hierarchy level sits at core or thread level depending on whether 20 + symmetric multi-threading (SMT) is supported or not. 21 + 22 + For instance in a system where CPUs support SMT, "cpu" nodes represent all 23 + threads existing in the system and map to the hierarchy level "thread" above. 24 + In systems where SMT is not supported "cpu" nodes represent all cores present 25 + in the system and map to the hierarchy level "core" above. 26 + 27 + ARM topology bindings allow one to associate cpu nodes with hierarchical groups 28 + corresponding to the system hierarchy; syntactically they are defined as device 29 + tree nodes. 30 + 31 + The remainder of this document provides the topology bindings for ARM, based 32 + on the ePAPR standard, available from: 33 + 34 + http://www.power.org/documentation/epapr-version-1-1/ 35 + 36 + If not stated otherwise, whenever a reference to a cpu node phandle is made its 37 + value must point to a cpu node compliant with the cpu node bindings as 38 + documented in [1]. 39 + A topology description containing phandles to cpu nodes that are not compliant 40 + with bindings standardized in [1] is therefore considered invalid. 41 + 42 + =========================================== 43 + 2 - cpu-map node 44 + =========================================== 45 + 46 + The ARM CPU topology is defined within the cpu-map node, which is a direct 47 + child of the cpus node and provides a container where the actual topology 48 + nodes 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 + 70 + The cpu-map node can only contain three types of child nodes: 71 + 72 + - cluster node 73 + - core node 74 + - thread node 75 + 76 + whose bindings are described in paragraph 3. 77 + 78 + The nodes describing the CPU topology (cluster/core/thread) can only be 79 + defined within the cpu-map node. 80 + Any other configuration is consider invalid and therefore must be ignored. 81 + 82 + =========================================== 83 + 2.1 - cpu-map child nodes naming convention 84 + =========================================== 85 + 86 + cpu-map child nodes must follow a naming convention where the node name 87 + must be "clusterN", "coreN", "threadN" depending on the node type (ie 88 + cluster/core/thread) (where N = {0, 1, ...} is the node number; nodes which 89 + are siblings within a single common parent node must be given a unique and 90 + sequential N value, starting from 0). 91 + cpu-map child nodes which do not share a common parent node can have the same 92 + name (ie same number N as other cpu-map child nodes at different device tree 93 + levels) since name uniqueness will be guaranteed by the device tree hierarchy. 94 + 95 + =========================================== 96 + 3 - cluster/core/thread node bindings 97 + =========================================== 98 + 99 + Bindings 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 + =========================================== 163 + 4 - Example dts 164 + =========================================== 165 + 166 + Example 1 (ARM 64-bit, 16-cpu system, two clusters of clusters): 167 + 168 + cpus { 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 + 385 + Example 2 (ARM 32-bit, dual-cluster, 8-cpu system, no SMT): 386 + 387 + cpus { 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
+23 -6
Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
··· 4 4 1) Interrupt client nodes 5 5 ------------------------- 6 6 7 - Nodes that describe devices which generate interrupts must contain an 8 - "interrupts" property. This property must contain a list of interrupt 9 - specifiers, one per output interrupt. The format of the interrupt specifier is 10 - determined by the interrupt controller to which the interrupts are routed; see 11 - section 2 below for details. 7 + Nodes that describe devices which generate interrupts must contain an either an 8 + "interrupts" property or an "interrupts-extended" property. These properties 9 + contain a list of interrupt specifiers, one per output interrupt. The format of 10 + the interrupt specifier is determined by the interrupt controller to which the 11 + interrupts are routed; see section 2 below for details. 12 + 13 + Example: 14 + interrupt-parent = <&intc1>; 15 + interrupts = <5 0>, <6 0>; 12 16 13 17 The "interrupt-parent" property is used to specify the controller to which 14 18 interrupts are routed and contains a single phandle referring to the interrupt 15 19 controller node. This property is inherited, so it may be specified in an 16 - interrupt client node or in any of its parent nodes. 20 + interrupt 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 + 23 + The "interrupts-extended" property is a special form for use when a node needs 24 + to reference multiple interrupt parents. Each entry in this property contains 25 + both the parent phandle and the interrupt specifier. "interrupts-extended" 26 + should only be used when a device has multiple interrupt parents. 27 + 28 + Example: 29 + interrupts-extended = <&intc1 5 1>, <&intc2 1 0>; 30 + 31 + A device node may contain either "interrupts" or "interrupts-extended", but not 32 + both. If both properties are present, then the operating system should log an 33 + error and use only the data in "interrupts". 17 34 18 35 2) Interrupt controller nodes 19 36 -----------------------------
+7 -2
Documentation/devicetree/bindings/vendor-prefixes.txt
··· 12 12 apm Applied Micro Circuits Corporation (APM) 13 13 arm ARM Ltd. 14 14 atmel Atmel Corporation 15 + auo AU Optronics Corporation 15 16 avago Avago Technologies 16 17 bosch Bosch Sensortec GmbH 17 18 brcm Broadcom Corporation 18 19 capella Capella Microsystems, Inc 19 20 cavium Cavium, Inc. 21 + cdns Cadence Design Systems Inc. 20 22 chrp Common Hardware Reference Platform 23 + chunghwa Chunghwa Picture Tubes Ltd. 21 24 cirrus Cirrus Logic, Inc. 22 25 cortina Cortina Systems, Inc. 23 26 dallas Maxim Integrated Products (formerly Dallas Semiconductor) ··· 49 46 nvidia NVIDIA 50 47 nxp NXP Semiconductors 51 48 onnn ON Semiconductor Corp. 49 + panasonic Panasonic Corporation 50 + phytec PHYTEC Messtechnik GmbH 52 51 picochip Picochip Ltd 53 52 powervr PowerVR (deprecated, use img) 54 53 qca Qualcomm Atheros, Inc. ··· 70 65 st STMicroelectronics 71 66 ste ST-Ericsson 72 67 stericsson ST-Ericsson 73 - toumaz Toumaz 74 68 ti Texas Instruments 75 69 toshiba Toshiba Corporation 70 + toumaz Toumaz 76 71 v3 V3 Semiconductor 77 72 via VIA Technologies, Inc. 73 + winbond Winbond Electronics corp. 78 74 wlf Wolfson Microelectronics 79 75 wm Wondermedia Technologies, Inc. 80 - winbond Winbond Electronics corp. 81 76 xlnx Xilinx
+3 -14
arch/arc/include/asm/mach_desc.h
··· 51 51 /* 52 52 * Current machine - only accessible during boot. 53 53 */ 54 - extern struct machine_desc *machine_desc; 54 + extern const struct machine_desc *machine_desc; 55 55 56 56 /* 57 57 * Machine type table - also only accessible during boot 58 58 */ 59 - extern 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 - 63 - static 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 - } 59 + extern const struct machine_desc __arch_info_begin[], __arch_info_end[]; 70 60 71 61 /* 72 62 * Set of macros to define architecture features. ··· 71 81 #define MACHINE_END \ 72 82 }; 73 83 74 - extern struct machine_desc *setup_machine_fdt(void *dt); 75 - extern void __init copy_devtree(void); 84 + extern const struct machine_desc *setup_machine_fdt(void *dt); 76 85 77 86 #endif
-14
arch/arc/include/asm/prom.h
··· 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
+20 -77
arch/arc/kernel/devtree.c
··· 14 14 #include <linux/memblock.h> 15 15 #include <linux/of.h> 16 16 #include <linux/of_fdt.h> 17 - #include <asm/prom.h> 18 17 #include <asm/clk.h> 19 18 #include <asm/mach_desc.h> 19 + 20 + static 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 + } 20 32 21 33 /** 22 34 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel ··· 37 25 * If a dtb was passed to the kernel, then use it to choose the correct 38 26 * machine_desc and to setup the system. 39 27 */ 40 - struct machine_desc * __init setup_machine_fdt(void *dt) 28 + const struct machine_desc * __init setup_machine_fdt(void *dt) 41 29 { 42 - struct boot_param_header *devtree = dt; 43 - struct machine_desc *mdesc = NULL, *mdesc_best = NULL; 44 - unsigned int score, mdesc_score = ~1; 30 + const struct machine_desc *mdesc; 45 31 unsigned long dt_root; 46 - const char *model, *compat; 47 32 void *clk; 48 - char manufacturer[16]; 49 33 unsigned long len; 50 34 51 - /* check device tree validity */ 52 - if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) 35 + if (!early_init_dt_scan(dt)) 53 36 return NULL; 54 37 55 - initial_boot_params = devtree; 56 - dt_root = of_get_flat_dt_root(); 57 - 58 - /* 59 - * The kernel could be multi-platform enabled, thus could have many 60 - * "baked-in" machine descriptors. Search thru all for the best 61 - * "compatible" string match. 62 - */ 63 - for_each_machine_desc(mdesc) { 64 - score = of_flat_dt_match(dt_root, mdesc->dt_compat); 65 - if (score > 0 && score < mdesc_score) { 66 - mdesc_best = mdesc; 67 - mdesc_score = score; 68 - } 69 - } 70 - if (!mdesc_best) { 71 - const char *prop; 72 - long size; 73 - 74 - pr_err("\n unrecognized device tree list:\n[ "); 75 - 76 - prop = of_get_flat_dt_prop(dt_root, "compatible", &size); 77 - if (prop) { 78 - while (size > 0) { 79 - printk("'%s' ", prop); 80 - size -= strlen(prop) + 1; 81 - prop += strlen(prop) + 1; 82 - } 83 - } 84 - printk("]\n\n"); 85 - 38 + mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach); 39 + if (!mdesc) 86 40 machine_halt(); 87 - } 88 41 89 - /* compat = "<manufacturer>,<model>" */ 90 - compat = mdesc_best->dt_compat[0]; 91 - 92 - model = strchr(compat, ','); 93 - if (model) 94 - model++; 95 - 96 - strlcpy(manufacturer, compat, model ? model - compat : strlen(compat)); 97 - 98 - pr_info("Board \"%s\" from %s (Manufacturer)\n", model, manufacturer); 99 - 100 - /* Retrieve various information from the /chosen node */ 101 - of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); 102 - 103 - /* Initialize {size,address}-cells info */ 104 - of_scan_flat_dt(early_init_dt_scan_root, NULL); 105 - 106 - /* Setup memory, calling early_init_dt_add_memory_arch */ 107 - of_scan_flat_dt(early_init_dt_scan_memory, NULL); 108 - 42 + dt_root = of_get_flat_dt_root(); 109 43 clk = of_get_flat_dt_prop(dt_root, "clock-frequency", &len); 110 44 if (clk) 111 45 arc_set_core_freq(of_read_ulong(clk, len/4)); 112 46 113 - return mdesc_best; 114 - } 115 - 116 - /* 117 - * Copy the flattened DT out of .init since unflattening doesn't copy strings 118 - * and the normal DT APIs refs them from orig flat DT 119 - */ 120 - void __init copy_devtree(void) 121 - { 122 - void *alloc = early_init_dt_alloc_memory_arch( 123 - be32_to_cpu(initial_boot_params->totalsize), 64); 124 - if (alloc) { 125 - memcpy(alloc, initial_boot_params, 126 - be32_to_cpu(initial_boot_params->totalsize)); 127 - initial_boot_params = alloc; 128 - } 47 + return mdesc; 129 48 }
+2 -4
arch/arc/kernel/setup.c
··· 21 21 #include <asm/setup.h> 22 22 #include <asm/page.h> 23 23 #include <asm/irq.h> 24 - #include <asm/prom.h> 25 24 #include <asm/unwind.h> 26 25 #include <asm/clk.h> 27 26 #include <asm/mach_desc.h> ··· 30 31 int running_on_hw = 1; /* vs. on ISS */ 31 32 32 33 char __initdata command_line[COMMAND_LINE_SIZE]; 33 - struct machine_desc *machine_desc; 34 + const struct machine_desc *machine_desc; 34 35 35 36 struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ 36 37 ··· 344 345 setup_arch_memory(); 345 346 346 347 /* copy flat DT out of .init and then unflatten it */ 347 - copy_devtree(); 348 - unflatten_device_tree(); 348 + unflatten_and_copy_device_tree(); 349 349 350 350 /* Can be issue if someone passes cmd line arg "ro" 351 351 * But that is unlikely so keeping it as it is
-7
arch/arc/mm/init.c
··· 125 125 free_reserved_area((void *)start, (void *)end, -1, "initrd"); 126 126 } 127 127 #endif 128 - 129 - #ifdef CONFIG_OF_FLATTREE 130 - void __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 */
+58
arch/arm/boot/dts/testcases/tests-interrupts.dtsi
··· 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 + };
+1
arch/arm/boot/dts/testcases/tests.dtsi
··· 1 1 /include/ "tests-phandle.dtsi" 2 + /include/ "tests-interrupts.dtsi"
+1 -1
arch/arm/boot/dts/versatile-ab.dts
··· 185 185 mmc@5000 { 186 186 compatible = "arm,primecell"; 187 187 reg = < 0x5000 0x1000>; 188 - interrupts = <22 34>; 188 + interrupts-extended = <&vic 22 &sic 2>; 189 189 }; 190 190 kmi@6000 { 191 191 compatible = "arm,pl050", "arm,primecell";
+1 -1
arch/arm/boot/dts/versatile-pb.dts
··· 41 41 mmc@b000 { 42 42 compatible = "arm,primecell"; 43 43 reg = <0xb000 0x1000>; 44 - interrupts = <23 34>; 44 + interrupts-extended = <&vic 23 &sic 2>; 45 45 }; 46 46 }; 47 47 };
-2
arch/arm/include/asm/prom.h
··· 11 11 #ifndef __ASMARM_PROM_H 12 12 #define __ASMARM_PROM_H 13 13 14 - #define HAVE_ARCH_DEVTREE_FIXUPS 15 - 16 14 #ifdef CONFIG_OF 17 15 18 16 extern const struct machine_desc *setup_machine_fdt(unsigned int dt_phys);
+20 -37
arch/arm/kernel/devtree.c
··· 174 174 return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu); 175 175 } 176 176 177 + static 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 191 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 179 192 * @dt_phys: physical address of dt blob ··· 196 183 */ 197 184 const struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys) 198 185 { 199 - struct boot_param_header *devtree; 200 186 const struct machine_desc *mdesc, *mdesc_best = NULL; 201 - unsigned int score, mdesc_score = ~1; 202 - unsigned long dt_root; 203 - const char *model; 204 187 205 188 #ifdef CONFIG_ARCH_MULTIPLATFORM 206 189 DT_MACHINE_START(GENERIC_DT, "Generic DT based system") ··· 205 196 mdesc_best = &__mach_desc_GENERIC_DT; 206 197 #endif 207 198 208 - if (!dt_phys) 199 + if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) 209 200 return NULL; 210 201 211 - devtree = phys_to_virt(dt_phys); 202 + mdesc = of_flat_dt_match_machine(mdesc_best, arch_get_next_mach); 212 203 213 - /* check device tree validity */ 214 - if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) 215 - return NULL; 216 - 217 - /* Search the mdescs for the 'best' compatible value match */ 218 - initial_boot_params = devtree; 219 - dt_root = of_get_flat_dt_root(); 220 - for_each_machine_desc(mdesc) { 221 - score = of_flat_dt_match(dt_root, mdesc->dt_compat); 222 - if (score > 0 && score < mdesc_score) { 223 - mdesc_best = mdesc; 224 - mdesc_score = score; 225 - } 226 - } 227 - if (!mdesc_best) { 204 + if (!mdesc) { 228 205 const char *prop; 229 206 long size; 207 + unsigned long dt_root; 230 208 231 209 early_print("\nError: unrecognized/unsupported " 232 210 "device tree compatible list:\n[ "); 233 211 212 + dt_root = of_get_flat_dt_root(); 234 213 prop = of_get_flat_dt_prop(dt_root, "compatible", &size); 235 214 while (size > 0) { 236 215 early_print("'%s' ", prop); ··· 230 233 dump_machine_table(); /* does not return */ 231 234 } 232 235 233 - model = of_get_flat_dt_prop(dt_root, "model", NULL); 234 - if (!model) 235 - model = of_get_flat_dt_prop(dt_root, "compatible", NULL); 236 - if (!model) 237 - model = "<unknown>"; 238 - pr_info("Machine: %s, model: %s\n", mdesc_best->name, model); 239 - 240 - /* Retrieve various information from the /chosen node */ 241 - of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); 242 - /* Initialize {size,address}-cells info */ 243 - of_scan_flat_dt(early_init_dt_scan_root, NULL); 244 - /* Setup memory, calling early_init_dt_add_memory_arch */ 245 - of_scan_flat_dt(early_init_dt_scan_memory, NULL); 246 - 247 236 /* Change machine number to match the mdesc we're using */ 248 - __machine_arch_type = mdesc_best->nr; 237 + __machine_arch_type = mdesc->nr; 249 238 250 - return mdesc_best; 239 + return mdesc; 251 240 }
+1 -17
arch/arm/mach-integrator/pci_v3.c
··· 808 808 return pci_common_swizzle(dev, pinp); 809 809 } 810 810 811 - static 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 - 827 811 static struct hw_pci pci_v3 __initdata = { 828 812 .swizzle = pci_v3_swizzle, 829 813 .setup = pci_v3_setup, ··· 898 914 return -EINVAL; 899 915 } 900 916 901 - pci_v3.map_irq = pci_v3_map_irq_dt; 917 + pci_v3.map_irq = of_irq_parse_and_map_pci; 902 918 pci_common_init_dev(&pdev->dev, &pci_v3); 903 919 904 920 return 0;
-1
arch/arm/mach-keystone/platsmp.c
··· 17 17 #include <linux/io.h> 18 18 19 19 #include <asm/smp_plat.h> 20 - #include <asm/prom.h> 21 20 22 21 #include "keystone.h" 23 22
+4 -5
arch/arm/mach-u300/timer.c
··· 358 358 */ 359 359 static void __init u300_timer_init_of(struct device_node *np) 360 360 { 361 - struct resource irq_res; 362 - int irq; 361 + unsigned int irq; 363 362 struct clk *clk; 364 363 unsigned long rate; 365 364 ··· 367 368 panic("could not ioremap system timer\n"); 368 369 369 370 /* Get the IRQ for the GP1 timer */ 370 - irq = of_irq_to_resource(np, 2, &irq_res); 371 - if (irq <= 0) 371 + irq = irq_of_parse_and_map(np, 2); 372 + if (!irq) 372 373 panic("no IRQ for system timer\n"); 373 374 374 - pr_info("U300 GP1 timer @ base: %p, IRQ: %d\n", u300_timer_base, irq); 375 + pr_info("U300 GP1 timer @ base: %p, IRQ: %u\n", u300_timer_base, irq); 375 376 376 377 /* Clock the interrupt controller */ 377 378 clk = of_clk_get(np, 0);
+5 -8
arch/arm/mm/init.c
··· 76 76 77 77 __tagtable(ATAG_INITRD2, parse_tag_initrd2); 78 78 79 - #ifdef CONFIG_OF_FLATTREE 80 - void __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 80 * This keeps memory configuration data used by a couple memory 89 81 * initialization functions, as well as show_mem() for the skipping ··· 342 350 memblock_reserve(__pa(_stext), _end - _stext); 343 351 #endif 344 352 #ifdef CONFIG_BLK_DEV_INITRD 353 + /* FDT scan will populate initrd_start */ 354 + if (initrd_start) { 355 + phys_initrd_start = __virt_to_phys(initrd_start); 356 + phys_initrd_size = initrd_end - initrd_start; 357 + } 345 358 if (phys_initrd_size && 346 359 !memblock_is_region_memory(phys_initrd_start, phys_initrd_size)) { 347 360 pr_err("INITRD: 0x%08llx+0x%08lx is not a memory region - disabling initrd\n",
-1
arch/arm64/include/asm/prom.h
··· 1 - /* Empty for now */
+4 -56
arch/arm64/kernel/setup.c
··· 140 140 141 141 static void __init setup_machine_fdt(phys_addr_t dt_phys) 142 142 { 143 - struct boot_param_header *devtree; 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) { 143 + if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) { 162 144 early_print("\n" 163 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 147 "\nPlease check your bootloader.\n", 166 - dt_phys, devtree, OF_DT_HEADER, 167 - be32_to_cpu(devtree->magic)); 148 + dt_phys, phys_to_virt(dt_phys)); 168 149 169 150 while (true) 170 151 cpu_relax(); 171 152 } 172 153 173 - initial_boot_params = devtree; 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 - 191 - void __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); 154 + machine_name = of_flat_dt_get_machine_name(); 207 155 } 208 156 209 157 /*
+6 -19
arch/arm64/mm/init.c
··· 31 31 #include <linux/sort.h> 32 32 #include <linux/of_fdt.h> 33 33 34 - #include <asm/prom.h> 35 34 #include <asm/sections.h> 36 35 #include <asm/setup.h> 37 36 #include <asm/sizes.h> ··· 38 39 39 40 #include "mm.h" 40 41 41 - static unsigned long phys_initrd_start __initdata = 0; 42 - static unsigned long phys_initrd_size __initdata = 0; 43 - 44 42 phys_addr_t memstart_addr __read_mostly = 0; 45 43 46 - void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) 47 - { 48 - phys_initrd_start = start; 49 - phys_initrd_size = end - start; 50 - } 51 - 44 + #ifdef CONFIG_BLK_DEV_INITRD 52 45 static int __init early_initrd(char *p) 53 46 { 54 47 unsigned long start, size; ··· 50 59 if (*endp == ',') { 51 60 size = memparse(endp + 1, NULL); 52 61 53 - phys_initrd_start = start; 54 - phys_initrd_size = size; 62 + initrd_start = (unsigned long)__va(start); 63 + initrd_end = (unsigned long)__va(start + size); 55 64 } 56 65 return 0; 57 66 } 58 67 early_param("initrd", early_initrd); 68 + #endif 59 69 60 70 #define MAX_DMA32_PFN ((4UL * 1024 * 1024 * 1024) >> PAGE_SHIFT) 61 71 ··· 129 137 /* Register the kernel text, kernel data and initrd with memblock */ 130 138 memblock_reserve(__pa(_text), _end - _text); 131 139 #ifdef CONFIG_BLK_DEV_INITRD 132 - if (phys_initrd_size) { 133 - memblock_reserve(phys_initrd_start, phys_initrd_size); 134 - 135 - /* Now convert initrd to virtual addresses */ 136 - initrd_start = __phys_to_virt(phys_initrd_start); 137 - initrd_end = initrd_start + phys_initrd_size; 138 - } 140 + if (initrd_start) 141 + memblock_reserve(__virt_to_phys(initrd_start), initrd_end - initrd_start); 139 142 #endif 140 143 141 144 /*
-1
arch/c6x/include/asm/prom.h
··· 1 - /* dummy prom.h; here to make linux/of.h's #includes happy */
-2
arch/c6x/include/asm/setup.h
··· 14 14 #include <uapi/asm/setup.h> 15 15 16 16 #ifndef __ASSEMBLY__ 17 - extern char c6x_command_line[COMMAND_LINE_SIZE]; 18 - 19 17 extern int c6x_add_memory(phys_addr_t start, unsigned long size); 20 18 21 19 extern unsigned long ram_start;
-29
arch/c6x/kernel/devicetree.c
··· 10 10 * 11 11 */ 12 12 #include <linux/init.h> 13 - #include <linux/of.h> 14 - #include <linux/of_fdt.h> 15 - #include <linux/initrd.h> 16 13 #include <linux/memblock.h> 17 - 18 - void __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 36 - void __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 14 44 15 void __init early_init_dt_add_memory_arch(u64 base, u64 size) 45 16 {
+2 -11
arch/c6x/kernel/setup.c
··· 68 68 static unsigned long dma_start __initdata; 69 69 static unsigned long dma_size __initdata; 70 70 71 - char c6x_command_line[COMMAND_LINE_SIZE]; 72 - 73 - #if defined(CONFIG_CMDLINE_BOOL) 74 - static const char default_command_line[COMMAND_LINE_SIZE] __section(.cmdline) = 75 - CONFIG_CMDLINE; 76 - #endif 77 - 78 71 struct cpuinfo_c6x { 79 72 const char *cpu_name; 80 73 const char *cpu_voltage; ··· 287 294 fdt = dtb; 288 295 289 296 /* Do some early initialization based on the flat device tree */ 290 - early_init_devtree(fdt); 297 + early_init_dt_scan(fdt); 291 298 292 - /* parse_early_param needs a boot_command_line */ 293 - strlcpy(boot_command_line, c6x_command_line, COMMAND_LINE_SIZE); 294 299 parse_early_param(); 295 300 } 296 301 ··· 300 309 printk(KERN_INFO "Initializing kernel\n"); 301 310 302 311 /* Initialize command line */ 303 - *cmdline_p = c6x_command_line; 312 + *cmdline_p = boot_command_line; 304 313 305 314 memory_end = ram_end; 306 315 memory_end &= ~(PAGE_SIZE - 1);
-6
arch/c6x/kernel/vmlinux.lds.S
··· 37 37 _vectors_end = .; 38 38 } 39 39 40 - . = ALIGN(0x1000); 41 - .cmdline : 42 - { 43 - *(.cmdline) 44 - } 45 - 46 40 /* 47 41 * This section contains data which may be shared with other 48 42 * cores. It needs to be a fixed offset from PAGE_OFFSET
-3
arch/hexagon/kernel/setup.c
··· 32 32 #include <asm/hexagon_vm.h> 33 33 #include <asm/vm_mmu.h> 34 34 #include <asm/time.h> 35 - #ifdef CONFIG_OF 36 - #include <asm/prom.h> 37 - #endif 38 35 39 36 char cmd_line[COMMAND_LINE_SIZE]; 40 37 static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
+1 -1
arch/metag/include/asm/mach/arch.h
··· 53 53 /* 54 54 * Current machine - only accessible during boot. 55 55 */ 56 - extern struct machine_desc *machine_desc; 56 + extern const struct machine_desc *machine_desc; 57 57 58 58 /* 59 59 * Machine type table - also only accessible during boot
-23
arch/metag/include/asm/prom.h
··· 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 - 20 - extern struct machine_desc *setup_machine_fdt(void *dt); 21 - extern void copy_fdt(void); 22 - 23 - #endif /* __ASM_METAG_PROM_H */
+1
arch/metag/include/asm/setup.h
··· 3 3 4 4 #include <uapi/asm/setup.h> 5 5 6 + extern const struct machine_desc *setup_machine_fdt(void *dt); 6 7 void per_cpu_trap_init(unsigned long); 7 8 extern void __init dump_machine_table(void); 8 9 #endif /* _ASM_METAG_SETUP_H */
+20 -63
arch/metag/kernel/devtree.c
··· 34 34 return alloc_bootmem_align(size, align); 35 35 } 36 36 37 + static 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 51 * setup_machine_fdt - Machine setup when an dtb was passed to the kernel 39 52 * @dt: virtual address pointer to dt blob ··· 54 41 * If a dtb was passed to the kernel, then use it to choose the correct 55 42 * machine_desc and to setup the system. 56 43 */ 57 - struct machine_desc * __init setup_machine_fdt(void *dt) 44 + const struct machine_desc * __init setup_machine_fdt(void *dt) 58 45 { 59 - struct boot_param_header *devtree = dt; 60 - struct machine_desc *mdesc, *mdesc_best = NULL; 61 - unsigned int score, mdesc_score = ~1; 62 - unsigned long dt_root; 63 - const char *model; 46 + const struct machine_desc *mdesc; 64 47 65 48 /* check device tree validity */ 66 - if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) 49 + if (!early_init_dt_scan(dt)) 67 50 return NULL; 68 51 69 - /* Search the mdescs for the 'best' compatible value match */ 70 - initial_boot_params = devtree; 71 - dt_root = of_get_flat_dt_root(); 72 - 73 - for_each_machine_desc(mdesc) { 74 - score = of_flat_dt_match(dt_root, mdesc->dt_compat); 75 - if (score > 0 && score < mdesc_score) { 76 - mdesc_best = mdesc; 77 - mdesc_score = score; 78 - } 79 - } 80 - if (!mdesc_best) { 81 - const char *prop; 82 - long size; 83 - 84 - pr_err("\nError: unrecognized/unsupported device tree compatible list:\n[ "); 85 - 86 - prop = of_get_flat_dt_prop(dt_root, "compatible", &size); 87 - if (prop) { 88 - while (size > 0) { 89 - printk("'%s' ", prop); 90 - size -= strlen(prop) + 1; 91 - prop += strlen(prop) + 1; 92 - } 93 - } 94 - printk("]\n\n"); 95 - 52 + mdesc = of_flat_dt_match_machine(NULL, arch_get_next_mach); 53 + if (!mdesc) 96 54 dump_machine_table(); /* does not return */ 97 - } 55 + pr_info("Machine name: %s\n", mdesc->name); 98 56 99 - model = of_get_flat_dt_prop(dt_root, "model", NULL); 100 - if (!model) 101 - model = of_get_flat_dt_prop(dt_root, "compatible", NULL); 102 - if (!model) 103 - model = "<unknown>"; 104 - pr_info("Machine: %s, model: %s\n", mdesc_best->name, model); 105 - 106 - /* Retrieve various information from the /chosen node */ 107 - of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); 108 - 109 - return mdesc_best; 110 - } 111 - 112 - /** 113 - * copy_fdt - Copy device tree into non-init memory. 114 - * 115 - * We must copy the flattened device tree blob into non-init memory because the 116 - * unflattened device tree will reference the strings in it directly. 117 - */ 118 - void __init copy_fdt(void) 119 - { 120 - void *alloc = early_init_dt_alloc_memory_arch( 121 - be32_to_cpu(initial_boot_params->totalsize), 0x40); 122 - if (alloc) { 123 - memcpy(alloc, initial_boot_params, 124 - be32_to_cpu(initial_boot_params->totalsize)); 125 - initial_boot_params = alloc; 126 - } 57 + return mdesc; 127 58 }
+2 -5
arch/metag/kernel/setup.c
··· 42 42 #include <asm/mmu.h> 43 43 #include <asm/mmzone.h> 44 44 #include <asm/processor.h> 45 - #include <asm/prom.h> 46 45 #include <asm/sections.h> 47 46 #include <asm/setup.h> 48 47 #include <asm/traps.h> ··· 114 115 extern struct console dash_console; 115 116 #endif 116 117 117 - struct machine_desc *machine_desc __initdata; 118 + const struct machine_desc *machine_desc __initdata; 118 119 119 120 /* 120 121 * Map a Linux CPU number to a hardware thread ID ··· 403 404 cpu_2_hwthread_id[smp_processor_id()] = hard_processor_id(); 404 405 hwthread_id_2_cpu[hard_processor_id()] = smp_processor_id(); 405 406 406 - /* Copy device tree blob into non-init memory before unflattening */ 407 - copy_fdt(); 408 - unflatten_device_tree(); 407 + unflatten_and_copy_device_tree(); 409 408 410 409 #ifdef CONFIG_SMP 411 410 smp_init_cpus();
-9
arch/metag/mm/init.c
··· 12 12 #include <linux/percpu.h> 13 13 #include <linux/memblock.h> 14 14 #include <linux/initrd.h> 15 - #include <linux/of_fdt.h> 16 15 17 16 #include <asm/setup.h> 18 17 #include <asm/page.h> ··· 404 405 "initrd"); 405 406 } 406 407 #endif 407 - 408 - #ifdef CONFIG_OF_FLATTREE 409 - void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) 410 - { 411 - pr_err("%s(%llx, %llx)\n", 412 - __func__, start, end); 413 - } 414 - #endif /* CONFIG_OF_FLATTREE */
-2
arch/microblaze/include/asm/pci.h
··· 127 127 extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); 128 128 extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus); 129 129 130 - extern int pci_read_irq_line(struct pci_dev *dev); 131 - 132 130 extern int pci_bus_find_capability(struct pci_bus *bus, 133 131 unsigned int devfn, int cap); 134 132
+1 -38
arch/microblaze/include/asm/prom.h
··· 11 11 * as published by the Free Software Foundation; either version 12 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 14 #ifndef _ASM_MICROBLAZE_PROM_H 18 15 #define _ASM_MICROBLAZE_PROM_H 19 - #ifdef __KERNEL__ 20 - #ifndef __ASSEMBLY__ 21 16 22 - #include <linux/types.h> 23 - #include <asm/irq.h> 24 - #include <linux/atomic.h> 25 - 26 - #define HAVE_ARCH_DEVTREE_FIXUPS 17 + #include <linux/of.h> 27 18 28 19 /* Other Prototypes */ 29 20 enum early_consoles { ··· 23 32 }; 24 33 25 34 extern int of_early_console(void *version); 26 - 27 - /* 28 - * OF address retreival & translation 29 - */ 30 - 31 - #ifdef CONFIG_PCI 32 - extern unsigned long pci_address_to_pio(phys_addr_t address); 33 - #define pci_address_to_pio pci_address_to_pio 34 - #endif /* CONFIG_PCI */ 35 - 36 - /* Parse the ibm,dma-window property of an OF node into the busno, phys and 37 - * size parameters. 38 - */ 39 - void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, 40 - unsigned long *busno, unsigned long *phys, unsigned long *size); 41 - 42 - extern void kdump_move_device_tree(void); 43 - 44 - #endif /* __ASSEMBLY__ */ 45 - #endif /* __KERNEL__ */ 46 - 47 - /* These includes are put at the bottom because they may contain things 48 - * that are overridden by this file. Ideally they shouldn't be included 49 - * by this file, but there are a bunch of .c files that currently depend 50 - * on it. Eventually they will be cleaned up. */ 51 - #include <linux/of_fdt.h> 52 - #include <linux/of_irq.h> 53 - #include <linux/platform_device.h> 54 35 55 36 #endif /* _ASM_MICROBLAZE_PROM_H */
+4 -28
arch/microblaze/kernel/prom.c
··· 30 30 #include <linux/debugfs.h> 31 31 #include <linux/irq.h> 32 32 #include <linux/memblock.h> 33 + #include <linux/of_fdt.h> 33 34 34 35 #include <asm/prom.h> 35 36 #include <asm/page.h> ··· 41 40 #include <asm/pgtable.h> 42 41 #include <asm/sections.h> 43 42 #include <asm/pci-bridge.h> 44 - 45 - void __init early_init_dt_add_memory_arch(u64 base, u64 size) 46 - { 47 - memblock_add(base, size); 48 - } 49 43 50 44 #ifdef CONFIG_EARLY_PRINTK 51 45 static char *stdout; ··· 102 106 { 103 107 pr_debug(" -> early_init_devtree(%p)\n", params); 104 108 105 - /* Setup flat device-tree pointer */ 106 - initial_boot_params = params; 109 + early_init_dt_scan(params); 110 + if (!strlen(boot_command_line)) 111 + strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); 107 112 108 - /* Retrieve various informations from the /chosen node of the 109 - * device-tree, including the platform type, initrd location and 110 - * size, TCE reserve, and more ... 111 - */ 112 - of_scan_flat_dt(early_init_dt_scan_chosen, cmd_line); 113 - 114 - /* Scan memory nodes and rebuild MEMBLOCKs */ 115 - of_scan_flat_dt(early_init_dt_scan_root, NULL); 116 - of_scan_flat_dt(early_init_dt_scan_memory, NULL); 117 - 118 - /* Save command line for /proc/cmdline and then parse parameters */ 119 - strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE); 120 113 parse_early_param(); 121 114 122 115 memblock_allow_resize(); ··· 114 129 115 130 pr_debug(" <- early_init_devtree()\n"); 116 131 } 117 - 118 - #ifdef CONFIG_BLK_DEV_INITRD 119 - void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) 120 - { 121 - initrd_start = (unsigned long)__va(start); 122 - initrd_end = (unsigned long)__va(end); 123 - initrd_below_start_ok = 1; 124 - } 125 - #endif 126 132 127 133 /******* 128 134 *
+2 -1
arch/microblaze/kernel/setup.c
··· 16 16 #include <linux/initrd.h> 17 17 #include <linux/console.h> 18 18 #include <linux/debugfs.h> 19 + #include <linux/of_fdt.h> 19 20 20 21 #include <asm/setup.h> 21 22 #include <asm/sections.h> ··· 51 50 52 51 void __init setup_arch(char **cmdline_p) 53 52 { 54 - *cmdline_p = cmd_line; 53 + *cmdline_p = boot_command_line; 55 54 56 55 console_verbose(); 57 56
+1
arch/microblaze/kernel/timer.c
··· 15 15 #include <linux/clk.h> 16 16 #include <linux/clockchips.h> 17 17 #include <linux/of_address.h> 18 + #include <linux/of_irq.h> 18 19 #include <asm/cpuinfo.h> 19 20 #include <linux/cnt32_to_63.h> 20 21
+2 -71
arch/microblaze/pci/pci-common.c
··· 29 29 #include <linux/slab.h> 30 30 #include <linux/of.h> 31 31 #include <linux/of_address.h> 32 + #include <linux/of_irq.h> 32 33 #include <linux/of_pci.h> 33 34 #include <linux/export.h> 34 35 ··· 192 191 { 193 192 /* No special bus mastering setup handling */ 194 193 } 195 - 196 - /* 197 - * Reads the interrupt pin to determine if interrupt is use by card. 198 - * If the interrupt is used, then gets the interrupt line from the 199 - * openfirmware and sets it in the pci_dev and pci_config line. 200 - */ 201 - int pci_read_irq_line(struct pci_dev *pci_dev) 202 - { 203 - struct of_irq oirq; 204 - unsigned int virq; 205 - 206 - /* The current device-tree that iSeries generates from the HV 207 - * PCI informations doesn't contain proper interrupt routing, 208 - * and all the fallback would do is print out crap, so we 209 - * don't attempt to resolve the interrupts here at all, some 210 - * iSeries specific fixup does it. 211 - * 212 - * In the long run, we will hopefully fix the generated device-tree 213 - * instead. 214 - */ 215 - pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev)); 216 - 217 - #ifdef DEBUG 218 - memset(&oirq, 0xff, sizeof(oirq)); 219 - #endif 220 - /* Try to get a mapping from the device-tree */ 221 - if (of_irq_map_pci(pci_dev, &oirq)) { 222 - u8 line, pin; 223 - 224 - /* If that fails, lets fallback to what is in the config 225 - * space and map that through the default controller. We 226 - * also set the type to level low since that's what PCI 227 - * interrupts are. If your platform does differently, then 228 - * either provide a proper interrupt tree or don't use this 229 - * function. 230 - */ 231 - if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_PIN, &pin)) 232 - return -1; 233 - if (pin == 0) 234 - return -1; 235 - if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, &line) || 236 - line == 0xff || line == 0) { 237 - return -1; 238 - } 239 - pr_debug(" No map ! Using line %d (pin %d) from PCI config\n", 240 - line, pin); 241 - 242 - virq = irq_create_mapping(NULL, line); 243 - if (virq) 244 - irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); 245 - } else { 246 - pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 247 - oirq.size, oirq.specifier[0], oirq.specifier[1], 248 - of_node_full_name(oirq.controller)); 249 - 250 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 251 - oirq.size); 252 - } 253 - if (!virq) { 254 - pr_debug(" Failed to map !\n"); 255 - return -1; 256 - } 257 - 258 - pr_debug(" Mapped to linux irq %d\n", virq); 259 - 260 - pci_dev->irq = virq; 261 - 262 - return 0; 263 - } 264 - EXPORT_SYMBOL(pci_read_irq_line); 265 194 266 195 /* 267 196 * Platform support for /proc/bus/pci/X/Y mmap()s, ··· 891 960 dev->dev.archdata.dma_data = (void *)PCI_DRAM_OFFSET; 892 961 893 962 /* Read default IRQs and fixup if necessary */ 894 - pci_read_irq_line(dev); 963 + dev->irq = of_irq_parse_and_map_pci(dev, 0, 0); 895 964 } 896 965 } 897 966
+1
arch/mips/include/asm/netlogic/xlp-hal/xlp.h
··· 69 69 int xlp_get_dram_map(int n, uint64_t *dram_map); 70 70 71 71 /* Device tree related */ 72 + void xlp_early_init_devtree(void); 72 73 void *xlp_dt_init(void *fdtp); 73 74 74 75 static inline int cpu_is_xlpii(void)
-14
arch/mips/include/asm/prom.h
··· 17 17 #include <linux/types.h> 18 18 #include <asm/bootinfo.h> 19 19 20 - extern int early_init_dt_scan_memory_arch(unsigned long node, 21 - const char *uname, int depth, void *data); 22 - 23 20 extern void device_tree_init(void); 24 - 25 - static 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 21 36 22 struct boot_param_header; 37 23
+2 -58
arch/mips/kernel/prom.c
··· 13 13 #include <linux/errno.h> 14 14 #include <linux/types.h> 15 15 #include <linux/bootmem.h> 16 - #include <linux/initrd.h> 17 16 #include <linux/debugfs.h> 18 17 #include <linux/of.h> 19 18 #include <linux/of_fdt.h> 20 - #include <linux/of_irq.h> 21 - #include <linux/of_platform.h> 22 19 23 20 #include <asm/page.h> 24 21 #include <asm/prom.h> ··· 37 40 } 38 41 39 42 #ifdef CONFIG_OF 40 - int __init early_init_dt_scan_memory_arch(unsigned long node, 41 - const char *uname, int depth, 42 - void *data) 43 - { 44 - return early_init_dt_scan_memory(node, uname, depth, data); 45 - } 46 - 47 43 void __init early_init_dt_add_memory_arch(u64 base, u64 size) 48 44 { 49 45 return add_memory_region(base, size, BOOT_MEM_RAM); ··· 47 57 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); 48 58 } 49 59 50 - #ifdef CONFIG_BLK_DEV_INITRD 51 - void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) 52 - { 53 - initrd_start = (unsigned long)__va(start); 54 - initrd_end = (unsigned long)__va(end); 55 - initrd_below_start_ok = 1; 56 - } 57 - #endif 58 - 59 - int __init early_init_dt_scan_model(unsigned long node, const char *uname, 60 - int depth, void *data) 61 - { 62 - if (!depth) { 63 - char *model = of_get_flat_dt_prop(node, "model", NULL); 64 - 65 - if (model) 66 - mips_set_machine_name(model); 67 - } 68 - return 0; 69 - } 70 - 71 - void __init early_init_devtree(void *params) 72 - { 73 - /* Setup flat device-tree pointer */ 74 - initial_boot_params = params; 75 - 76 - /* Retrieve various informations from the /chosen node of the 77 - * device-tree, including the platform type, initrd location and 78 - * size, and more ... 79 - */ 80 - of_scan_flat_dt(early_init_dt_scan_chosen, arcs_cmdline); 81 - 82 - 83 - /* Scan memory nodes */ 84 - of_scan_flat_dt(early_init_dt_scan_root, NULL); 85 - of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL); 86 - 87 - /* try to load the mips machine name */ 88 - of_scan_flat_dt(early_init_dt_scan_model, NULL); 89 - } 90 - 91 60 void __init __dt_setup_arch(struct boot_param_header *bph) 92 61 { 93 - if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { 94 - pr_err("DTB has bad magic, ignoring builtin OF DTB\n"); 95 - 62 + if (!early_init_dt_scan(bph)) 96 63 return; 97 - } 98 64 99 - initial_boot_params = bph; 100 - 101 - early_init_devtree(initial_boot_params); 65 + mips_set_machine_name(of_flat_dt_get_machine_name()); 102 66 } 103 67 #endif
+1
arch/mips/lantiq/prom.c
··· 14 14 15 15 #include <asm/bootinfo.h> 16 16 #include <asm/time.h> 17 + #include <asm/prom.h> 17 18 18 19 #include <lantiq.h> 19 20
+2
arch/mips/mti-sead3/sead3-setup.c
··· 10 10 #include <linux/of_fdt.h> 11 11 #include <linux/bootmem.h> 12 12 13 + #include <asm/prom.h> 14 + 13 15 #include <asm/mips-boards/generic.h> 14 16 15 17 const char *get_system_type(void)
+14 -4
arch/mips/netlogic/xlp/dt.c
··· 39 39 #include <linux/of_platform.h> 40 40 #include <linux/of_device.h> 41 41 42 + #include <asm/prom.h> 43 + 42 44 extern u32 __dtb_xlp_evp_begin[], __dtb_xlp_svp_begin[], 43 45 __dtb_xlp_fvp_begin[], __dtb_start[]; 46 + static void *xlp_fdt_blob; 44 47 45 48 void __init *xlp_dt_init(void *fdtp) 46 49 { ··· 70 67 break; 71 68 } 72 69 } 73 - initial_boot_params = fdtp; 70 + xlp_fdt_blob = fdtp; 74 71 return fdtp; 72 + } 73 + 74 + void __init xlp_early_init_devtree(void) 75 + { 76 + __dt_setup_arch(xlp_fdt_blob); 77 + strlcpy(arcs_cmdline, boot_command_line, COMMAND_LINE_SIZE); 75 78 } 76 79 77 80 void __init device_tree_init(void) 78 81 { 79 82 unsigned long base, size; 83 + struct boot_param_header *fdtp = xlp_fdt_blob; 80 84 81 - if (!initial_boot_params) 85 + if (!fdtp) 82 86 return; 83 87 84 - base = virt_to_phys((void *)initial_boot_params); 85 - size = be32_to_cpu(initial_boot_params->totalsize); 88 + base = virt_to_phys(fdtp); 89 + size = be32_to_cpu(fdtp->totalsize); 86 90 87 91 /* Before we do anything, lets reserve the dt blob */ 88 92 reserve_bootmem(base, size, BOOTMEM_DEFAULT);
+1 -1
arch/mips/netlogic/xlp/setup.c
··· 98 98 pm_power_off = nlm_linux_exit; 99 99 100 100 /* memory and bootargs from DT */ 101 - early_init_devtree(initial_boot_params); 101 + xlp_early_init_devtree(); 102 102 103 103 if (boot_mem_map.nr_map == 0) { 104 104 pr_info("Using DRAM BARs for memory map.\n");
+1 -12
arch/mips/pci/fixup-lantiq.c
··· 25 25 26 26 int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 27 27 { 28 - struct of_irq dev_irq; 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; 28 + return of_irq_parse_and_map_pci(dev, slot, pin); 40 29 }
+1 -23
arch/mips/pci/pci-rt3883.c
··· 583 583 584 584 int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 585 585 { 586 - struct of_irq dev_irq; 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; 586 + return of_irq_parse_and_map_pci(dev, slot, pin); 609 587 } 610 588 611 589 int pcibios_plat_dev_init(struct pci_dev *dev)
+1
arch/mips/ralink/of.c
··· 21 21 #include <asm/reboot.h> 22 22 #include <asm/bootinfo.h> 23 23 #include <asm/addrspace.h> 24 + #include <asm/prom.h> 24 25 25 26 #include "common.h" 26 27
-22
arch/openrisc/include/asm/prom.h
··· 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 */
+1 -69
arch/openrisc/kernel/prom.c
··· 18 18 * 19 19 */ 20 20 21 - #include <stdarg.h> 22 - #include <linux/kernel.h> 23 - #include <linux/string.h> 24 21 #include <linux/init.h> 25 - #include <linux/threads.h> 26 - #include <linux/spinlock.h> 27 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 23 #include <linux/memblock.h> 38 24 #include <linux/of_fdt.h> 39 25 40 - #include <asm/prom.h> 41 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 - 50 - extern char cmd_line[COMMAND_LINE_SIZE]; 51 - 52 - void __init early_init_dt_add_memory_arch(u64 base, u64 size) 53 - { 54 - size &= PAGE_MASK; 55 - memblock_add(base, size); 56 - } 57 27 58 28 void __init early_init_devtree(void *params) 59 29 { 60 - void *alloc; 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 - 30 + early_init_dt_scan(params); 79 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 32 } 92 - 93 - #ifdef CONFIG_BLK_DEV_INITRD 94 - void __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 - } 100 - #endif
+2 -4
arch/openrisc/kernel/setup.c
··· 50 50 51 51 #include "vmlinux.h" 52 52 53 - char __initdata cmd_line[COMMAND_LINE_SIZE] = CONFIG_CMDLINE; 54 - 55 53 static unsigned long __init setup_memory(void) 56 54 { 57 55 unsigned long bootmap_size; ··· 283 285 { 284 286 unsigned long max_low_pfn; 285 287 286 - unflatten_device_tree(); 288 + unflatten_and_copy_device_tree(); 287 289 288 290 setup_cpuinfo(); 289 291 ··· 314 316 conswitchp = &dummy_con; 315 317 #endif 316 318 317 - *cmdline_p = cmd_line; 319 + *cmdline_p = boot_command_line; 318 320 319 321 printk(KERN_INFO "OpenRISC Linux -- http://openrisc.net\n"); 320 322 }
+6 -27
arch/powerpc/include/asm/prom.h
··· 1 - #include <linux/of.h> /* linux/of.h gets to determine #include ordering */ 2 1 #ifndef _POWERPC_PROM_H 3 2 #define _POWERPC_PROM_H 4 3 #ifdef __KERNEL__ ··· 19 20 #include <asm/irq.h> 20 21 #include <linux/atomic.h> 21 22 22 - #define HAVE_ARCH_DEVTREE_FIXUPS 23 + /* These includes should be removed once implicit includes are cleaned up. */ 24 + #include <linux/of.h> 25 + #include <linux/of_fdt.h> 26 + #include <linux/of_address.h> 27 + #include <linux/of_irq.h> 28 + #include <linux/platform_device.h> 23 29 24 30 /* 25 31 * OF address retreival & translation 26 32 */ 27 - 28 - /* Translate a DMA address from device space to CPU space */ 29 - extern u64 of_translate_dma_address(struct device_node *dev, 30 - const __be32 *in_addr); 31 - 32 - #ifdef CONFIG_PCI 33 - extern unsigned long pci_address_to_pio(phys_addr_t address); 34 - #define pci_address_to_pio pci_address_to_pio 35 - #endif /* CONFIG_PCI */ 36 33 37 34 /* Parse the ibm,dma-window property of an OF node into the busno, phys and 38 35 * size parameters. ··· 38 43 unsigned long *size); 39 44 40 45 extern void kdump_move_device_tree(void); 41 - 42 - #ifdef CONFIG_NUMA 43 - extern int of_node_to_nid(struct device_node *device); 44 - #else 45 - static inline int of_node_to_nid(struct device_node *device) { return 0; } 46 - #endif 47 - #define of_node_to_nid of_node_to_nid 48 46 49 47 extern void of_instantiate_rtc(void); 50 48 ··· 127 139 * followed by # option vectors - 1, followed by the option vectors. 128 140 */ 129 141 extern unsigned char ibm_architecture_vec[]; 130 - 131 - /* These includes are put at the bottom because they may contain things 132 - * that are overridden by this file. Ideally they shouldn't be included 133 - * by this file, but there are a bunch of .c files that currently depend 134 - * on it. Eventually they will be cleaned up. */ 135 - #include <linux/of_fdt.h> 136 - #include <linux/of_address.h> 137 - #include <linux/of_irq.h> 138 - #include <linux/platform_device.h> 139 142 140 143 #endif /* __KERNEL__ */ 141 144 #endif /* _POWERPC_PROM_H */
+1
arch/powerpc/kernel/epapr_paravirt.c
··· 18 18 */ 19 19 20 20 #include <linux/of.h> 21 + #include <linux/of_fdt.h> 21 22 #include <asm/epapr_hcalls.h> 22 23 #include <asm/cacheflush.h> 23 24 #include <asm/code-patching.h>
+5 -6
arch/powerpc/kernel/pci-common.c
··· 228 228 */ 229 229 static int pci_read_irq_line(struct pci_dev *pci_dev) 230 230 { 231 - struct of_irq oirq; 231 + struct of_phandle_args oirq; 232 232 unsigned int virq; 233 233 234 234 pr_debug("PCI: Try to map irq for %s...\n", pci_name(pci_dev)); ··· 237 237 memset(&oirq, 0xff, sizeof(oirq)); 238 238 #endif 239 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 241 u8 line, pin; 242 242 243 243 /* If that fails, lets fallback to what is in the config ··· 263 263 irq_set_irq_type(virq, IRQ_TYPE_LEVEL_LOW); 264 264 } else { 265 265 pr_debug(" Got one, spec %d cells (0x%08x 0x%08x...) on %s\n", 266 - oirq.size, oirq.specifier[0], oirq.specifier[1], 267 - of_node_full_name(oirq.controller)); 266 + oirq.args_count, oirq.args[0], oirq.args[1], 267 + of_node_full_name(oirq.np)); 268 268 269 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 270 - oirq.size); 269 + virq = irq_create_of_mapping(&oirq); 271 270 } 272 271 if(virq == NO_IRQ) { 273 272 pr_debug(" Failed to map !\n");
-9
arch/powerpc/kernel/prom.c
··· 546 546 memblock_add(base, size); 547 547 } 548 548 549 - #ifdef CONFIG_BLK_DEV_INITRD 550 - void __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 - 558 549 static void __init early_reserve_mem_dt(void) 559 550 { 560 551 unsigned long i, len, dt_root;
+1
arch/powerpc/platforms/512x/clock.c
··· 24 24 #include <linux/mutex.h> 25 25 #include <linux/io.h> 26 26 27 + #include <linux/of_address.h> 27 28 #include <linux/of_platform.h> 28 29 #include <asm/mpc5xxx.h> 29 30 #include <asm/mpc5121.h>
+2
arch/powerpc/platforms/512x/pdm360ng.c
··· 14 14 15 15 #include <linux/kernel.h> 16 16 #include <linux/io.h> 17 + #include <linux/of_address.h> 18 + #include <linux/of_fdt.h> 17 19 #include <linux/of_platform.h> 18 20 19 21 #include <asm/machdep.h>
+2
arch/powerpc/platforms/82xx/mpc8272_ads.c
··· 16 16 #include <linux/init.h> 17 17 #include <linux/interrupt.h> 18 18 #include <linux/fsl_devices.h> 19 + #include <linux/of_address.h> 20 + #include <linux/of_fdt.h> 19 21 #include <linux/of_platform.h> 20 22 #include <linux/io.h> 21 23
+2
arch/powerpc/platforms/82xx/pq2fads.c
··· 15 15 #include <linux/init.h> 16 16 #include <linux/interrupt.h> 17 17 #include <linux/fsl_devices.h> 18 + #include <linux/of_address.h> 19 + #include <linux/of_fdt.h> 18 20 #include <linux/of_platform.h> 19 21 20 22 #include <asm/io.h>
+2
arch/powerpc/platforms/83xx/suspend.c
··· 20 20 #include <linux/freezer.h> 21 21 #include <linux/suspend.h> 22 22 #include <linux/fsl_devices.h> 23 + #include <linux/of_address.h> 24 + #include <linux/of_irq.h> 23 25 #include <linux/of_platform.h> 24 26 #include <linux/export.h> 25 27
+1
arch/powerpc/platforms/85xx/c293pcie.c
··· 11 11 12 12 #include <linux/stddef.h> 13 13 #include <linux/kernel.h> 14 + #include <linux/of_fdt.h> 14 15 #include <linux/of_platform.h> 15 16 16 17 #include <asm/machdep.h>
+2
arch/powerpc/platforms/85xx/common.c
··· 5 5 * it under the terms of the GNU General Public License version 2 as 6 6 * published by the Free Software Foundation. 7 7 */ 8 + 9 + #include <linux/of_irq.h> 8 10 #include <linux/of_platform.h> 9 11 10 12 #include <sysdev/cpm2_pic.h>
+1
arch/powerpc/platforms/85xx/ppa8548.c
··· 19 19 #include <linux/init.h> 20 20 #include <linux/reboot.h> 21 21 #include <linux/seq_file.h> 22 + #include <linux/of_fdt.h> 22 23 #include <linux/of_platform.h> 23 24 24 25 #include <asm/machdep.h>
+1
arch/powerpc/platforms/85xx/sgy_cts1000.c
··· 16 16 #include <linux/module.h> 17 17 #include <linux/init.h> 18 18 #include <linux/of_gpio.h> 19 + #include <linux/of_irq.h> 19 20 #include <linux/workqueue.h> 20 21 #include <linux/reboot.h> 21 22 #include <linux/interrupt.h>
+1
arch/powerpc/platforms/85xx/smp.c
··· 15 15 #include <linux/init.h> 16 16 #include <linux/delay.h> 17 17 #include <linux/of.h> 18 + #include <linux/of_address.h> 18 19 #include <linux/kexec.h> 19 20 #include <linux/highmem.h> 20 21 #include <linux/cpu.h>
+2
arch/powerpc/platforms/85xx/socrates_fpga_pic.c
··· 9 9 */ 10 10 11 11 #include <linux/irq.h> 12 + #include <linux/of_address.h> 13 + #include <linux/of_irq.h> 12 14 #include <linux/of_platform.h> 13 15 #include <linux/io.h> 14 16
+1
arch/powerpc/platforms/86xx/pic.c
··· 10 10 #include <linux/stddef.h> 11 11 #include <linux/kernel.h> 12 12 #include <linux/interrupt.h> 13 + #include <linux/of_irq.h> 13 14 #include <linux/of_platform.h> 14 15 15 16 #include <asm/mpic.h>
+2
arch/powerpc/platforms/8xx/ep88xc.c
··· 10 10 */ 11 11 12 12 #include <linux/init.h> 13 + #include <linux/of_address.h> 14 + #include <linux/of_fdt.h> 13 15 #include <linux/of_platform.h> 14 16 15 17 #include <asm/machdep.h>
+2
arch/powerpc/platforms/8xx/mpc86xads_setup.c
··· 15 15 */ 16 16 17 17 #include <linux/init.h> 18 + #include <linux/of_address.h> 19 + #include <linux/of_fdt.h> 18 20 #include <linux/of_platform.h> 19 21 20 22 #include <asm/io.h>
+2
arch/powerpc/platforms/8xx/mpc885ads_setup.c
··· 25 25 #include <linux/fs_uart_pd.h> 26 26 #include <linux/fsl_devices.h> 27 27 #include <linux/mii.h> 28 + #include <linux/of_address.h> 29 + #include <linux/of_fdt.h> 28 30 #include <linux/of_platform.h> 29 31 30 32 #include <asm/delay.h>
+1
arch/powerpc/platforms/8xx/tqm8xx_setup.c
··· 28 28 #include <linux/fs_uart_pd.h> 29 29 #include <linux/fsl_devices.h> 30 30 #include <linux/mii.h> 31 + #include <linux/of_fdt.h> 31 32 #include <linux/of_platform.h> 32 33 33 34 #include <asm/delay.h>
+2 -4
arch/powerpc/platforms/cell/celleb_scc_pciex.c
··· 486 486 struct pci_controller *phb) 487 487 { 488 488 struct resource r; 489 - struct of_irq oirq; 490 489 int virq; 491 490 492 491 /* SMMIO registers; used inside this file */ ··· 506 507 phb->ops = &scc_pciex_pci_ops; 507 508 508 509 /* internal interrupt handler */ 509 - if (of_irq_map_one(node, 1, &oirq)) { 510 + virq = irq_of_parse_and_map(node, 1); 511 + if (!virq) { 510 512 pr_err("PCIEXC:Failed to map irq\n"); 511 513 goto error; 512 514 } 513 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 514 - oirq.size); 515 515 if (request_irq(virq, pciex_handle_internal_irq, 516 516 0, "pciex", (void *)phb)) { 517 517 pr_err("PCIEXC:Failed to request irq\n");
+3 -4
arch/powerpc/platforms/cell/celleb_scc_sio.c
··· 45 45 struct device_node *node; 46 46 int i; 47 47 struct uart_port req; 48 - struct of_irq irq; 48 + struct of_phandle_args irq; 49 49 struct resource res; 50 50 51 51 for_each_compatible_node(node, "serial", "toshiba,sio-scc") { ··· 53 53 if (!(txx9_serial_bitmap & (1<<i))) 54 54 continue; 55 55 56 - if (of_irq_map_one(node, i, &irq)) 56 + if (of_irq_parse_one(node, i, &irq)) 57 57 continue; 58 58 if (of_address_to_resource(node, 59 59 txx9_scc_tab[i].index, &res)) ··· 66 66 #ifdef CONFIG_SERIAL_TXX9_CONSOLE 67 67 req.membase = ioremap(req.mapbase, 0x24); 68 68 #endif 69 - req.irq = irq_create_of_mapping(irq.controller, 70 - irq.specifier, irq.size); 69 + req.irq = irq_create_of_mapping(&irq); 71 70 req.flags |= UPF_IOREMAP | UPF_BUGGY_UART 72 71 /*HAVE_CTS_LINE*/; 73 72 req.uartclk = 83300000;
+2 -5
arch/powerpc/platforms/cell/spider-pic.c
··· 235 235 /* First, we check whether we have a real "interrupts" in the device 236 236 * tree in case the device-tree is ever fixed 237 237 */ 238 - struct of_irq oirq; 239 - if (of_irq_map_one(pic->host->of_node, 0, &oirq) == 0) { 240 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 241 - oirq.size); 238 + virq = irq_of_parse_and_map(pic->host->of_node, 0); 239 + if (virq) 242 240 return virq; 243 - } 244 241 245 242 /* Now do the horrible hacks */ 246 243 tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL);
+6 -7
arch/powerpc/platforms/cell/spu_manage.c
··· 177 177 178 178 static 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 181 int ret; 182 182 int i; 183 183 184 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 186 if (ret) { 187 187 pr_debug("spu_new: failed to get irq %d\n", i); 188 188 goto err; 189 189 } 190 190 ret = -EINVAL; 191 - pr_debug(" irq %d no 0x%x on %s\n", i, oirq.specifier[0], 192 - oirq.controller->full_name); 193 - spu->irqs[i] = irq_create_of_mapping(oirq.controller, 194 - oirq.specifier, oirq.size); 191 + pr_debug(" irq %d no 0x%x on %s\n", i, oirq.args[0], 192 + oirq.np->full_name); 193 + spu->irqs[i] = irq_create_of_mapping(&oirq); 195 194 if (spu->irqs[i] == NO_IRQ) { 196 195 pr_debug("spu_new: failed to map it !\n"); 197 196 goto err; ··· 199 200 return 0; 200 201 201 202 err: 202 - pr_debug("failed to map irq %x for spu %s\n", *oirq.specifier, 203 + pr_debug("failed to map irq %x for spu %s\n", *oirq.args, 203 204 spu->name); 204 205 for (; i >= 0; i--) { 205 206 if (spu->irqs[i] != NO_IRQ)
+1
arch/powerpc/platforms/embedded6xx/flipper-pic.c
··· 18 18 #include <linux/init.h> 19 19 #include <linux/irq.h> 20 20 #include <linux/of.h> 21 + #include <linux/of_address.h> 21 22 #include <asm/io.h> 22 23 23 24 #include "flipper-pic.h"
+2
arch/powerpc/platforms/embedded6xx/hlwd-pic.c
··· 18 18 #include <linux/init.h> 19 19 #include <linux/irq.h> 20 20 #include <linux/of.h> 21 + #include <linux/of_address.h> 22 + #include <linux/of_irq.h> 21 23 #include <asm/io.h> 22 24 23 25 #include "hlwd-pic.h"
+6 -6
arch/powerpc/platforms/fsl_uli1575.c
··· 321 321 { 322 322 struct pci_controller *hose = pci_bus_to_host(dev->bus); 323 323 struct device_node *hosenode = hose ? hose->dn : NULL; 324 - struct of_irq oirq; 325 - int virq, pin = 2; 324 + struct of_phandle_args oirq; 326 325 u32 laddr[3]; 327 326 328 327 if (!machine_is(mpc86xx_hpcd)) ··· 330 331 if (!hosenode) 331 332 return; 332 333 334 + oirq.np = hosenode; 335 + oirq.args[0] = 2; 336 + oirq.args_count = 1; 333 337 laddr[0] = (hose->first_busno << 16) | (PCI_DEVFN(31, 0) << 8); 334 338 laddr[1] = laddr[2] = 0; 335 - of_irq_map_raw(hosenode, &pin, 1, laddr, &oirq); 336 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 337 - oirq.size); 338 - dev->irq = virq; 339 + of_irq_parse_raw(laddr, &oirq); 340 + dev->irq = irq_create_of_mapping(&oirq); 339 341 } 340 342 341 343 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575);
+1
arch/powerpc/platforms/pasemi/gpio_mdio.c
··· 30 30 #include <linux/ioport.h> 31 31 #include <linux/interrupt.h> 32 32 #include <linux/phy.h> 33 + #include <linux/of_address.h> 33 34 #include <linux/of_mdio.h> 34 35 #include <linux/of_platform.h> 35 36
+1
arch/powerpc/platforms/powermac/pfunc_base.c
··· 4 4 #include <linux/kernel.h> 5 5 #include <linux/interrupt.h> 6 6 #include <linux/spinlock.h> 7 + #include <linux/of_irq.h> 7 8 8 9 #include <asm/pmac_feature.h> 9 10 #include <asm/pmac_pfunc.h>
+5 -5
arch/powerpc/platforms/powermac/pic.c
··· 393 393 #endif 394 394 } 395 395 396 - int of_irq_map_oldworld(struct device_node *device, int index, 397 - struct of_irq *out_irq) 396 + int of_irq_parse_oldworld(struct device_node *device, int index, 397 + struct of_phandle_args *out_irq) 398 398 { 399 399 const u32 *ints = NULL; 400 400 int intlen; ··· 422 422 if (index >= intlen) 423 423 return -EINVAL; 424 424 425 - out_irq->controller = NULL; 426 - out_irq->specifier[0] = ints[index]; 427 - out_irq->size = 1; 425 + out_irq->np = NULL; 426 + out_irq->args[0] = ints[index]; 427 + out_irq->args_count = 1; 428 428 429 429 return 0; 430 430 }
+1
arch/powerpc/platforms/powernv/opal-lpc.c
··· 17 17 #include <asm/firmware.h> 18 18 #include <asm/xics.h> 19 19 #include <asm/opal.h> 20 + #include <asm/prom.h> 20 21 21 22 static int opal_lpc_chip_id = -1; 22 23
+1
arch/powerpc/platforms/powernv/opal.c
··· 13 13 14 14 #include <linux/types.h> 15 15 #include <linux/of.h> 16 + #include <linux/of_fdt.h> 16 17 #include <linux/of_platform.h> 17 18 #include <linux/interrupt.h> 18 19 #include <linux/notifier.h>
+1
arch/powerpc/platforms/powernv/setup.c
··· 23 23 #include <linux/irq.h> 24 24 #include <linux/seq_file.h> 25 25 #include <linux/of.h> 26 + #include <linux/of_fdt.h> 26 27 #include <linux/interrupt.h> 27 28 #include <linux/bug.h> 28 29
+3 -5
arch/powerpc/platforms/pseries/event_sources.c
··· 25 25 const char *name) 26 26 { 27 27 int i, index, count = 0; 28 - struct of_irq oirq; 28 + struct of_phandle_args oirq; 29 29 const u32 *opicprop; 30 30 unsigned int opicplen; 31 31 unsigned int virqs[16]; ··· 55 55 /* Else use normal interrupt tree parsing */ 56 56 else { 57 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 59 index++) { 60 60 if (count > 15) 61 61 break; 62 - virqs[count] = irq_create_of_mapping(oirq.controller, 63 - oirq.specifier, 64 - oirq.size); 62 + virqs[count] = irq_create_of_mapping(&oirq); 65 63 if (virqs[count] == NO_IRQ) { 66 64 pr_err("event-sources: Unable to allocate " 67 65 "interrupt number for %s\n",
+2
arch/powerpc/platforms/pseries/hotplug-memory.c
··· 10 10 */ 11 11 12 12 #include <linux/of.h> 13 + #include <linux/of_address.h> 13 14 #include <linux/memblock.h> 14 15 #include <linux/vmalloc.h> 15 16 #include <linux/memory.h> 16 17 17 18 #include <asm/firmware.h> 18 19 #include <asm/machdep.h> 20 + #include <asm/prom.h> 19 21 #include <asm/sparsemem.h> 20 22 21 23 static unsigned long get_memblock_size(void)
+1
arch/powerpc/sysdev/cpm_common.c
··· 22 22 #include <linux/spinlock.h> 23 23 #include <linux/export.h> 24 24 #include <linux/of.h> 25 + #include <linux/of_address.h> 25 26 #include <linux/slab.h> 26 27 27 28 #include <asm/udbg.h>
+1
arch/powerpc/sysdev/ehv_pic.c
··· 19 19 #include <linux/slab.h> 20 20 #include <linux/spinlock.h> 21 21 #include <linux/of.h> 22 + #include <linux/of_address.h> 22 23 23 24 #include <asm/io.h> 24 25 #include <asm/irq.h>
+6 -5
arch/powerpc/sysdev/fsl_gtm.c
··· 19 19 #include <linux/list.h> 20 20 #include <linux/io.h> 21 21 #include <linux/of.h> 22 + #include <linux/of_address.h> 23 + #include <linux/of_irq.h> 22 24 #include <linux/spinlock.h> 23 25 #include <linux/bitops.h> 24 26 #include <linux/slab.h> ··· 403 401 gtm->clock = *clock; 404 402 405 403 for (i = 0; i < ARRAY_SIZE(gtm->timers); i++) { 406 - int ret; 407 - struct resource irq; 404 + unsigned int irq; 408 405 409 - ret = of_irq_to_resource(np, i, &irq); 410 - if (ret == NO_IRQ) { 406 + irq = irq_of_parse_and_map(np, i); 407 + if (irq == NO_IRQ) { 411 408 pr_err("%s: not enough interrupts specified\n", 412 409 np->full_name); 413 410 goto err; 414 411 } 415 - gtm->timers[i].irq = irq.start; 412 + gtm->timers[i].irq = irq; 416 413 gtm->timers[i].gtm = gtm; 417 414 } 418 415
+1
arch/powerpc/sysdev/fsl_pmc.c
··· 18 18 #include <linux/suspend.h> 19 19 #include <linux/delay.h> 20 20 #include <linux/device.h> 21 + #include <linux/of_address.h> 21 22 #include <linux/of_platform.h> 22 23 23 24 struct pmc_regs {
+2
arch/powerpc/sysdev/fsl_rio.c
··· 28 28 #include <linux/dma-mapping.h> 29 29 #include <linux/interrupt.h> 30 30 #include <linux/device.h> 31 + #include <linux/of_address.h> 32 + #include <linux/of_irq.h> 31 33 #include <linux/of_platform.h> 32 34 #include <linux/delay.h> 33 35 #include <linux/slab.h>
+1
arch/powerpc/sysdev/fsl_rmu.c
··· 27 27 #include <linux/types.h> 28 28 #include <linux/dma-mapping.h> 29 29 #include <linux/interrupt.h> 30 + #include <linux/of_irq.h> 30 31 #include <linux/of_platform.h> 31 32 #include <linux/slab.h> 32 33
+4 -4
arch/powerpc/sysdev/mpic.c
··· 535 535 mpic->fixups[irq].data = readl(base + 4) | 0x80000000; 536 536 } 537 537 } 538 - 538 + 539 539 540 540 static void __init mpic_scan_ht_pics(struct mpic *mpic) 541 541 { ··· 1481 1481 * as a default instead of the value read from the HW. 1482 1482 */ 1483 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 1485 if (isu_size) 1486 1486 last_irq = isu_size * MPIC_MAX_ISU - 1; 1487 1487 of_property_read_u32(mpic->node, "last-interrupt-source", &last_irq); ··· 1631 1631 /* start with vector = source number, and masked */ 1632 1632 u32 vecpri = MPIC_VECPRI_MASK | i | 1633 1633 (8 << MPIC_VECPRI_PRIORITY_SHIFT); 1634 - 1634 + 1635 1635 /* check if protected */ 1636 1636 if (mpic->protected && test_bit(i, mpic->protected)) 1637 1637 continue; ··· 1640 1640 mpic_irq_write(i, MPIC_INFO(IRQ_DESTINATION), 1 << cpu); 1641 1641 } 1642 1642 } 1643 - 1643 + 1644 1644 /* Init spurious vector */ 1645 1645 mpic_write(mpic->gregs, MPIC_INFO(GREG_SPURIOUS), mpic->spurious_vec); 1646 1646
+2 -4
arch/powerpc/sysdev/mpic_msgr.c
··· 237 237 raw_spin_lock_init(&msgr->lock); 238 238 239 239 if (receive_mask & (1 << i)) { 240 - struct resource irq; 241 - 242 - if (of_irq_to_resource(np, irq_index, &irq) == NO_IRQ) { 240 + msgr->irq = irq_of_parse_and_map(np, irq_index); 241 + if (msgr->irq == NO_IRQ) { 243 242 dev_err(&dev->dev, 244 243 "Missing interrupt specifier"); 245 244 kfree(msgr); 246 245 return -EFAULT; 247 246 } 248 - msgr->irq = irq.start; 249 247 irq_index += 1; 250 248 } else { 251 249 msgr->irq = NO_IRQ;
+4 -4
arch/powerpc/sysdev/mpic_msi.c
··· 35 35 const struct irq_domain_ops *ops = mpic->irqhost->ops; 36 36 struct device_node *np; 37 37 int flags, index, i; 38 - struct of_irq oirq; 38 + struct of_phandle_args oirq; 39 39 40 40 pr_debug("mpic: found U3, guessing msi allocator setup\n"); 41 41 ··· 63 63 pr_debug("mpic: mapping hwirqs for %s\n", np->full_name); 64 64 65 65 index = 0; 66 - while (of_irq_map_one(np, index++, &oirq) == 0) { 67 - ops->xlate(mpic->irqhost, NULL, oirq.specifier, 68 - oirq.size, &hwirq, &flags); 66 + while (of_irq_parse_one(np, index++, &oirq) == 0) { 67 + ops->xlate(mpic->irqhost, NULL, oirq.args, 68 + oirq.args_count, &hwirq, &flags); 69 69 msi_bitmap_reserve_hwirq(&mpic->msi_bitmap, hwirq); 70 70 } 71 71 }
+2
arch/powerpc/sysdev/mpic_timer.c
··· 19 19 #include <linux/interrupt.h> 20 20 #include <linux/slab.h> 21 21 #include <linux/of.h> 22 + #include <linux/of_address.h> 22 23 #include <linux/of_device.h> 24 + #include <linux/of_irq.h> 23 25 #include <linux/syscore_ops.h> 24 26 #include <sysdev/fsl_soc.h> 25 27 #include <asm/io.h>
+1
arch/powerpc/sysdev/of_rtc.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/of.h> 13 13 #include <linux/init.h> 14 + #include <linux/of_address.h> 14 15 #include <linux/of_platform.h> 15 16 #include <linux/slab.h> 16 17
+1
arch/powerpc/sysdev/ppc4xx_ocm.c
··· 26 26 #include <linux/kernel.h> 27 27 #include <linux/dma-mapping.h> 28 28 #include <linux/of.h> 29 + #include <linux/of_address.h> 29 30 #include <asm/rheap.h> 30 31 #include <asm/ppc4xx_ocm.h> 31 32 #include <linux/slab.h>
+1
arch/powerpc/sysdev/ppc4xx_soc.c
··· 19 19 #include <linux/errno.h> 20 20 #include <linux/interrupt.h> 21 21 #include <linux/irq.h> 22 + #include <linux/of_irq.h> 22 23 #include <linux/of_platform.h> 23 24 24 25 #include <asm/dcr.h>
+2
arch/powerpc/sysdev/xilinx_intc.c
··· 23 23 #include <linux/kernel.h> 24 24 #include <linux/irq.h> 25 25 #include <linux/of.h> 26 + #include <linux/of_address.h> 27 + #include <linux/of_irq.h> 26 28 #include <asm/io.h> 27 29 #include <asm/processor.h> 28 30 #include <asm/i8259.h>
-12
arch/sparc/include/asm/prom.h
··· 43 43 const char *name, 44 44 int def); 45 45 extern int of_find_in_proplist(const char *list, const char *match, int len); 46 - #ifdef CONFIG_NUMA 47 - extern int of_node_to_nid(struct device_node *dp); 48 - #define of_node_to_nid of_node_to_nid 49 - #endif 50 46 51 47 extern void prom_build_devicetree(void); 52 48 extern void of_populate_present_mask(void); ··· 58 62 59 63 extern void irq_trans_init(struct device_node *dp); 60 64 extern char *build_path_component(struct device_node *dp); 61 - 62 - /* SPARC has local implementations */ 63 - extern int of_address_to_resource(struct device_node *dev, int index, 64 - struct resource *r); 65 - #define of_address_to_resource of_address_to_resource 66 - 67 - void __iomem *of_iomap(struct device_node *node, int index); 68 - #define of_iomap of_iomap 69 65 70 66 #endif /* __KERNEL__ */ 71 67 #endif /* _SPARC_PROM_H */
+53
arch/sparc/kernel/prom_64.c
··· 373 373 return (tlb_type == spitfire ? "upa-portid" : "portid"); 374 374 } 375 375 376 + bool 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 + 376 429 static void *of_iterate_over_cpus(void *(*func)(struct device_node *, int, int), int arg) 377 430 { 378 431 struct device_node *dp;
-5
arch/x86/include/asm/prom.h
··· 39 39 40 40 extern char cmd_line[COMMAND_LINE_SIZE]; 41 41 42 - #define pci_address_to_pio pci_address_to_pio 43 - unsigned long pci_address_to_pio(phys_addr_t addr); 44 - 45 - #define HAVE_ARCH_DEVTREE_FIXUPS 46 - 47 42 #endif /* __ASSEMBLY__ */ 48 43 #endif
+10 -41
arch/x86/kernel/devicetree.c
··· 20 20 #include <asm/hpet.h> 21 21 #include <asm/apic.h> 22 22 #include <asm/pci_x86.h> 23 + #include <asm/setup.h> 23 24 24 25 __initdata u64 initial_dtb; 25 26 char __initdata cmd_line[COMMAND_LINE_SIZE]; 26 27 27 28 int __initdata of_ioapic; 28 - 29 - unsigned 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 - } 37 - EXPORT_SYMBOL_GPL(pci_address_to_pio); 38 29 39 30 void __init early_init_dt_scan_chosen_arch(unsigned long node) 40 31 { ··· 41 50 { 42 51 return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); 43 52 } 44 - 45 - #ifdef CONFIG_BLK_DEV_INITRD 46 - void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) 47 - { 48 - initrd_start = (unsigned long)__va(start); 49 - initrd_end = (unsigned long)__va(end); 50 - initrd_below_start_ok = 1; 51 - } 52 - #endif 53 53 54 54 void __init add_dtb(u64 data) 55 55 { ··· 87 105 88 106 static int x86_of_pci_irq_enable(struct pci_dev *dev) 89 107 { 90 - struct of_irq oirq; 91 108 u32 virq; 92 109 int ret; 93 110 u8 pin; ··· 97 116 if (!pin) 98 117 return 0; 99 118 100 - ret = of_irq_map_pci(dev, &oirq); 101 - if (ret) 102 - return ret; 103 - 104 - virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 105 - oirq.size); 119 + virq = of_irq_parse_and_map_pci(dev, 0, 0); 106 120 if (virq == 0) 107 121 return -EINVAL; 108 122 dev->irq = virq; ··· 206 230 static void __init x86_flattree_get_config(void) 207 231 { 208 232 u32 size, map_len; 209 - void *new_dtb; 233 + struct boot_param_header *dt; 210 234 211 235 if (!initial_dtb) 212 236 return; ··· 214 238 map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), 215 239 (u64)sizeof(struct boot_param_header)); 216 240 217 - initial_boot_params = early_memremap(initial_dtb, map_len); 218 - size = be32_to_cpu(initial_boot_params->totalsize); 241 + dt = early_memremap(initial_dtb, map_len); 242 + size = be32_to_cpu(dt->totalsize); 219 243 if (map_len < size) { 220 - early_iounmap(initial_boot_params, map_len); 221 - initial_boot_params = early_memremap(initial_dtb, size); 244 + early_iounmap(dt, map_len); 245 + dt = early_memremap(initial_dtb, size); 222 246 map_len = size; 223 247 } 224 248 225 - new_dtb = alloc_bootmem(size); 226 - memcpy(new_dtb, initial_boot_params, size); 227 - early_iounmap(initial_boot_params, map_len); 228 - 229 - initial_boot_params = new_dtb; 230 - 231 - /* root level address cells */ 232 - of_scan_flat_dt(early_init_dt_scan_root, NULL); 233 - 234 - unflatten_device_tree(); 249 + initial_boot_params = dt; 250 + unflatten_and_copy_device_tree(); 251 + early_iounmap(dt, map_len); 235 252 } 236 253 #else 237 254 static inline void x86_flattree_get_config(void) { }
-6
arch/xtensa/include/asm/prom.h
··· 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 */
+14 -41
arch/xtensa/kernel/setup.c
··· 21 21 #include <linux/screen_info.h> 22 22 #include <linux/bootmem.h> 23 23 #include <linux/kernel.h> 24 - 25 - #ifdef CONFIG_OF 26 24 #include <linux/of_fdt.h> 27 25 #include <linux/of_platform.h> 28 - #endif 29 26 30 27 #if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE) 31 28 # include <linux/console.h> ··· 61 64 struct rtc_ops *rtc_ops; 62 65 63 66 #ifdef CONFIG_BLK_DEV_INITRD 64 - extern void *initrd_start; 65 - extern void *initrd_end; 67 + extern unsigned long initrd_start; 68 + extern unsigned long initrd_end; 66 69 int initrd_is_mapped = 0; 67 70 extern int initrd_below_start_ok; 68 71 #endif ··· 149 152 { 150 153 meminfo_t* mi; 151 154 mi = (meminfo_t*)(tag->data); 152 - initrd_start = __va(mi->start); 153 - initrd_end = __va(mi->end); 155 + initrd_start = (unsigned long)__va(mi->start); 156 + initrd_end = (unsigned long)__va(mi->end); 154 157 155 158 return 0; 156 159 } ··· 166 169 } 167 170 168 171 __tagtable(BP_TAG_FDT, parse_tag_fdt); 169 - 170 - void __init early_init_dt_setup_initrd_arch(u64 start, u64 end) 171 - { 172 - initrd_start = (void *)__va(start); 173 - initrd_end = (void *)__va(end); 174 - initrd_below_start_ok = 1; 175 - } 176 172 177 173 #endif /* CONFIG_OF */ 178 174 ··· 212 222 } 213 223 214 224 #ifdef CONFIG_OF 225 + bool __initdata dt_memory_scan = false; 215 226 216 227 void __init early_init_dt_add_memory_arch(u64 base, u64 size) 217 228 { 229 + if (!dt_memory_scan) 230 + return; 231 + 218 232 size &= PAGE_MASK; 219 233 add_sysmem_bank(MEMORY_TYPE_CONVENTIONAL, base, base + size); 220 234 } ··· 230 236 231 237 void __init early_init_devtree(void *params) 232 238 { 233 - /* Setup flat device-tree pointer */ 234 - initial_boot_params = params; 235 - 236 - /* Retrieve various informations from the /chosen node of the 237 - * device-tree, including the platform type, initrd location and 238 - * size, TCE reserve, and more ... 239 - */ 240 - if (!command_line[0]) 241 - of_scan_flat_dt(early_init_dt_scan_chosen, command_line); 242 - 243 - /* Scan memory nodes and rebuild MEMBLOCKs */ 244 - of_scan_flat_dt(early_init_dt_scan_root, NULL); 245 239 if (sysmem.nr_banks == 0) 246 - of_scan_flat_dt(early_init_dt_scan_memory, NULL); 247 - } 240 + dt_memory_scan = true; 248 241 249 - static void __init copy_devtree(void) 250 - { 251 - void *alloc = early_init_dt_alloc_memory_arch( 252 - be32_to_cpu(initial_boot_params->totalsize), 8); 253 - if (alloc) { 254 - memcpy(alloc, initial_boot_params, 255 - be32_to_cpu(initial_boot_params->totalsize)); 256 - initial_boot_params = alloc; 257 - } 242 + early_init_dt_scan(params); 243 + 244 + if (!command_line[0]) 245 + strlcpy(command_line, boot_command_line, COMMAND_LINE_SIZE); 258 246 } 259 247 260 248 static int __init xtensa_device_probe(void) ··· 501 525 502 526 bootmem_init(); 503 527 504 - #ifdef CONFIG_OF 505 - copy_devtree(); 506 - unflatten_device_tree(); 507 - #endif 528 + unflatten_and_copy_device_tree(); 508 529 509 530 platform_setup(cmdline_p); 510 531
+2
drivers/ata/sata_dwc_460ex.c
··· 31 31 #include <linux/module.h> 32 32 #include <linux/init.h> 33 33 #include <linux/device.h> 34 + #include <linux/of_address.h> 35 + #include <linux/of_irq.h> 34 36 #include <linux/of_platform.h> 35 37 #include <linux/platform_device.h> 36 38 #include <linux/libata.h>
+2
drivers/ata/sata_fsl.c
··· 24 24 #include <scsi/scsi_cmnd.h> 25 25 #include <linux/libata.h> 26 26 #include <asm/io.h> 27 + #include <linux/of_address.h> 28 + #include <linux/of_irq.h> 27 29 #include <linux/of_platform.h> 28 30 29 31 static unsigned int intr_coalescing_count;
+1
drivers/char/bsr.c
··· 21 21 22 22 #include <linux/kernel.h> 23 23 #include <linux/of.h> 24 + #include <linux/of_address.h> 24 25 #include <linux/of_device.h> 25 26 #include <linux/of_platform.h> 26 27 #include <linux/fs.h>
+1
drivers/char/hw_random/pasemi-rng.c
··· 24 24 #include <linux/platform_device.h> 25 25 #include <linux/hw_random.h> 26 26 #include <linux/delay.h> 27 + #include <linux/of_address.h> 27 28 #include <linux/of_platform.h> 28 29 #include <asm/io.h> 29 30
+1
drivers/char/hw_random/ppc4xx-rng.c
··· 13 13 #include <linux/platform_device.h> 14 14 #include <linux/hw_random.h> 15 15 #include <linux/delay.h> 16 + #include <linux/of_address.h> 16 17 #include <linux/of_platform.h> 17 18 #include <asm/io.h> 18 19
+1
drivers/clk/clk-ppc-corenet.c
··· 11 11 #include <linux/io.h> 12 12 #include <linux/kernel.h> 13 13 #include <linux/module.h> 14 + #include <linux/of_address.h> 14 15 #include <linux/of_platform.h> 15 16 #include <linux/of.h> 16 17 #include <linux/slab.h>
+1
drivers/cpufreq/pasemi-cpufreq.c
··· 28 28 #include <linux/cpufreq.h> 29 29 #include <linux/timer.h> 30 30 #include <linux/module.h> 31 + #include <linux/of_address.h> 31 32 32 33 #include <asm/hw_irq.h> 33 34 #include <asm/io.h>
+3
drivers/crypto/amcc/crypto4xx_core.c
··· 27 27 #include <linux/dma-mapping.h> 28 28 #include <linux/platform_device.h> 29 29 #include <linux/init.h> 30 + #include <linux/module.h> 31 + #include <linux/of_address.h> 32 + #include <linux/of_irq.h> 30 33 #include <linux/of_platform.h> 31 34 #include <linux/slab.h> 32 35 #include <asm/dcr.h>
+4 -1
drivers/crypto/caam/ctrl.c
··· 5 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 11 #include "compat.h" 9 12 #include "regs.h" 10 13 #include "intern.h" ··· 227 224 topregs = (struct caam_full __iomem *)ctrl; 228 225 229 226 /* Get the IRQ of the controller (for security violations only) */ 230 - ctrlpriv->secvio_irq = of_irq_to_resource(nprop, 0, NULL); 227 + ctrlpriv->secvio_irq = irq_of_parse_and_map(nprop, 0); 231 228 232 229 /* 233 230 * Enable DECO watchdogs and, if this is a PHYS_ADDR_T_64BIT kernel,
+3 -1
drivers/crypto/caam/jr.c
··· 5 5 * Copyright 2008-2012 Freescale Semiconductor, Inc. 6 6 */ 7 7 8 + #include <linux/of_irq.h> 9 + 8 10 #include "compat.h" 9 11 #include "regs.h" 10 12 #include "jr.h" ··· 405 403 dma_set_mask(jrdev, DMA_BIT_MASK(32)); 406 404 407 405 /* Identify the interrupt */ 408 - jrpriv->irq = of_irq_to_resource(np, 0, NULL); 406 + jrpriv->irq = irq_of_parse_and_map(np, 0); 409 407 410 408 /* Now do the platform independent part */ 411 409 error = caam_jr_init(jrdev); /* now turn on hardware */
+1 -1
drivers/crypto/omap-sham.c
··· 1818 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 1822 if (!dd->irq) { 1823 1823 dev_err(dev, "can't translate OF irq value\n"); 1824 1824 err = -EINVAL;
+2
drivers/crypto/talitos.c
··· 32 32 #include <linux/interrupt.h> 33 33 #include <linux/crypto.h> 34 34 #include <linux/hw_random.h> 35 + #include <linux/of_address.h> 36 + #include <linux/of_irq.h> 35 37 #include <linux/of_platform.h> 36 38 #include <linux/dma-mapping.h> 37 39 #include <linux/io.h>
+1
drivers/dma/bestcomm/sram.c
··· 19 19 #include <linux/string.h> 20 20 #include <linux/ioport.h> 21 21 #include <linux/of.h> 22 + #include <linux/of_address.h> 22 23 23 24 #include <asm/io.h> 24 25 #include <asm/mmu.h>
+2
drivers/dma/fsldma.c
··· 33 33 #include <linux/delay.h> 34 34 #include <linux/dma-mapping.h> 35 35 #include <linux/dmapool.h> 36 + #include <linux/of_address.h> 37 + #include <linux/of_irq.h> 36 38 #include <linux/of_platform.h> 37 39 38 40 #include "dmaengine.h"
+2
drivers/dma/mpc512x_dma.c
··· 39 39 #include <linux/interrupt.h> 40 40 #include <linux/io.h> 41 41 #include <linux/slab.h> 42 + #include <linux/of_address.h> 42 43 #include <linux/of_device.h> 44 + #include <linux/of_irq.h> 43 45 #include <linux/of_platform.h> 44 46 45 47 #include <linux/random.h>
+2
drivers/dma/ppc4xx/adma.c
··· 42 42 #include <linux/uaccess.h> 43 43 #include <linux/proc_fs.h> 44 44 #include <linux/of.h> 45 + #include <linux/of_address.h> 46 + #include <linux/of_irq.h> 45 47 #include <linux/of_platform.h> 46 48 #include <asm/dcr.h> 47 49 #include <asm/dcr-regs.h>
+1
drivers/edac/cell_edac.c
··· 15 15 #include <linux/platform_device.h> 16 16 #include <linux/stop_machine.h> 17 17 #include <linux/io.h> 18 + #include <linux/of_address.h> 18 19 #include <asm/machdep.h> 19 20 #include <asm/cell-regs.h> 20 21
+1
drivers/gpio/gpio-mpc8xxx.c
··· 14 14 #include <linux/io.h> 15 15 #include <linux/of.h> 16 16 #include <linux/of_gpio.h> 17 + #include <linux/of_irq.h> 17 18 #include <linux/gpio.h> 18 19 #include <linux/slab.h> 19 20 #include <linux/irq.h>
+1 -1
drivers/i2c/busses/i2c-cpm.c
··· 447 447 448 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 451 if (!cpm->irq) 452 452 return -EINVAL; 453 453
+2
drivers/i2c/busses/i2c-ibm_iic.c
··· 41 41 #include <asm/irq.h> 42 42 #include <linux/io.h> 43 43 #include <linux/i2c.h> 44 + #include <linux/of_address.h> 45 + #include <linux/of_irq.h> 44 46 #include <linux/of_platform.h> 45 47 46 48 #include "i2c-ibm_iic.h"
+2
drivers/i2c/busses/i2c-mpc.c
··· 17 17 #include <linux/module.h> 18 18 #include <linux/sched.h> 19 19 #include <linux/init.h> 20 + #include <linux/of_address.h> 21 + #include <linux/of_irq.h> 20 22 #include <linux/of_platform.h> 21 23 #include <linux/slab.h> 22 24
+1
drivers/i2c/busses/i2c-powermac.c
··· 27 27 #include <linux/init.h> 28 28 #include <linux/device.h> 29 29 #include <linux/platform_device.h> 30 + #include <linux/of_irq.h> 30 31 #include <asm/prom.h> 31 32 #include <asm/pmac_low_i2c.h> 32 33
+5 -3
drivers/input/serio/xilinx_ps2.c
··· 25 25 #include <linux/io.h> 26 26 #include <linux/of_address.h> 27 27 #include <linux/of_device.h> 28 + #include <linux/of_irq.h> 28 29 #include <linux/of_platform.h> 29 30 30 31 #define DRIVER_NAME "xilinx_ps2" ··· 236 235 */ 237 236 static int xps2_of_probe(struct platform_device *ofdev) 238 237 { 239 - struct resource r_irq; /* Interrupt resources */ 240 238 struct resource r_mem; /* IO mem resources */ 241 239 struct xps2data *drvdata; 242 240 struct serio *serio; 243 241 struct device *dev = &ofdev->dev; 244 242 resource_size_t remap_size, phys_addr; 243 + unsigned int irq; 245 244 int error; 246 245 247 246 dev_info(dev, "Device Tree Probing \'%s\'\n", ··· 255 254 } 256 255 257 256 /* Get IRQ for the device */ 258 - if (!of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq)) { 257 + irq = irq_of_parse_and_map(ofdev->dev.of_node, 0); 258 + if (!irq) { 259 259 dev_err(dev, "no IRQ found\n"); 260 260 return -ENODEV; 261 261 } ··· 269 267 } 270 268 271 269 spin_lock_init(&drvdata->lock); 272 - drvdata->irq = r_irq.start; 270 + drvdata->irq = irq; 273 271 drvdata->serio = serio; 274 272 drvdata->dev = dev; 275 273
+2
drivers/macintosh/macio_asic.c
··· 24 24 #include <linux/init.h> 25 25 #include <linux/module.h> 26 26 #include <linux/slab.h> 27 + #include <linux/of_address.h> 28 + #include <linux/of_irq.h> 27 29 28 30 #include <asm/machdep.h> 29 31 #include <asm/macio.h>
+2
drivers/macintosh/rack-meter.c
··· 25 25 #include <linux/pci.h> 26 26 #include <linux/dma-mapping.h> 27 27 #include <linux/kernel_stat.h> 28 + #include <linux/of_address.h> 29 + #include <linux/of_irq.h> 28 30 29 31 #include <asm/io.h> 30 32 #include <asm/prom.h>
+1
drivers/macintosh/smu.c
··· 35 35 #include <linux/poll.h> 36 36 #include <linux/mutex.h> 37 37 #include <linux/of_device.h> 38 + #include <linux/of_irq.h> 38 39 #include <linux/of_platform.h> 39 40 #include <linux/slab.h> 40 41
+2
drivers/macintosh/via-pmu.c
··· 46 46 #include <linux/suspend.h> 47 47 #include <linux/cpu.h> 48 48 #include <linux/compat.h> 49 + #include <linux/of_address.h> 50 + #include <linux/of_irq.h> 49 51 #include <asm/prom.h> 50 52 #include <asm/machdep.h> 51 53 #include <asm/io.h>
+2
drivers/media/platform/fsl-viu.c
··· 21 21 #include <linux/init.h> 22 22 #include <linux/interrupt.h> 23 23 #include <linux/io.h> 24 + #include <linux/of_address.h> 25 + #include <linux/of_irq.h> 24 26 #include <linux/of_platform.h> 25 27 #include <linux/slab.h> 26 28 #include <media/v4l2-common.h>
+2
drivers/misc/carma/carma-fpga-program.c
··· 10 10 */ 11 11 12 12 #include <linux/dma-mapping.h> 13 + #include <linux/of_address.h> 14 + #include <linux/of_irq.h> 13 15 #include <linux/of_platform.h> 14 16 #include <linux/completion.h> 15 17 #include <linux/miscdevice.h>
+2
drivers/misc/carma/carma-fpga.c
··· 88 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 93 #include <linux/of_platform.h> 92 94 #include <linux/dma-mapping.h> 93 95 #include <linux/miscdevice.h>
+1
drivers/mtd/nand/fsl_elbc_nand.c
··· 28 28 #include <linux/kernel.h> 29 29 #include <linux/string.h> 30 30 #include <linux/ioport.h> 31 + #include <linux/of_address.h> 31 32 #include <linux/of_platform.h> 32 33 #include <linux/platform_device.h> 33 34 #include <linux/slab.h>
+1
drivers/mtd/nand/fsl_ifc_nand.c
··· 24 24 #include <linux/types.h> 25 25 #include <linux/init.h> 26 26 #include <linux/kernel.h> 27 + #include <linux/of_address.h> 27 28 #include <linux/slab.h> 28 29 #include <linux/mtd/mtd.h> 29 30 #include <linux/mtd/nand.h>
+1
drivers/mtd/nand/fsl_upm.c
··· 18 18 #include <linux/mtd/nand_ecc.h> 19 19 #include <linux/mtd/partitions.h> 20 20 #include <linux/mtd/mtd.h> 21 + #include <linux/of_address.h> 21 22 #include <linux/of_platform.h> 22 23 #include <linux/of_gpio.h> 23 24 #include <linux/io.h>
+2
drivers/mtd/nand/mpc5121_nfc.c
··· 36 36 #include <linux/mtd/mtd.h> 37 37 #include <linux/mtd/nand.h> 38 38 #include <linux/mtd/partitions.h> 39 + #include <linux/of_address.h> 39 40 #include <linux/of_device.h> 41 + #include <linux/of_irq.h> 40 42 #include <linux/of_platform.h> 41 43 42 44 #include <asm/mpc5121.h>
+1
drivers/mtd/nand/ndfc.c
··· 30 30 #include <linux/mtd/ndfc.h> 31 31 #include <linux/slab.h> 32 32 #include <linux/mtd/mtd.h> 33 + #include <linux/of_address.h> 33 34 #include <linux/of_platform.h> 34 35 #include <asm/io.h> 35 36
+2
drivers/mtd/nand/pasemi_nand.c
··· 28 28 #include <linux/mtd/mtd.h> 29 29 #include <linux/mtd/nand.h> 30 30 #include <linux/mtd/nand_ecc.h> 31 + #include <linux/of_address.h> 32 + #include <linux/of_irq.h> 31 33 #include <linux/of_platform.h> 32 34 #include <linux/platform_device.h> 33 35 #include <linux/pci.h>
+1
drivers/mtd/nand/socrates_nand.c
··· 15 15 #include <linux/mtd/mtd.h> 16 16 #include <linux/mtd/nand.h> 17 17 #include <linux/mtd/partitions.h> 18 + #include <linux/of_address.h> 18 19 #include <linux/of_platform.h> 19 20 #include <linux/io.h> 20 21
-3
drivers/net/can/grcan.c
··· 34 34 #include <linux/io.h> 35 35 #include <linux/can/dev.h> 36 36 #include <linux/spinlock.h> 37 - 38 37 #include <linux/of_platform.h> 39 - #include <asm/prom.h> 40 - 41 38 #include <linux/of_irq.h> 42 39 43 40 #include <linux/dma-mapping.h>
-1
drivers/net/can/sja1000/sja1000_of_platform.c
··· 44 44 #include <linux/of_platform.h> 45 45 #include <linux/of_address.h> 46 46 #include <linux/of_irq.h> 47 - #include <asm/prom.h> 48 47 49 48 #include "sja1000.h" 50 49
+5 -5
drivers/net/ethernet/arc/emac_main.c
··· 628 628 629 629 static int arc_emac_probe(struct platform_device *pdev) 630 630 { 631 - struct resource res_regs, res_irq; 631 + struct resource res_regs; 632 632 struct device_node *phy_node; 633 633 struct arc_emac_priv *priv; 634 634 struct net_device *ndev; 635 635 const char *mac_addr; 636 - unsigned int id, clock_frequency; 636 + unsigned int id, clock_frequency, irq; 637 637 int err; 638 638 639 639 if (!pdev->dev.of_node) ··· 661 661 } 662 662 663 663 /* Get IRQ from device tree */ 664 - err = of_irq_to_resource(pdev->dev.of_node, 0, &res_irq); 665 - if (!err) { 664 + irq = irq_of_parse_and_map(pdev->dev.of_node, 0); 665 + if (!irq) { 666 666 dev_err(&pdev->dev, "failed to retrieve <irq> value from device tree\n"); 667 667 return -ENODEV; 668 668 } ··· 711 711 goto out; 712 712 } 713 713 714 - ndev->irq = res_irq.start; 714 + ndev->irq = irq; 715 715 dev_info(&pdev->dev, "IRQ is %d\n", ndev->irq); 716 716 717 717 /* Register interrupt handler for device */
+3 -1
drivers/net/ethernet/freescale/fs_enet/mac-fcc.c
··· 32 32 #include <linux/fs.h> 33 33 #include <linux/platform_device.h> 34 34 #include <linux/phy.h> 35 + #include <linux/of_address.h> 35 36 #include <linux/of_device.h> 37 + #include <linux/of_irq.h> 36 38 #include <linux/gfp.h> 37 39 38 40 #include <asm/immap_cpm2.h> ··· 90 88 struct fs_platform_info *fpi = fep->fpi; 91 89 int ret = -EINVAL; 92 90 93 - fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 91 + fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0); 94 92 if (fep->interrupt == NO_IRQ) 95 93 goto out; 96 94
+3 -1
drivers/net/ethernet/freescale/fs_enet/mac-fec.c
··· 31 31 #include <linux/bitops.h> 32 32 #include <linux/fs.h> 33 33 #include <linux/platform_device.h> 34 + #include <linux/of_address.h> 34 35 #include <linux/of_device.h> 36 + #include <linux/of_irq.h> 35 37 #include <linux/gfp.h> 36 38 37 39 #include <asm/irq.h> ··· 100 98 { 101 99 struct platform_device *ofdev = to_platform_device(fep->dev); 102 100 103 - fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 101 + fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0); 104 102 if (fep->interrupt == NO_IRQ) 105 103 return -EINVAL; 106 104
+3 -1
drivers/net/ethernet/freescale/fs_enet/mac-scc.c
··· 31 31 #include <linux/bitops.h> 32 32 #include <linux/fs.h> 33 33 #include <linux/platform_device.h> 34 + #include <linux/of_address.h> 35 + #include <linux/of_irq.h> 34 36 #include <linux/of_platform.h> 35 37 36 38 #include <asm/irq.h> ··· 100 98 { 101 99 struct platform_device *ofdev = to_platform_device(fep->dev); 102 100 103 - fep->interrupt = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); 101 + fep->interrupt = irq_of_parse_and_map(ofdev->dev.of_node, 0); 104 102 if (fep->interrupt == NO_IRQ) 105 103 return -EINVAL; 106 104
+1
drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c
··· 22 22 #include <linux/mii.h> 23 23 #include <linux/platform_device.h> 24 24 #include <linux/mdio-bitbang.h> 25 + #include <linux/of_address.h> 25 26 #include <linux/of_mdio.h> 26 27 #include <linux/of_platform.h> 27 28
+1
drivers/net/ethernet/freescale/fs_enet/mii-fec.c
··· 31 31 #include <linux/ethtool.h> 32 32 #include <linux/bitops.h> 33 33 #include <linux/platform_device.h> 34 + #include <linux/of_address.h> 34 35 #include <linux/of_platform.h> 35 36 36 37 #include <asm/pgtable.h>
+2
drivers/net/ethernet/freescale/gianfar.c
··· 78 78 #include <linux/if_vlan.h> 79 79 #include <linux/spinlock.h> 80 80 #include <linux/mm.h> 81 + #include <linux/of_address.h> 82 + #include <linux/of_irq.h> 81 83 #include <linux/of_mdio.h> 82 84 #include <linux/of_platform.h> 83 85 #include <linux/ip.h>
+2
drivers/net/ethernet/freescale/ucc_geth.c
··· 31 31 #include <linux/mii.h> 32 32 #include <linux/phy.h> 33 33 #include <linux/workqueue.h> 34 + #include <linux/of_address.h> 35 + #include <linux/of_irq.h> 34 36 #include <linux/of_mdio.h> 35 37 #include <linux/of_net.h> 36 38 #include <linux/of_platform.h>
+1
drivers/net/ethernet/freescale/xgmac_mdio.c
··· 17 17 #include <linux/module.h> 18 18 #include <linux/phy.h> 19 19 #include <linux/mdio.h> 20 + #include <linux/of_address.h> 20 21 #include <linux/of_platform.h> 21 22 #include <linux/of_mdio.h> 22 23
+2
drivers/net/ethernet/ibm/emac/core.c
··· 39 39 #include <linux/bitops.h> 40 40 #include <linux/workqueue.h> 41 41 #include <linux/of.h> 42 + #include <linux/of_address.h> 43 + #include <linux/of_irq.h> 42 44 #include <linux/of_net.h> 43 45 #include <linux/slab.h> 44 46
+1
drivers/net/ethernet/ibm/emac/mal.c
··· 27 27 28 28 #include <linux/delay.h> 29 29 #include <linux/slab.h> 30 + #include <linux/of_irq.h> 30 31 31 32 #include "core.h" 32 33 #include <asm/dcr-regs.h>
+1
drivers/net/ethernet/ibm/emac/rgmii.c
··· 24 24 #include <linux/slab.h> 25 25 #include <linux/kernel.h> 26 26 #include <linux/ethtool.h> 27 + #include <linux/of_address.h> 27 28 #include <asm/io.h> 28 29 29 30 #include "emac.h"
+1
drivers/net/ethernet/ibm/emac/tah.c
··· 18 18 * Free Software Foundation; either version 2 of the License, or (at your 19 19 * option) any later version. 20 20 */ 21 + #include <linux/of_address.h> 21 22 #include <asm/io.h> 22 23 23 24 #include "emac.h"
+1
drivers/net/ethernet/ibm/emac/zmii.c
··· 24 24 #include <linux/slab.h> 25 25 #include <linux/kernel.h> 26 26 #include <linux/ethtool.h> 27 + #include <linux/of_address.h> 27 28 #include <asm/io.h> 28 29 29 30 #include "emac.h"
+1
drivers/net/ethernet/xilinx/ll_temac_main.c
··· 36 36 #include <linux/netdevice.h> 37 37 #include <linux/of.h> 38 38 #include <linux/of_device.h> 39 + #include <linux/of_irq.h> 39 40 #include <linux/of_mdio.h> 40 41 #include <linux/of_platform.h> 41 42 #include <linux/of_address.h>
+1
drivers/of/Kconfig
··· 17 17 18 18 config OF_SELFTEST 19 19 bool "Device Tree Runtime self tests" 20 + depends on OF_IRQ 20 21 help 21 22 This option builds in test cases for the device tree infrastructure 22 23 that are executed one at boot time, and the results dumped to the
+13 -5
drivers/of/address.c
··· 489 489 int na, ns, pna, pns; 490 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 494 /* Increase refcount at current level */ 495 495 of_node_get(dev); ··· 504 504 bus->count_cells(dev, &na, &ns); 505 505 if (!OF_CHECK_COUNTS(na, ns)) { 506 506 printk(KERN_ERR "prom_parse: Bad cell count for %s\n", 507 - dev->full_name); 507 + of_node_full_name(dev)); 508 508 goto bail; 509 509 } 510 510 memcpy(addr, in_addr, na * 4); 511 511 512 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 514 of_dump_addr("OF: translating address:", addr, na); 515 515 516 516 /* Translate */ ··· 532 532 pbus->count_cells(dev, &pna, &pns); 533 533 if (!OF_CHECK_COUNTS(pna, pns)) { 534 534 printk(KERN_ERR "prom_parse: Bad cell count for %s\n", 535 - dev->full_name); 535 + of_node_full_name(dev)); 536 536 break; 537 537 } 538 538 539 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 542 /* Apply bus translation */ 543 543 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop)) ··· 625 625 return NULL; 626 626 } 627 627 EXPORT_SYMBOL(of_get_address); 628 + 629 + unsigned 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 + } 628 636 629 637 static int __of_address_to_resource(struct device_node *dev, 630 638 const __be32 *addrp, u64 size, unsigned int flags,
+46 -19
drivers/of/base.c
··· 74 74 } 75 75 EXPORT_SYMBOL(of_n_size_cells); 76 76 77 + #ifdef CONFIG_NUMA 78 + int __weak of_node_to_nid(struct device_node *np) 79 + { 80 + return numa_node_id(); 81 + } 82 + #endif 83 + 77 84 #if defined(CONFIG_OF_DYNAMIC) 78 85 /** 79 86 * of_node_get - Increment refcount of a node ··· 272 265 273 266 ac = of_n_addr_cells(cpun); 274 267 cell = of_get_property(cpun, prop_name, &prop_len); 275 - if (!cell) 268 + if (!cell || !ac) 276 269 return false; 277 - prop_len /= sizeof(*cell); 270 + prop_len /= sizeof(*cell) * ac; 278 271 for (tid = 0; tid < prop_len; tid++) { 279 272 hwid = of_read_number(cell, ac); 280 273 if (arch_match_cpu_phys_id(cpu, hwid)) { ··· 284 277 } 285 278 cell += ac; 286 279 } 280 + return false; 281 + } 282 + 283 + /* 284 + * arch_find_n_match_cpu_physical_id - See if the given device node is 285 + * for the cpu corresponding to logical cpu 'cpu'. Return true if so, 286 + * else false. If 'thread' is non-NULL, the local thread number within the 287 + * core is returned in it. 288 + */ 289 + bool __weak arch_find_n_match_cpu_physical_id(struct device_node *cpun, 290 + int cpu, unsigned int *thread) 291 + { 292 + /* Check for non-standard "ibm,ppc-interrupt-server#s" property 293 + * for thread ids on PowerPC. If it doesn't exist fallback to 294 + * standard "reg" property. 295 + */ 296 + if (IS_ENABLED(CONFIG_PPC) && 297 + __of_find_n_match_cpu_property(cpun, 298 + "ibm,ppc-interrupt-server#s", 299 + cpu, thread)) 300 + return true; 301 + 302 + if (__of_find_n_match_cpu_property(cpun, "reg", cpu, thread)) 303 + return true; 304 + 287 305 return false; 288 306 } 289 307 ··· 332 300 */ 333 301 struct device_node *of_get_cpu_node(int cpu, unsigned int *thread) 334 302 { 335 - struct device_node *cpun, *cpus; 303 + struct device_node *cpun; 336 304 337 - cpus = of_find_node_by_path("/cpus"); 338 - if (!cpus) 339 - return NULL; 340 - 341 - for_each_child_of_node(cpus, cpun) { 342 - if (of_node_cmp(cpun->type, "cpu")) 343 - continue; 344 - /* Check for non-standard "ibm,ppc-interrupt-server#s" property 345 - * for thread ids on PowerPC. If it doesn't exist fallback to 346 - * standard "reg" property. 347 - */ 348 - if (IS_ENABLED(CONFIG_PPC) && 349 - __of_find_n_match_cpu_property(cpun, 350 - "ibm,ppc-interrupt-server#s", cpu, thread)) 351 - return cpun; 352 - if (__of_find_n_match_cpu_property(cpun, "reg", cpu, thread)) 305 + for_each_node_by_type(cpun, "cpu") { 306 + if (arch_find_n_match_cpu_physical_id(cpun, cpu, thread)) 353 307 return cpun; 354 308 } 355 309 return NULL; ··· 1191 1173 return i; 1192 1174 } 1193 1175 EXPORT_SYMBOL_GPL(of_property_count_strings); 1176 + 1177 + void of_print_phandle_args(const char *msg, const struct of_phandle_args *args) 1178 + { 1179 + int i; 1180 + printk("%s %s", msg, of_node_full_name(args->np)); 1181 + for (i = 0; i < args->args_count; i++) 1182 + printk(i ? ",%08x" : ":%08x", args->args[i]); 1183 + printk("\n"); 1184 + } 1194 1185 1195 1186 static int __of_parse_phandle_with_args(const struct device_node *np, 1196 1187 const char *list_name,
+135 -3
drivers/of/fdt.c
··· 618 618 return ret; 619 619 } 620 620 621 + const 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 + */ 641 + const 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 681 #ifdef CONFIG_BLK_DEV_INITRD 622 682 /** 623 683 * early_init_dt_check_for_initrd - Decode initrd location from flat tree 624 684 * @node: reference to node containing initrd location ('chosen') 625 685 */ 626 - void __init early_init_dt_check_for_initrd(unsigned long node) 686 + static void __init early_init_dt_check_for_initrd(unsigned long node) 627 687 { 628 688 u64 start, end; 629 689 unsigned long len; ··· 701 641 return; 702 642 end = of_read_number(prop, len/4); 703 643 704 - early_init_dt_setup_initrd_arch(start, end); 644 + initrd_start = (unsigned long)__va(start); 645 + initrd_end = (unsigned long)__va(end); 646 + initrd_below_start_ok = 1; 647 + 705 648 pr_debug("initrd_start=0x%llx initrd_end=0x%llx\n", 706 649 (unsigned long long)start, (unsigned long long)end); 707 650 } 708 651 #else 709 - inline void early_init_dt_check_for_initrd(unsigned long node) 652 + static inline void early_init_dt_check_for_initrd(unsigned long node) 710 653 { 711 654 } 712 655 #endif /* CONFIG_BLK_DEV_INITRD */ ··· 837 774 } 838 775 839 776 #ifdef CONFIG_HAVE_MEMBLOCK 777 + void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) 778 + { 779 + const u64 phys_offset = __pa(PAGE_OFFSET); 780 + base &= PAGE_MASK; 781 + size &= PAGE_MASK; 782 + if (base + size < phys_offset) { 783 + pr_warning("Ignoring memory block 0x%llx - 0x%llx\n", 784 + base, base + size); 785 + return; 786 + } 787 + if (base < phys_offset) { 788 + pr_warning("Ignoring memory range 0x%llx - 0x%llx\n", 789 + base, phys_offset); 790 + size -= phys_offset - base; 791 + base = phys_offset; 792 + } 793 + memblock_add(base, size); 794 + } 795 + 840 796 /* 841 797 * called from unflatten_device_tree() to bootstrap devicetree itself 842 798 * Architectures can override this definition if memblock isn't used ··· 865 783 return __va(memblock_alloc(size, align)); 866 784 } 867 785 #endif 786 + 787 + bool __init early_init_dt_scan(void *params) 788 + { 789 + if (!params) 790 + return false; 791 + 792 + /* Setup flat device-tree pointer */ 793 + initial_boot_params = params; 794 + 795 + /* check device tree validity */ 796 + if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) { 797 + initial_boot_params = NULL; 798 + return false; 799 + } 800 + 801 + /* Retrieve various information from the /chosen node */ 802 + of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); 803 + 804 + /* Initialize {size,address}-cells info */ 805 + of_scan_flat_dt(early_init_dt_scan_root, NULL); 806 + 807 + /* Setup memory, calling early_init_dt_add_memory_arch */ 808 + of_scan_flat_dt(early_init_dt_scan_memory, NULL); 809 + 810 + return true; 811 + } 868 812 869 813 /** 870 814 * unflatten_device_tree - create tree of device_nodes from flat blob ··· 907 799 908 800 /* Get pointer to "/chosen" and "/aliases" nodes for use everywhere */ 909 801 of_alias_scan(early_init_dt_alloc_memory_arch); 802 + } 803 + 804 + /** 805 + * unflatten_and_copy_device_tree - copy and create tree of device_nodes from flat blob 806 + * 807 + * Copies and unflattens the device-tree passed by the firmware, creating the 808 + * tree of struct device_node. It also fills the "name" and "type" 809 + * pointers of the nodes so the normal device-tree walking functions 810 + * can be used. This should only be used when the FDT memory has not been 811 + * reserved such is the case when the FDT is built-in to the kernel init 812 + * section. If the FDT memory is reserved already then unflatten_device_tree 813 + * should be used instead. 814 + */ 815 + void __init unflatten_and_copy_device_tree(void) 816 + { 817 + int size = __be32_to_cpu(initial_boot_params->totalsize); 818 + void *dt = early_init_dt_alloc_memory_arch(size, 819 + __alignof__(struct boot_param_header)); 820 + 821 + if (dt) { 822 + memcpy(dt, initial_boot_params, size); 823 + initial_boot_params = dt; 824 + } 825 + unflatten_device_tree(); 910 826 } 911 827 912 828 #endif /* CONFIG_OF_EARLY_FLATTREE */
+94 -76
drivers/of/irq.c
··· 31 31 * @dev: Device node of the device whose interrupt is to be mapped 32 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 35 * irq_create_of_mapping() to make things easier to callers 36 36 */ 37 37 unsigned 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 42 return 0; 43 43 44 - return irq_create_of_mapping(oirq.controller, oirq.specifier, 45 - oirq.size); 44 + return irq_create_of_mapping(&oirq); 46 45 } 47 46 EXPORT_SYMBOL_GPL(irq_of_parse_and_map); 48 47 ··· 78 79 } 79 80 80 81 /** 81 - * of_irq_map_raw - Low level interrupt tree parsing 82 + * of_irq_parse_raw - Low level interrupt tree parsing 82 83 * @parent: the device interrupt parent 83 - * @intspec: interrupt specifier ("interrupts" property of the device) 84 - * @ointsize: size of the passed in interrupt specifier 85 - * @addr: address specifier (start of "reg" property of the device) 86 - * @out_irq: structure of_irq filled by this function 84 + * @addr: address specifier (start of "reg" property of the device) in be32 format 85 + * @out_irq: structure of_irq updated by this function 87 86 * 88 87 * Returns 0 on success and a negative number on error 89 88 * 90 89 * This function is a low-level interrupt tree walking function. It 91 90 * can be used to do a partial walk with synthetized reg and interrupts 92 91 * properties, for example when resolving PCI interrupts when no device 93 - * node exist for the parent. 92 + * node exist for the parent. It takes an interrupt specifier structure as 93 + * input, walks the tree looking for any interrupt-map properties, translates 94 + * the specifier for each map, and then returns the translated map. 94 95 */ 95 - int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 96 - u32 ointsize, const __be32 *addr, struct of_irq *out_irq) 96 + int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq) 97 97 { 98 98 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; 99 - const __be32 *tmp, *imap, *imask; 99 + __be32 initial_match_array[MAX_PHANDLE_ARGS]; 100 + const __be32 *match_array = initial_match_array; 101 + const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = ~0 }; 100 102 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; 101 103 int imaplen, match, i; 102 104 103 - pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n", 104 - parent->full_name, be32_to_cpup(intspec), 105 - be32_to_cpup(intspec + 1), ointsize); 105 + #ifdef DEBUG 106 + of_print_phandle_args("of_irq_parse_raw: ", out_irq); 107 + #endif 106 108 107 - ipar = of_node_get(parent); 109 + ipar = of_node_get(out_irq->np); 108 110 109 111 /* First get the #interrupt-cells property of the current cursor 110 112 * that tells us how to interpret the passed-in intspec. If there ··· 126 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 132 return -EINVAL; 133 133 134 134 /* Look for this #address-cells. We have to implement the old linux ··· 147 147 148 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 160 /* Now start the actual "proper" walk of the interrupt tree */ 151 161 while (ipar != NULL) { 152 162 /* Now check if cursor is an interrupt-controller and if it is ··· 165 155 if (of_get_property(ipar, "interrupt-controller", NULL) != 166 156 NULL) { 167 157 pr_debug(" -> got it !\n"); 168 - for (i = 0; i < intsize; i++) 169 - out_irq->specifier[i] = 170 - of_read_number(intspec +i, 1); 171 - out_irq->size = intsize; 172 - out_irq->controller = ipar; 173 158 of_node_put(old); 174 159 return 0; 160 + } 161 + 162 + /* 163 + * interrupt-map parsing does not work without a reg 164 + * property when #address-cells != 0 165 + */ 166 + if (addrsize && !addr) { 167 + pr_debug(" -> no reg passed in when needed !\n"); 168 + goto fail; 175 169 } 176 170 177 171 /* Now look for an interrupt-map */ ··· 190 176 191 177 /* Look for a mask */ 192 178 imask = of_get_property(ipar, "interrupt-map-mask", NULL); 193 - 194 - /* If we were passed no "reg" property and we attempt to parse 195 - * an interrupt-map, then #address-cells must be 0. 196 - * Fail if it's not. 197 - */ 198 - if (addr == NULL && addrsize != 0) { 199 - pr_debug(" -> no reg passed in when needed !\n"); 200 - goto fail; 201 - } 179 + if (!imask) 180 + imask = dummy_imask; 202 181 203 182 /* Parse interrupt-map */ 204 183 match = 0; 205 184 while (imaplen > (addrsize + intsize + 1) && !match) { 206 185 /* Compare specifiers */ 207 186 match = 1; 208 - for (i = 0; i < addrsize && match; ++i) { 209 - __be32 mask = imask ? imask[i] 210 - : cpu_to_be32(0xffffffffu); 211 - match = ((addr[i] ^ imap[i]) & mask) == 0; 212 - } 213 - for (; i < (addrsize + intsize) && match; ++i) { 214 - __be32 mask = imask ? imask[i] 215 - : cpu_to_be32(0xffffffffu); 216 - match = 217 - ((intspec[i-addrsize] ^ imap[i]) & mask) == 0; 218 - } 219 - imap += addrsize + intsize; 220 - imaplen -= addrsize + intsize; 187 + for (i = 0; i < (addrsize + intsize); i++, imaplen--) 188 + match &= !((match_array[i] ^ *imap++) & imask[i]); 221 189 222 190 pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen); 223 191 ··· 233 237 newintsize, newaddrsize); 234 238 235 239 /* Check for malformed properties */ 240 + if (WARN_ON(newaddrsize + newintsize > MAX_PHANDLE_ARGS)) 241 + goto fail; 236 242 if (imaplen < (newaddrsize + newintsize)) 237 243 goto fail; 238 244 ··· 246 248 if (!match) 247 249 goto fail; 248 250 249 - of_node_put(old); 250 - old = of_node_get(newpar); 251 + /* 252 + * Successfully parsed an interrrupt-map translation; copy new 253 + * interrupt specifier into the out_irq structure 254 + */ 255 + of_node_put(out_irq->np); 256 + out_irq->np = of_node_get(newpar); 257 + 258 + match_array = imap - newaddrsize - newintsize; 259 + for (i = 0; i < newintsize; i++) 260 + out_irq->args[i] = be32_to_cpup(imap - newintsize + i); 261 + out_irq->args_count = intsize = newintsize; 251 262 addrsize = newaddrsize; 252 - intsize = newintsize; 253 - intspec = imap - intsize; 254 - addr = intspec - addrsize; 255 263 256 264 skiplevel: 257 265 /* Iterate again with new parent */ ··· 268 264 } 269 265 fail: 270 266 of_node_put(ipar); 271 - of_node_put(old); 267 + of_node_put(out_irq->np); 272 268 of_node_put(newpar); 273 269 274 270 return -EINVAL; 275 271 } 276 - EXPORT_SYMBOL_GPL(of_irq_map_raw); 272 + EXPORT_SYMBOL_GPL(of_irq_parse_raw); 277 273 278 274 /** 279 - * of_irq_map_one - Resolve an interrupt for a device 275 + * of_irq_parse_one - Resolve an interrupt for a device 280 276 * @device: the device whose interrupt is to be resolved 281 277 * @index: index of the interrupt to resolve 282 278 * @out_irq: structure of_irq filled by this function 283 279 * 284 - * This function resolves an interrupt, walking the tree, for a given 285 - * device-tree node. It's the high level pendant to of_irq_map_raw(). 280 + * This function resolves an interrupt for a node by walking the interrupt tree, 281 + * finding which interrupt controller node it is attached to, and returning the 282 + * interrupt specifier that can be used to retrieve a Linux IRQ number. 286 283 */ 287 - int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) 284 + int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq) 288 285 { 289 286 struct device_node *p; 290 287 const __be32 *intspec, *tmp, *addr; 291 288 u32 intsize, intlen; 292 - int res = -EINVAL; 289 + int i, res = -EINVAL; 293 290 294 - pr_debug("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); 291 + pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index); 295 292 296 293 /* OldWorld mac stuff is "special", handle out of line */ 297 294 if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC) 298 - return of_irq_map_oldworld(device, index, out_irq); 299 - 300 - /* Get the interrupts property */ 301 - intspec = of_get_property(device, "interrupts", &intlen); 302 - if (intspec == NULL) 303 - return -EINVAL; 304 - intlen /= sizeof(*intspec); 305 - 306 - pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); 295 + return of_irq_parse_oldworld(device, index, out_irq); 307 296 308 297 /* Get the reg property (if any) */ 309 298 addr = of_get_property(device, "reg", NULL); 299 + 300 + /* Get the interrupts property */ 301 + intspec = of_get_property(device, "interrupts", &intlen); 302 + if (intspec == NULL) { 303 + /* Try the new-style interrupts-extended */ 304 + res = of_parse_phandle_with_args(device, "interrupts-extended", 305 + "#interrupt-cells", index, out_irq); 306 + if (res) 307 + return -EINVAL; 308 + return of_irq_parse_raw(addr, out_irq); 309 + } 310 + intlen /= sizeof(*intspec); 311 + 312 + pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); 310 313 311 314 /* Look for the interrupt parent. */ 312 315 p = of_irq_find_parent(device); ··· 332 321 if ((index + 1) * intsize > intlen) 333 322 goto out; 334 323 335 - /* Get new specifier and map it */ 336 - res = of_irq_map_raw(p, intspec + index * intsize, intsize, 337 - addr, out_irq); 324 + /* Copy intspec into irq structure */ 325 + intspec += index * intsize; 326 + out_irq->np = p; 327 + out_irq->args_count = intsize; 328 + for (i = 0; i < intsize; i++) 329 + out_irq->args[i] = be32_to_cpup(intspec++); 330 + 331 + /* Check if there are any interrupt-map translations to process */ 332 + res = of_irq_parse_raw(addr, out_irq); 338 333 out: 339 334 of_node_put(p); 340 335 return res; 341 336 } 342 - EXPORT_SYMBOL_GPL(of_irq_map_one); 337 + EXPORT_SYMBOL_GPL(of_irq_parse_one); 343 338 344 339 /** 345 340 * of_irq_to_resource - Decode a node's IRQ and return it as a resource ··· 371 354 &name); 372 355 373 356 r->start = r->end = irq; 374 - r->flags = IORESOURCE_IRQ; 375 - r->name = name ? name : dev->full_name; 357 + r->flags = IORESOURCE_IRQ | irqd_get_trigger_type(irq_get_irq_data(irq)); 358 + r->name = name ? name : of_node_full_name(dev); 376 359 } 377 360 378 361 return irq; ··· 385 368 */ 386 369 int of_irq_count(struct device_node *dev) 387 370 { 371 + struct of_phandle_args irq; 388 372 int nr = 0; 389 373 390 - while (of_irq_to_resource(dev, nr, NULL)) 374 + while (of_irq_parse_one(dev, nr, &irq) == 0) 391 375 nr++; 392 376 393 377 return nr;
-1
drivers/of/of_pci.c
··· 2 2 #include <linux/export.h> 3 3 #include <linux/of.h> 4 4 #include <linux/of_pci.h> 5 - #include <asm/prom.h> 6 5 7 6 static inline int __of_pci_pci_compare(struct device_node *node, 8 7 unsigned int data)
+34 -7
drivers/of/of_pci_irq.c
··· 2 2 #include <linux/of_pci.h> 3 3 #include <linux/of_irq.h> 4 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 8 * @pdev: the device whose interrupt is to be resolved 10 9 * @out_irq: structure of_irq filled by this function 11 10 * ··· 14 15 * PCI tree until an device-node is found, at which point it will finish 15 16 * resolving using the OF tree walking. 16 17 */ 17 - int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq) 18 + int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) 18 19 { 19 20 struct device_node *dn, *ppnode; 20 21 struct pci_dev *ppdev; ··· 29 30 */ 30 31 dn = pci_device_to_OF_node(pdev); 31 32 if (dn) { 32 - rc = of_irq_map_one(dn, 0, out_irq); 33 + rc = of_irq_parse_one(dn, 0, out_irq); 33 34 if (!rc) 34 35 return rc; 35 36 } ··· 84 85 pdev = ppdev; 85 86 } 86 87 88 + out_irq->np = ppnode; 89 + out_irq->args_count = 1; 90 + out_irq->args[0] = lspec; 87 91 lspec_be = cpu_to_be32(lspec); 88 92 laddr[0] = cpu_to_be32((pdev->bus->number << 16) | (pdev->devfn << 8)); 89 - laddr[1] = laddr[2] = cpu_to_be32(0); 90 - return of_irq_map_raw(ppnode, &lspec_be, 1, laddr, out_irq); 93 + laddr[1] = laddr[2] = cpu_to_be32(0); 94 + return of_irq_parse_raw(laddr, out_irq); 91 95 } 92 - EXPORT_SYMBOL_GPL(of_irq_map_pci); 96 + EXPORT_SYMBOL_GPL(of_irq_parse_pci); 97 + 98 + /** 99 + * of_irq_parse_and_map_pci() - Decode a PCI irq from the device tree and map to a virq 100 + * @dev: The pci device needing an irq 101 + * @slot: PCI slot number; passed when used as map_irq callback. Unused 102 + * @pin: PCI irq pin number; passed when used as map_irq callback. Unused 103 + * 104 + * @slot and @pin are unused, but included in the function so that this 105 + * function can be used directly as the map_irq callback to pci_fixup_irqs(). 106 + */ 107 + int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin) 108 + { 109 + struct of_phandle_args oirq; 110 + int ret; 111 + 112 + ret = of_irq_parse_pci(dev, &oirq); 113 + if (ret) { 114 + dev_err(&dev->dev, "of_irq_parse_pci() failed with rc=%d\n", ret); 115 + return 0; /* Proper return code 0 == NO_IRQ */ 116 + } 117 + 118 + return irq_create_of_mapping(&oirq); 119 + } 120 + EXPORT_SYMBOL_GPL(of_irq_parse_and_map_pci); 121 +
-1
drivers/of/pdt.c
··· 22 22 #include <linux/slab.h> 23 23 #include <linux/of.h> 24 24 #include <linux/of_pdt.h> 25 - #include <asm/prom.h> 26 25 27 26 static struct of_pdt_ops *of_pdt_prom_ops __initdata; 28 27
+2
drivers/of/platform.c
··· 215 215 dev->archdata.dma_mask = 0xffffffffUL; 216 216 #endif 217 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 220 dev->dev.bus = &platform_bus_type; 219 221 dev->dev.platform_data = platform_data; 220 222
+155 -6
drivers/of/selftest.c
··· 9 9 #include <linux/errno.h> 10 10 #include <linux/module.h> 11 11 #include <linux/of.h> 12 + #include <linux/of_irq.h> 12 13 #include <linux/list.h> 13 14 #include <linux/mutex.h> 14 15 #include <linux/slab.h> 15 16 #include <linux/device.h> 16 17 17 - static bool selftest_passed = true; 18 + static struct selftest_results { 19 + int passed; 20 + int failed; 21 + } selftest_results; 22 + 18 23 #define selftest(result, fmt, ...) { \ 19 24 if (!(result)) { \ 20 - pr_err("FAIL %s:%i " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \ 21 - selftest_passed = false; \ 25 + selftest_results.failed++; \ 26 + pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \ 22 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 ··· 137 131 struct device_node *np; 138 132 int rc; 139 133 140 - pr_info("start\n"); 141 134 np = of_find_node_by_path("/testcase-data/phandle-tests/consumer-a"); 142 135 if (!np) { 143 136 pr_err("No testcase data in device tree\n"); ··· 159 154 selftest(rc == -EILSEQ, "unterminated string; rc=%i", rc); 160 155 } 161 156 157 + static void __init of_selftest_parse_interrupts(void) 158 + { 159 + struct device_node *np; 160 + struct of_phandle_args args; 161 + int i, rc; 162 + 163 + np = of_find_node_by_path("/testcase-data/interrupts/interrupts0"); 164 + if (!np) { 165 + pr_err("missing testcase data\n"); 166 + return; 167 + } 168 + 169 + for (i = 0; i < 4; i++) { 170 + bool passed = true; 171 + args.args_count = 0; 172 + rc = of_irq_parse_one(np, i, &args); 173 + 174 + passed &= !rc; 175 + passed &= (args.args_count == 1); 176 + passed &= (args.args[0] == (i + 1)); 177 + 178 + selftest(passed, "index %i - data error on node %s rc=%i\n", 179 + i, args.np->full_name, rc); 180 + } 181 + of_node_put(np); 182 + 183 + np = of_find_node_by_path("/testcase-data/interrupts/interrupts1"); 184 + if (!np) { 185 + pr_err("missing testcase data\n"); 186 + return; 187 + } 188 + 189 + for (i = 0; i < 4; i++) { 190 + bool passed = true; 191 + args.args_count = 0; 192 + rc = of_irq_parse_one(np, i, &args); 193 + 194 + /* Test the values from tests-phandle.dtsi */ 195 + switch (i) { 196 + case 0: 197 + passed &= !rc; 198 + passed &= (args.args_count == 1); 199 + passed &= (args.args[0] == 9); 200 + break; 201 + case 1: 202 + passed &= !rc; 203 + passed &= (args.args_count == 3); 204 + passed &= (args.args[0] == 10); 205 + passed &= (args.args[1] == 11); 206 + passed &= (args.args[2] == 12); 207 + break; 208 + case 2: 209 + passed &= !rc; 210 + passed &= (args.args_count == 2); 211 + passed &= (args.args[0] == 13); 212 + passed &= (args.args[1] == 14); 213 + break; 214 + case 3: 215 + passed &= !rc; 216 + passed &= (args.args_count == 2); 217 + passed &= (args.args[0] == 15); 218 + passed &= (args.args[1] == 16); 219 + break; 220 + default: 221 + passed = false; 222 + } 223 + selftest(passed, "index %i - data error on node %s rc=%i\n", 224 + i, args.np->full_name, rc); 225 + } 226 + of_node_put(np); 227 + } 228 + 229 + static void __init of_selftest_parse_interrupts_extended(void) 230 + { 231 + struct device_node *np; 232 + struct of_phandle_args args; 233 + int i, rc; 234 + 235 + np = of_find_node_by_path("/testcase-data/interrupts/interrupts-extended0"); 236 + if (!np) { 237 + pr_err("missing testcase data\n"); 238 + return; 239 + } 240 + 241 + for (i = 0; i < 7; i++) { 242 + bool passed = true; 243 + rc = of_irq_parse_one(np, i, &args); 244 + 245 + /* Test the values from tests-phandle.dtsi */ 246 + switch (i) { 247 + case 0: 248 + passed &= !rc; 249 + passed &= (args.args_count == 1); 250 + passed &= (args.args[0] == 1); 251 + break; 252 + case 1: 253 + passed &= !rc; 254 + passed &= (args.args_count == 3); 255 + passed &= (args.args[0] == 2); 256 + passed &= (args.args[1] == 3); 257 + passed &= (args.args[2] == 4); 258 + break; 259 + case 2: 260 + passed &= !rc; 261 + passed &= (args.args_count == 2); 262 + passed &= (args.args[0] == 5); 263 + passed &= (args.args[1] == 6); 264 + break; 265 + case 3: 266 + passed &= !rc; 267 + passed &= (args.args_count == 1); 268 + passed &= (args.args[0] == 9); 269 + break; 270 + case 4: 271 + passed &= !rc; 272 + passed &= (args.args_count == 3); 273 + passed &= (args.args[0] == 10); 274 + passed &= (args.args[1] == 11); 275 + passed &= (args.args[2] == 12); 276 + break; 277 + case 5: 278 + passed &= !rc; 279 + passed &= (args.args_count == 2); 280 + passed &= (args.args[0] == 13); 281 + passed &= (args.args[1] == 14); 282 + break; 283 + case 6: 284 + passed &= !rc; 285 + passed &= (args.args_count == 1); 286 + passed &= (args.args[0] == 15); 287 + break; 288 + default: 289 + passed = false; 290 + } 291 + 292 + selftest(passed, "index %i - data error on node %s rc=%i\n", 293 + i, args.np->full_name, rc); 294 + } 295 + of_node_put(np); 296 + } 297 + 162 298 static int __init of_selftest(void) 163 299 { 164 300 struct device_node *np; ··· 314 168 pr_info("start of selftest - you will see error messages\n"); 315 169 of_selftest_parse_phandle_with_args(); 316 170 of_selftest_property_match_string(); 317 - pr_info("end of selftest - %s\n", selftest_passed ? "PASS" : "FAIL"); 171 + of_selftest_parse_interrupts(); 172 + of_selftest_parse_interrupts_extended(); 173 + pr_info("end of selftest - %i passed, %i failed\n", 174 + selftest_results.passed, selftest_results.failed); 318 175 return 0; 319 176 } 320 177 late_initcall(of_selftest);
+1 -14
drivers/pci/host/pci-mvebu.c
··· 665 665 return 1; 666 666 } 667 667 668 - static 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 - 681 668 static struct pci_bus *mvebu_pcie_scan_bus(int nr, struct pci_sys_data *sys) 682 669 { 683 670 struct mvebu_pcie *pcie = sys_to_pcie(sys); ··· 719 732 hw.private_data = (void **)&pcie; 720 733 hw.setup = mvebu_pcie_setup; 721 734 hw.scan = mvebu_pcie_scan_bus; 722 - hw.map_irq = mvebu_pcie_map_irq; 735 + hw.map_irq = of_irq_parse_and_map_pci; 723 736 hw.ops = &mvebu_pcie_ops; 724 737 hw.align_resource = mvebu_pcie_align_resource; 725 738 hw.add_bus = mvebu_pcie_add_bus;
+2
drivers/pcmcia/electra_cf.c
··· 30 30 #include <linux/interrupt.h> 31 31 #include <linux/mm.h> 32 32 #include <linux/vmalloc.h> 33 + #include <linux/of_address.h> 34 + #include <linux/of_irq.h> 33 35 #include <linux/of_platform.h> 34 36 #include <linux/slab.h> 35 37
+2
drivers/pcmcia/m8xx_pcmcia.c
··· 48 48 #include <linux/interrupt.h> 49 49 #include <linux/fsl_devices.h> 50 50 #include <linux/bitops.h> 51 + #include <linux/of_address.h> 51 52 #include <linux/of_device.h> 53 + #include <linux/of_irq.h> 52 54 #include <linux/of_platform.h> 53 55 54 56 #include <asm/io.h>
+2
drivers/rtc/rtc-mpc5121.c
··· 14 14 #include <linux/module.h> 15 15 #include <linux/rtc.h> 16 16 #include <linux/of.h> 17 + #include <linux/of_address.h> 17 18 #include <linux/of_device.h> 19 + #include <linux/of_irq.h> 18 20 #include <linux/of_platform.h> 19 21 #include <linux/io.h> 20 22 #include <linux/slab.h>
+1
drivers/spi/spi-fsl-cpm.c
··· 20 20 #include <linux/spi/spi.h> 21 21 #include <linux/fsl_devices.h> 22 22 #include <linux/dma-mapping.h> 23 + #include <linux/of_address.h> 23 24 #include <asm/cpm.h> 24 25 #include <asm/qe.h> 25 26
+5 -3
drivers/spi/spi-fsl-espi.c
··· 16 16 #include <linux/fsl_devices.h> 17 17 #include <linux/mm.h> 18 18 #include <linux/of.h> 19 + #include <linux/of_address.h> 20 + #include <linux/of_irq.h> 19 21 #include <linux/of_platform.h> 20 22 #include <linux/interrupt.h> 21 23 #include <linux/err.h> ··· 689 687 struct device_node *np = ofdev->dev.of_node; 690 688 struct spi_master *master; 691 689 struct resource mem; 692 - struct resource irq; 690 + unsigned int irq; 693 691 int ret = -ENOMEM; 694 692 695 693 ret = of_mpc8xxx_spi_probe(ofdev); ··· 704 702 if (ret) 705 703 goto err; 706 704 707 - ret = of_irq_to_resource(np, 0, &irq); 705 + irq = irq_of_parse_and_map(np, 0); 708 706 if (!ret) { 709 707 ret = -EINVAL; 710 708 goto err; 711 709 } 712 710 713 - master = fsl_espi_probe(dev, &mem, irq.start); 711 + master = fsl_espi_probe(dev, &mem, irq); 714 712 if (IS_ERR(master)) { 715 713 ret = PTR_ERR(master); 716 714 goto err;
+1
drivers/spi/spi-mpc512x-psc.c
··· 20 20 #include <linux/errno.h> 21 21 #include <linux/interrupt.h> 22 22 #include <linux/of_address.h> 23 + #include <linux/of_irq.h> 23 24 #include <linux/of_platform.h> 24 25 #include <linux/completion.h> 25 26 #include <linux/io.h>
+2
drivers/spi/spi-ppc4xx.c
··· 29 29 #include <linux/slab.h> 30 30 #include <linux/errno.h> 31 31 #include <linux/wait.h> 32 + #include <linux/of_address.h> 33 + #include <linux/of_irq.h> 32 34 #include <linux/of_platform.h> 33 35 #include <linux/of_gpio.h> 34 36 #include <linux/interrupt.h>
+1
drivers/tty/ehv_bytechan.c
··· 32 32 #include <linux/poll.h> 33 33 #include <asm/epapr_hcalls.h> 34 34 #include <linux/of.h> 35 + #include <linux/of_irq.h> 35 36 #include <linux/platform_device.h> 36 37 #include <linux/cdev.h> 37 38 #include <linux/console.h>
+3 -1
drivers/tty/serial/cpm_uart/cpm_uart_core.c
··· 41 41 #include <linux/bootmem.h> 42 42 #include <linux/dma-mapping.h> 43 43 #include <linux/fs_uart_pd.h> 44 + #include <linux/of_address.h> 45 + #include <linux/of_irq.h> 44 46 #include <linux/of_platform.h> 45 47 #include <linux/gpio.h> 46 48 #include <linux/of_gpio.h> ··· 1209 1207 pinfo->port.fifosize = pinfo->tx_nrfifos * pinfo->tx_fifosize; 1210 1208 spin_lock_init(&pinfo->port.lock); 1211 1209 1212 - pinfo->port.irq = of_irq_to_resource(np, 0, NULL); 1210 + pinfo->port.irq = irq_of_parse_and_map(np, 0); 1213 1211 if (pinfo->port.irq == NO_IRQ) { 1214 1212 ret = -EINVAL; 1215 1213 goto out_pram;
+1
drivers/tty/serial/cpm_uart/cpm_uart_cpm1.c
··· 45 45 #include <linux/kernel.h> 46 46 47 47 #include <linux/of.h> 48 + #include <linux/of_address.h> 48 49 49 50 #include "cpm_uart.h" 50 51
+2
drivers/tty/serial/pmac_zilog.c
··· 57 57 #include <linux/bitops.h> 58 58 #include <linux/sysrq.h> 59 59 #include <linux/mutex.h> 60 + #include <linux/of_address.h> 61 + #include <linux/of_irq.h> 60 62 #include <asm/sections.h> 61 63 #include <asm/io.h> 62 64 #include <asm/irq.h>
+2
drivers/tty/serial/ucc_uart.c
··· 25 25 #include <linux/tty.h> 26 26 #include <linux/tty_flip.h> 27 27 #include <linux/io.h> 28 + #include <linux/of_address.h> 29 + #include <linux/of_irq.h> 28 30 #include <linux/of_platform.h> 29 31 #include <linux/dma-mapping.h> 30 32
+1
drivers/usb/gadget/fsl_qe_udc.c
··· 33 33 #include <linux/io.h> 34 34 #include <linux/moduleparam.h> 35 35 #include <linux/of_address.h> 36 + #include <linux/of_irq.h> 36 37 #include <linux/of_platform.h> 37 38 #include <linux/dma-mapping.h> 38 39 #include <linux/usb/ch9.h>
+2
drivers/usb/host/ehci-ppc-of.c
··· 16 16 #include <linux/signal.h> 17 17 18 18 #include <linux/of.h> 19 + #include <linux/of_address.h> 20 + #include <linux/of_irq.h> 19 21 #include <linux/of_platform.h> 20 22 21 23
+2
drivers/usb/host/fhci-hcd.c
··· 26 26 #include <linux/io.h> 27 27 #include <linux/usb.h> 28 28 #include <linux/usb/hcd.h> 29 + #include <linux/of_address.h> 30 + #include <linux/of_irq.h> 29 31 #include <linux/of_platform.h> 30 32 #include <linux/of_gpio.h> 31 33 #include <linux/slab.h>
+2
drivers/usb/host/ohci-ppc-of.c
··· 14 14 */ 15 15 16 16 #include <linux/signal.h> 17 + #include <linux/of_address.h> 18 + #include <linux/of_irq.h> 17 19 #include <linux/of_platform.h> 18 20 19 21 #include <asm/prom.h>
+2
drivers/video/fsl-diu-fb.c
··· 31 31 #include <linux/uaccess.h> 32 32 #include <linux/vmalloc.h> 33 33 #include <linux/spinlock.h> 34 + #include <linux/of_address.h> 35 + #include <linux/of_irq.h> 34 36 35 37 #include <sysdev/fsl_soc.h> 36 38 #include <linux/fsl-diu-fb.h>
+1
drivers/virt/fsl_hypervisor.c
··· 34 34 #include <linux/slab.h> 35 35 #include <linux/poll.h> 36 36 #include <linux/of.h> 37 + #include <linux/of_irq.h> 37 38 #include <linux/reboot.h> 38 39 #include <linux/uaccess.h> 39 40 #include <linux/notifier.h>
+1
drivers/watchdog/gef_wdt.c
··· 34 34 #include <linux/watchdog.h> 35 35 #include <linux/fs.h> 36 36 #include <linux/of.h> 37 + #include <linux/of_address.h> 37 38 #include <linux/of_platform.h> 38 39 #include <linux/io.h> 39 40 #include <linux/uaccess.h>
+1
drivers/watchdog/mpc8xxx_wdt.c
··· 24 24 #include <linux/kernel.h> 25 25 #include <linux/timer.h> 26 26 #include <linux/miscdevice.h> 27 + #include <linux/of_address.h> 27 28 #include <linux/of_platform.h> 28 29 #include <linux/module.h> 29 30 #include <linux/watchdog.h>
+1
drivers/watchdog/pika_wdt.c
··· 22 22 #include <linux/bitops.h> 23 23 #include <linux/uaccess.h> 24 24 #include <linux/io.h> 25 + #include <linux/of_address.h> 25 26 #include <linux/of_platform.h> 26 27 27 28 #define DRV_NAME "PIKA-WDT"
-3
fs/proc/proc_devtree.c
··· 14 14 #include <linux/of.h> 15 15 #include <linux/export.h> 16 16 #include <linux/slab.h> 17 - #include <asm/prom.h> 18 17 #include <asm/uaccess.h> 19 18 #include "internal.h" 20 19 21 20 static inline void set_node_proc_entry(struct device_node *np, 22 21 struct proc_dir_entry *de) 23 22 { 24 - #ifdef HAVE_ARCH_DEVTREE_FIXUPS 25 23 np->pde = de; 26 - #endif 27 24 } 28 25 29 26 static struct proc_dir_entry *proc_device_tree;
+3
include/linux/cpu.h
··· 18 18 #include <linux/cpumask.h> 19 19 20 20 struct device; 21 + struct device_node; 21 22 22 23 struct cpu { 23 24 int node_id; /* The node which contains the CPU */ ··· 30 29 extern struct device *get_cpu_device(unsigned cpu); 31 30 extern bool cpu_is_hotpluggable(unsigned cpu); 32 31 extern bool arch_match_cpu_phys_id(int cpu, u64 phys_id); 32 + extern bool arch_find_n_match_cpu_physical_id(struct device_node *cpun, 33 + int cpu, unsigned int *thread); 33 34 34 35 extern int cpu_add_dev_attr(struct device_attribute *attr); 35 36 extern void cpu_remove_dev_attr(struct device_attribute *attr);
+10 -7
include/linux/of.h
··· 136 136 return of_read_number(cell, size); 137 137 } 138 138 139 + #if defined(CONFIG_SPARC) 139 140 #include <asm/prom.h> 141 + #endif 140 142 141 143 /* Default #address and #size cells. Allow arch asm/prom.h to override */ 142 144 #if !defined(OF_ROOT_NODE_ADDR_CELLS_DEFAULT) ··· 290 288 extern const struct of_device_id *of_match_node( 291 289 const struct of_device_id *matches, const struct device_node *node); 292 290 extern int of_modalias_node(struct device_node *node, char *modalias, int len); 291 + extern void of_print_phandle_args(const char *msg, const struct of_phandle_args *args); 293 292 extern struct device_node *of_parse_phandle(const struct device_node *np, 294 293 const char *phandle_name, 295 294 int index); ··· 378 375 } 379 376 380 377 #define for_each_child_of_node(parent, child) \ 378 + while (0) 379 + 380 + #define for_each_available_child_of_node(parent, child) \ 381 381 while (0) 382 382 383 383 static inline struct device_node *of_get_child_by_name( ··· 558 552 #define of_match_node(_matches, _node) NULL 559 553 #endif /* CONFIG_OF */ 560 554 561 - #ifndef of_node_to_nid 562 - static inline int of_node_to_nid(struct device_node *np) 563 - { 564 - return numa_node_id(); 565 - } 566 - 567 - #define of_node_to_nid of_node_to_nid 555 + #if defined(CONFIG_OF) && defined(CONFIG_NUMA) 556 + extern int of_node_to_nid(struct device_node *np); 557 + #else 558 + static inline int of_node_to_nid(struct device_node *device) { return 0; } 568 559 #endif 569 560 570 561 /**
+22 -17
include/linux/of_address.h
··· 34 34 res->name = np->full_name; 35 35 } 36 36 37 + /* Translate a DMA address from device space to CPU space */ 38 + extern u64 of_translate_dma_address(struct device_node *dev, 39 + const __be32 *in_addr); 40 + 37 41 #ifdef CONFIG_OF_ADDRESS 38 42 extern u64 of_translate_address(struct device_node *np, const __be32 *addr); 39 43 extern bool of_can_translate_address(struct device_node *dev); ··· 56 52 extern const __be32 *of_get_address(struct device_node *dev, int index, 57 53 u64 *size, unsigned int *flags); 58 54 59 - #ifndef pci_address_to_pio 60 - static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } 61 - #define pci_address_to_pio pci_address_to_pio 62 - #endif 55 + extern unsigned long pci_address_to_pio(phys_addr_t addr); 63 56 64 57 extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, 65 58 struct device_node *node); ··· 64 63 struct of_pci_range_parser *parser, 65 64 struct of_pci_range *range); 66 65 #else /* CONFIG_OF_ADDRESS */ 67 - #ifndef of_address_to_resource 68 - static inline int of_address_to_resource(struct device_node *dev, int index, 69 - struct resource *r) 70 - { 71 - return -EINVAL; 72 - } 73 - #endif 74 66 static inline struct device_node *of_find_matching_node_by_address( 75 67 struct device_node *from, 76 68 const struct of_device_id *matches, ··· 71 77 { 72 78 return NULL; 73 79 } 74 - #ifndef of_iomap 75 - static inline void __iomem *of_iomap(struct device_node *device, int index) 76 - { 77 - return NULL; 78 - } 79 - #endif 80 + 80 81 static inline const __be32 *of_get_address(struct device_node *dev, int index, 81 82 u64 *size, unsigned int *flags) 82 83 { ··· 92 103 } 93 104 #endif /* CONFIG_OF_ADDRESS */ 94 105 106 + #ifdef CONFIG_OF 107 + extern int of_address_to_resource(struct device_node *dev, int index, 108 + struct resource *r); 109 + void __iomem *of_iomap(struct device_node *node, int index); 110 + #else 111 + static inline int of_address_to_resource(struct device_node *dev, int index, 112 + struct resource *r) 113 + { 114 + return -EINVAL; 115 + } 116 + 117 + static inline void __iomem *of_iomap(struct device_node *device, int index) 118 + { 119 + return NULL; 120 + } 121 + #endif 95 122 96 123 #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_PCI) 97 124 extern const __be32 *of_get_pci_address(struct device_node *dev, int bar_no,
+9 -10
include/linux/of_fdt.h
··· 96 96 97 97 extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, 98 98 int depth, void *data); 99 - extern void early_init_dt_check_for_initrd(unsigned long node); 100 99 extern int early_init_dt_scan_memory(unsigned long node, const char *uname, 101 100 int depth, void *data); 102 101 extern void early_init_dt_add_memory_arch(u64 base, u64 size); 103 102 extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align); 104 103 extern 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 112 - extern void early_init_dt_setup_initrd_arch(u64 start, u64 end); 113 - #endif 114 - 115 105 /* Early flat tree scan hooks */ 116 106 extern int early_init_dt_scan_root(unsigned long node, const char *uname, 117 107 int depth, void *data); 118 108 109 + extern bool early_init_dt_scan(void *params); 110 + 111 + extern const char *of_flat_dt_get_machine_name(void); 112 + extern const void *of_flat_dt_match_machine(const void *default_match, 113 + const void * (*get_next_compat)(const char * const**)); 114 + 119 115 /* Other Prototypes */ 120 116 extern void unflatten_device_tree(void); 117 + extern void unflatten_and_copy_device_tree(void); 121 118 extern void early_init_devtree(void *); 122 119 #else /* CONFIG_OF_FLATTREE */ 120 + static inline const char *of_flat_dt_get_machine_name(void) { return NULL; } 123 121 static inline void unflatten_device_tree(void) {} 122 + static inline void unflatten_and_copy_device_tree(void) {} 124 123 #endif /* CONFIG_OF_FLATTREE */ 125 124 126 125 #endif /* __ASSEMBLY__ */
+17 -30
include/linux/of_irq.h
··· 8 8 #include <linux/ioport.h> 9 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 */ 21 - struct 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 - 27 11 typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *); 28 12 29 13 /* ··· 19 35 #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC) 20 36 extern unsigned int of_irq_workarounds; 21 37 extern struct device_node *of_irq_dflt_pic; 22 - extern int of_irq_map_oldworld(struct device_node *device, int index, 23 - struct of_irq *out_irq); 38 + extern int of_irq_parse_oldworld(struct device_node *device, int index, 39 + struct of_phandle_args *out_irq); 24 40 #else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 25 41 #define of_irq_workarounds (0) 26 42 #define of_irq_dflt_pic (NULL) 27 - static inline int of_irq_map_oldworld(struct device_node *device, int index, 28 - struct of_irq *out_irq) 43 + static inline int of_irq_parse_oldworld(struct device_node *device, int index, 44 + struct of_phandle_args *out_irq) 29 45 { 30 46 return -EINVAL; 31 47 } 32 48 #endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */ 33 49 34 - 35 - extern int of_irq_map_raw(struct device_node *parent, const __be32 *intspec, 36 - u32 ointsize, const __be32 *addr, 37 - struct of_irq *out_irq); 38 - extern int of_irq_map_one(struct device_node *device, int index, 39 - struct of_irq *out_irq); 40 - extern unsigned int irq_create_of_mapping(struct device_node *controller, 41 - const u32 *intspec, 42 - unsigned int intsize); 50 + extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq); 51 + extern int of_irq_parse_one(struct device_node *device, int index, 52 + struct of_phandle_args *out_irq); 53 + extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data); 43 54 extern int of_irq_to_resource(struct device_node *dev, int index, 44 55 struct resource *r); 45 - extern int of_irq_count(struct device_node *dev); 46 56 extern int of_irq_to_resource_table(struct device_node *dev, 47 57 struct resource *res, int nr_irqs); 48 58 49 59 extern void of_irq_init(const struct of_device_id *matches); 60 + 61 + #ifdef CONFIG_OF_IRQ 62 + extern int of_irq_count(struct device_node *dev); 63 + #else 64 + static inline int of_irq_count(struct device_node *dev) 65 + { 66 + return 0; 67 + } 68 + #endif 50 69 51 70 #if defined(CONFIG_OF) 52 71 /*
+3 -2
include/linux/of_pci.h
··· 5 5 #include <linux/msi.h> 6 6 7 7 struct pci_dev; 8 - struct of_irq; 9 - int of_irq_map_pci(const struct pci_dev *pdev, struct of_irq *out_irq); 8 + struct of_phandle_args; 9 + int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq); 10 + int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); 10 11 11 12 struct device_node; 12 13 struct device_node *of_pci_find_child_device(struct device_node *parent,
+6 -7
kernel/irq/irqdomain.c
··· 465 465 } 466 466 EXPORT_SYMBOL_GPL(irq_create_strict_mappings); 467 467 468 - unsigned int irq_create_of_mapping(struct device_node *controller, 469 - const u32 *intspec, unsigned int intsize) 468 + unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data) 470 469 { 471 470 struct irq_domain *domain; 472 471 irq_hw_number_t hwirq; 473 472 unsigned int type = IRQ_TYPE_NONE; 474 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 476 if (!domain) { 478 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 479 return 0; 481 480 } 482 481 483 482 /* If domain has no translation, then we assume interrupt line */ 484 483 if (domain->ops->xlate == NULL) 485 - hwirq = intspec[0]; 484 + hwirq = irq_data->args[0]; 486 485 else { 487 - if (domain->ops->xlate(domain, controller, intspec, intsize, 488 - &hwirq, &type)) 486 + if (domain->ops->xlate(domain, irq_data->np, irq_data->args, 487 + irq_data->args_count, &hwirq, &type)) 489 488 return 0; 490 489 } 491 490
+2 -1
sound/aoa/core/gpio-feature.c
··· 10 10 * registers. 11 11 */ 12 12 13 - #include <asm/pmac_feature.h> 13 + #include <linux/of_irq.h> 14 14 #include <linux/interrupt.h> 15 + #include <asm/pmac_feature.h> 15 16 #include "../aoa.h" 16 17 17 18 /* TODO: these are lots of global variables
+2
sound/aoa/soundbus/i2sbus/core.c
··· 11 11 #include <linux/pci.h> 12 12 #include <linux/interrupt.h> 13 13 #include <linux/dma-mapping.h> 14 + #include <linux/of_address.h> 15 + #include <linux/of_irq.h> 14 16 15 17 #include <sound/core.h> 16 18
+2
sound/ppc/pmac.c
··· 28 28 #include <linux/interrupt.h> 29 29 #include <linux/pci.h> 30 30 #include <linux/dma-mapping.h> 31 + #include <linux/of_address.h> 32 + #include <linux/of_irq.h> 31 33 #include <sound/core.h> 32 34 #include "pmac.h" 33 35 #include <sound/pcm_params.h>
+1
sound/ppc/tumbler.c
··· 31 31 #include <linux/slab.h> 32 32 #include <linux/interrupt.h> 33 33 #include <linux/string.h> 34 + #include <linux/of_irq.h> 34 35 #include <sound/core.h> 35 36 #include <asm/io.h> 36 37 #include <asm/irq.h>
+2
sound/soc/fsl/fsl_dma.c
··· 21 21 #include <linux/interrupt.h> 22 22 #include <linux/delay.h> 23 23 #include <linux/gfp.h> 24 + #include <linux/of_address.h> 25 + #include <linux/of_irq.h> 24 26 #include <linux/of_platform.h> 25 27 #include <linux/list.h> 26 28 #include <linux/slab.h>
+2
sound/soc/fsl/mpc5200_dma.c
··· 10 10 #include <linux/of_device.h> 11 11 #include <linux/dma-mapping.h> 12 12 #include <linux/slab.h> 13 + #include <linux/of_address.h> 14 + #include <linux/of_irq.h> 13 15 #include <linux/of_platform.h> 14 16 15 17 #include <sound/soc.h>
+1 -1
sound/soc/fsl/mpc5200_psc_ac97.c
··· 291 291 292 292 rc = snd_soc_set_ac97_ops(&psc_ac97_ops); 293 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 295 return rc; 296 296 } 297 297
+1
sound/soc/fsl/mpc8610_hpcd.c
··· 12 12 13 13 #include <linux/module.h> 14 14 #include <linux/interrupt.h> 15 + #include <linux/of_address.h> 15 16 #include <linux/of_device.h> 16 17 #include <linux/slab.h> 17 18 #include <sound/soc.h>
+1
sound/soc/fsl/p1022_ds.c
··· 12 12 13 13 #include <linux/module.h> 14 14 #include <linux/interrupt.h> 15 + #include <linux/of_address.h> 15 16 #include <linux/of_device.h> 16 17 #include <linux/slab.h> 17 18 #include <sound/soc.h>
+1
sound/soc/fsl/p1022_rdk.c
··· 19 19 20 20 #include <linux/module.h> 21 21 #include <linux/interrupt.h> 22 + #include <linux/of_address.h> 22 23 #include <linux/of_device.h> 23 24 #include <linux/slab.h> 24 25 #include <sound/soc.h>