diff options
| -rw-r--r-- | Documentation/devicetree/bindings/net/socfpga-dwmac.txt | 2 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/net/stmmac.txt | 2 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt | 4 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | 2 | ||||
| -rw-r--r-- | arch/arm/boot/dts/am33xx.dtsi | 4 | ||||
| -rw-r--r-- | arch/arm/boot/dts/am4372.dtsi | 4 | ||||
| -rw-r--r-- | arch/arm/boot/dts/stih415-pinctrl.dtsi | 10 | ||||
| -rw-r--r-- | arch/arm/boot/dts/stih416-pinctrl.dtsi | 10 | ||||
| -rw-r--r-- | drivers/base/platform.c | 7 | ||||
| -rw-r--r-- | drivers/of/irq.c | 28 | ||||
| -rw-r--r-- | drivers/of/platform.c | 4 | ||||
| -rw-r--r-- | drivers/of/selftest.c | 32 | ||||
| -rw-r--r-- | drivers/of/testcase-data/tests-interrupts.dtsi | 13 | ||||
| -rw-r--r-- | include/linux/of_irq.h | 5 |
14 files changed, 105 insertions, 22 deletions
diff --git a/Documentation/devicetree/bindings/net/socfpga-dwmac.txt b/Documentation/devicetree/bindings/net/socfpga-dwmac.txt index 636f0ac4e223..2a60cd3e8d5d 100644 --- a/Documentation/devicetree/bindings/net/socfpga-dwmac.txt +++ b/Documentation/devicetree/bindings/net/socfpga-dwmac.txt | |||
| @@ -23,5 +23,5 @@ gmac0: ethernet@ff700000 { | |||
| 23 | interrupt-names = "macirq"; | 23 | interrupt-names = "macirq"; |
| 24 | mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */ | 24 | mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */ |
| 25 | clocks = <&emac_0_clk>; | 25 | clocks = <&emac_0_clk>; |
| 26 | clocks-names = "stmmaceth"; | 26 | clock-names = "stmmaceth"; |
| 27 | }; | 27 | }; |
diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt index 80c1fb8bfbb8..a2acd2b26baf 100644 --- a/Documentation/devicetree/bindings/net/stmmac.txt +++ b/Documentation/devicetree/bindings/net/stmmac.txt | |||
| @@ -33,7 +33,7 @@ Optional properties: | |||
| 33 | - max-frame-size: See ethernet.txt file in the same directory | 33 | - max-frame-size: See ethernet.txt file in the same directory |
| 34 | - clocks: If present, the first clock should be the GMAC main clock, | 34 | - clocks: If present, the first clock should be the GMAC main clock, |
| 35 | further clocks may be specified in derived bindings. | 35 | further clocks may be specified in derived bindings. |
| 36 | - clocks-names: One name for each entry in the clocks property, the | 36 | - clock-names: One name for each entry in the clocks property, the |
| 37 | first one should be "stmmaceth". | 37 | first one should be "stmmaceth". |
| 38 | 38 | ||
| 39 | Examples: | 39 | Examples: |
diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt index 4bd5be0e5e7d..26bcb18f4e60 100644 --- a/Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-st.txt | |||
| @@ -83,7 +83,7 @@ Example: | |||
| 83 | reg = <0xfe61f080 0x4>; | 83 | reg = <0xfe61f080 0x4>; |
| 84 | reg-names = "irqmux"; | 84 | reg-names = "irqmux"; |
| 85 | interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>; | 85 | interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>; |
| 86 | interrupts-names = "irqmux"; | 86 | interrupt-names = "irqmux"; |
| 87 | ranges = <0 0xfe610000 0x5000>; | 87 | ranges = <0 0xfe610000 0x5000>; |
| 88 | 88 | ||
| 89 | PIO0: gpio@fe610000 { | 89 | PIO0: gpio@fe610000 { |
| @@ -165,7 +165,7 @@ sdhci0:sdhci@fe810000{ | |||
| 165 | interrupt-parent = <&PIO3>; | 165 | interrupt-parent = <&PIO3>; |
| 166 | #interrupt-cells = <2>; | 166 | #interrupt-cells = <2>; |
| 167 | interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; /* Interrupt line via PIO3-3 */ | 167 | interrupts = <3 IRQ_TYPE_LEVEL_HIGH>; /* Interrupt line via PIO3-3 */ |
| 168 | interrupts-names = "card-detect"; | 168 | interrupt-names = "card-detect"; |
| 169 | pinctrl-names = "default"; | 169 | pinctrl-names = "default"; |
| 170 | pinctrl-0 = <&pinctrl_mmc>; | 170 | pinctrl-0 = <&pinctrl_mmc>; |
| 171 | }; | 171 | }; |
diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt index 569b26c4a81e..60ca07996458 100644 --- a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt +++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt | |||
| @@ -47,7 +47,7 @@ mcasp0: mcasp0@1d00000 { | |||
| 47 | reg = <0x100000 0x3000>; | 47 | reg = <0x100000 0x3000>; |
| 48 | reg-names "mpu"; | 48 | reg-names "mpu"; |
| 49 | interrupts = <82>, <83>; | 49 | interrupts = <82>, <83>; |
| 50 | interrupts-names = "tx", "rx"; | 50 | interrupt-names = "tx", "rx"; |
| 51 | op-mode = <0>; /* MCASP_IIS_MODE */ | 51 | op-mode = <0>; /* MCASP_IIS_MODE */ |
| 52 | tdm-slots = <2>; | 52 | tdm-slots = <2>; |
| 53 | serial-dir = < | 53 | serial-dir = < |
diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi index 07f283c20eb1..cb6811e5ae5a 100644 --- a/arch/arm/boot/dts/am33xx.dtsi +++ b/arch/arm/boot/dts/am33xx.dtsi | |||
| @@ -802,7 +802,7 @@ | |||
| 802 | <0x46000000 0x400000>; | 802 | <0x46000000 0x400000>; |
| 803 | reg-names = "mpu", "dat"; | 803 | reg-names = "mpu", "dat"; |
| 804 | interrupts = <80>, <81>; | 804 | interrupts = <80>, <81>; |
| 805 | interrupts-names = "tx", "rx"; | 805 | interrupt-names = "tx", "rx"; |
| 806 | status = "disabled"; | 806 | status = "disabled"; |
| 807 | dmas = <&edma 8>, | 807 | dmas = <&edma 8>, |
| 808 | <&edma 9>; | 808 | <&edma 9>; |
| @@ -816,7 +816,7 @@ | |||
| 816 | <0x46400000 0x400000>; | 816 | <0x46400000 0x400000>; |
| 817 | reg-names = "mpu", "dat"; | 817 | reg-names = "mpu", "dat"; |
| 818 | interrupts = <82>, <83>; | 818 | interrupts = <82>, <83>; |
| 819 | interrupts-names = "tx", "rx"; | 819 | interrupt-names = "tx", "rx"; |
| 820 | status = "disabled"; | 820 | status = "disabled"; |
| 821 | dmas = <&edma 10>, | 821 | dmas = <&edma 10>, |
| 822 | <&edma 11>; | 822 | <&edma 11>; |
diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi index 36d523a26831..d1f8707ff1df 100644 --- a/arch/arm/boot/dts/am4372.dtsi +++ b/arch/arm/boot/dts/am4372.dtsi | |||
| @@ -691,7 +691,7 @@ | |||
| 691 | <0x46000000 0x400000>; | 691 | <0x46000000 0x400000>; |
| 692 | reg-names = "mpu", "dat"; | 692 | reg-names = "mpu", "dat"; |
| 693 | interrupts = <80>, <81>; | 693 | interrupts = <80>, <81>; |
| 694 | interrupts-names = "tx", "rx"; | 694 | interrupt-names = "tx", "rx"; |
| 695 | status = "disabled"; | 695 | status = "disabled"; |
| 696 | dmas = <&edma 8>, | 696 | dmas = <&edma 8>, |
| 697 | <&edma 9>; | 697 | <&edma 9>; |
| @@ -705,7 +705,7 @@ | |||
| 705 | <0x46400000 0x400000>; | 705 | <0x46400000 0x400000>; |
| 706 | reg-names = "mpu", "dat"; | 706 | reg-names = "mpu", "dat"; |
| 707 | interrupts = <82>, <83>; | 707 | interrupts = <82>, <83>; |
| 708 | interrupts-names = "tx", "rx"; | 708 | interrupt-names = "tx", "rx"; |
| 709 | status = "disabled"; | 709 | status = "disabled"; |
| 710 | dmas = <&edma 10>, | 710 | dmas = <&edma 10>, |
| 711 | <&edma 11>; | 711 | <&edma 11>; |
diff --git a/arch/arm/boot/dts/stih415-pinctrl.dtsi b/arch/arm/boot/dts/stih415-pinctrl.dtsi index f09fb10a3791..81df870e5ee6 100644 --- a/arch/arm/boot/dts/stih415-pinctrl.dtsi +++ b/arch/arm/boot/dts/stih415-pinctrl.dtsi | |||
| @@ -49,7 +49,7 @@ | |||
| 49 | reg = <0xfe61f080 0x4>; | 49 | reg = <0xfe61f080 0x4>; |
| 50 | reg-names = "irqmux"; | 50 | reg-names = "irqmux"; |
| 51 | interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>; | 51 | interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>; |
| 52 | interrupts-names = "irqmux"; | 52 | interrupt-names = "irqmux"; |
| 53 | ranges = <0 0xfe610000 0x5000>; | 53 | ranges = <0 0xfe610000 0x5000>; |
| 54 | 54 | ||
| 55 | PIO0: gpio@fe610000 { | 55 | PIO0: gpio@fe610000 { |
| @@ -187,7 +187,7 @@ | |||
| 187 | reg = <0xfee0f080 0x4>; | 187 | reg = <0xfee0f080 0x4>; |
| 188 | reg-names = "irqmux"; | 188 | reg-names = "irqmux"; |
| 189 | interrupts = <GIC_SPI 181 IRQ_TYPE_LEVEL_HIGH>; | 189 | interrupts = <GIC_SPI 181 IRQ_TYPE_LEVEL_HIGH>; |
| 190 | interrupts-names = "irqmux"; | 190 | interrupt-names = "irqmux"; |
| 191 | ranges = <0 0xfee00000 0x8000>; | 191 | ranges = <0 0xfee00000 0x8000>; |
| 192 | 192 | ||
| 193 | PIO5: gpio@fee00000 { | 193 | PIO5: gpio@fee00000 { |
| @@ -282,7 +282,7 @@ | |||
| 282 | reg = <0xfe82f080 0x4>; | 282 | reg = <0xfe82f080 0x4>; |
| 283 | reg-names = "irqmux"; | 283 | reg-names = "irqmux"; |
| 284 | interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>; | 284 | interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>; |
| 285 | interrupts-names = "irqmux"; | 285 | interrupt-names = "irqmux"; |
| 286 | ranges = <0 0xfe820000 0x8000>; | 286 | ranges = <0 0xfe820000 0x8000>; |
| 287 | 287 | ||
| 288 | PIO13: gpio@fe820000 { | 288 | PIO13: gpio@fe820000 { |
| @@ -423,7 +423,7 @@ | |||
| 423 | reg = <0xfd6bf080 0x4>; | 423 | reg = <0xfd6bf080 0x4>; |
| 424 | reg-names = "irqmux"; | 424 | reg-names = "irqmux"; |
| 425 | interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>; | 425 | interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>; |
| 426 | interrupts-names = "irqmux"; | 426 | interrupt-names = "irqmux"; |
| 427 | ranges = <0 0xfd6b0000 0x3000>; | 427 | ranges = <0 0xfd6b0000 0x3000>; |
| 428 | 428 | ||
| 429 | PIO100: gpio@fd6b0000 { | 429 | PIO100: gpio@fd6b0000 { |
| @@ -460,7 +460,7 @@ | |||
| 460 | reg = <0xfd33f080 0x4>; | 460 | reg = <0xfd33f080 0x4>; |
| 461 | reg-names = "irqmux"; | 461 | reg-names = "irqmux"; |
| 462 | interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>; | 462 | interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>; |
| 463 | interrupts-names = "irqmux"; | 463 | interrupt-names = "irqmux"; |
| 464 | ranges = <0 0xfd330000 0x5000>; | 464 | ranges = <0 0xfd330000 0x5000>; |
| 465 | 465 | ||
| 466 | PIO103: gpio@fd330000 { | 466 | PIO103: gpio@fd330000 { |
diff --git a/arch/arm/boot/dts/stih416-pinctrl.dtsi b/arch/arm/boot/dts/stih416-pinctrl.dtsi index aeea304086eb..250d5ecc951e 100644 --- a/arch/arm/boot/dts/stih416-pinctrl.dtsi +++ b/arch/arm/boot/dts/stih416-pinctrl.dtsi | |||
| @@ -53,7 +53,7 @@ | |||
| 53 | reg = <0xfe61f080 0x4>; | 53 | reg = <0xfe61f080 0x4>; |
| 54 | reg-names = "irqmux"; | 54 | reg-names = "irqmux"; |
| 55 | interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>; | 55 | interrupts = <GIC_SPI 182 IRQ_TYPE_LEVEL_HIGH>; |
| 56 | interrupts-names = "irqmux"; | 56 | interrupt-names = "irqmux"; |
| 57 | ranges = <0 0xfe610000 0x6000>; | 57 | ranges = <0 0xfe610000 0x6000>; |
| 58 | 58 | ||
| 59 | PIO0: gpio@fe610000 { | 59 | PIO0: gpio@fe610000 { |
| @@ -201,7 +201,7 @@ | |||
| 201 | reg = <0xfee0f080 0x4>; | 201 | reg = <0xfee0f080 0x4>; |
| 202 | reg-names = "irqmux"; | 202 | reg-names = "irqmux"; |
| 203 | interrupts = <GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>; | 203 | interrupts = <GIC_SPI 183 IRQ_TYPE_LEVEL_HIGH>; |
| 204 | interrupts-names = "irqmux"; | 204 | interrupt-names = "irqmux"; |
| 205 | ranges = <0 0xfee00000 0x10000>; | 205 | ranges = <0 0xfee00000 0x10000>; |
| 206 | 206 | ||
| 207 | PIO5: gpio@fee00000 { | 207 | PIO5: gpio@fee00000 { |
| @@ -333,7 +333,7 @@ | |||
| 333 | reg = <0xfe82f080 0x4>; | 333 | reg = <0xfe82f080 0x4>; |
| 334 | reg-names = "irqmux"; | 334 | reg-names = "irqmux"; |
| 335 | interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>; | 335 | interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>; |
| 336 | interrupts-names = "irqmux"; | 336 | interrupt-names = "irqmux"; |
| 337 | ranges = <0 0xfe820000 0x6000>; | 337 | ranges = <0 0xfe820000 0x6000>; |
| 338 | 338 | ||
| 339 | PIO13: gpio@fe820000 { | 339 | PIO13: gpio@fe820000 { |
| @@ -461,7 +461,7 @@ | |||
| 461 | reg = <0xfd6bf080 0x4>; | 461 | reg = <0xfd6bf080 0x4>; |
| 462 | reg-names = "irqmux"; | 462 | reg-names = "irqmux"; |
| 463 | interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>; | 463 | interrupts = <GIC_SPI 113 IRQ_TYPE_LEVEL_HIGH>; |
| 464 | interrupts-names = "irqmux"; | 464 | interrupt-names = "irqmux"; |
| 465 | ranges = <0 0xfd6b0000 0x3000>; | 465 | ranges = <0 0xfd6b0000 0x3000>; |
| 466 | 466 | ||
| 467 | PIO100: gpio@fd6b0000 { | 467 | PIO100: gpio@fd6b0000 { |
| @@ -498,7 +498,7 @@ | |||
| 498 | reg = <0xfd33f080 0x4>; | 498 | reg = <0xfd33f080 0x4>; |
| 499 | reg-names = "irqmux"; | 499 | reg-names = "irqmux"; |
| 500 | interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>; | 500 | interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>; |
| 501 | interrupts-names = "irqmux"; | 501 | interrupt-names = "irqmux"; |
| 502 | ranges = <0 0xfd330000 0x5000>; | 502 | ranges = <0 0xfd330000 0x5000>; |
| 503 | 503 | ||
| 504 | PIO103: gpio@fd330000 { | 504 | PIO103: gpio@fd330000 { |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index e714709704e4..5b47210889e0 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
| 14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
| 15 | #include <linux/of_device.h> | 15 | #include <linux/of_device.h> |
| 16 | #include <linux/of_irq.h> | ||
| 16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
| 17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
| 18 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
| @@ -87,7 +88,11 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) | |||
| 87 | return -ENXIO; | 88 | return -ENXIO; |
| 88 | return dev->archdata.irqs[num]; | 89 | return dev->archdata.irqs[num]; |
| 89 | #else | 90 | #else |
| 90 | struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num); | 91 | struct resource *r; |
| 92 | if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) | ||
| 93 | return of_irq_get(dev->dev.of_node, num); | ||
| 94 | |||
| 95 | r = platform_get_resource(dev, IORESOURCE_IRQ, num); | ||
| 91 | 96 | ||
| 92 | return r ? r->start : -ENXIO; | 97 | return r ? r->start : -ENXIO; |
| 93 | #endif | 98 | #endif |
diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 9bcf2cf19357..5aeb89411350 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c | |||
| @@ -364,7 +364,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
| 364 | 364 | ||
| 365 | memset(r, 0, sizeof(*r)); | 365 | memset(r, 0, sizeof(*r)); |
| 366 | /* | 366 | /* |
| 367 | * Get optional "interrupts-names" property to add a name | 367 | * Get optional "interrupt-names" property to add a name |
| 368 | * to the resource. | 368 | * to the resource. |
| 369 | */ | 369 | */ |
| 370 | of_property_read_string_index(dev, "interrupt-names", index, | 370 | of_property_read_string_index(dev, "interrupt-names", index, |
| @@ -380,6 +380,32 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) | |||
| 380 | EXPORT_SYMBOL_GPL(of_irq_to_resource); | 380 | EXPORT_SYMBOL_GPL(of_irq_to_resource); |
| 381 | 381 | ||
| 382 | /** | 382 | /** |
| 383 | * of_irq_get - Decode a node's IRQ and return it as a Linux irq number | ||
| 384 | * @dev: pointer to device tree node | ||
| 385 | * @index: zero-based index of the irq | ||
| 386 | * | ||
| 387 | * Returns Linux irq number on success, or -EPROBE_DEFER if the irq domain | ||
| 388 | * is not yet created. | ||
| 389 | * | ||
| 390 | */ | ||
| 391 | int of_irq_get(struct device_node *dev, int index) | ||
| 392 | { | ||
| 393 | int rc; | ||
| 394 | struct of_phandle_args oirq; | ||
| 395 | struct irq_domain *domain; | ||
| 396 | |||
| 397 | rc = of_irq_parse_one(dev, index, &oirq); | ||
| 398 | if (rc) | ||
| 399 | return rc; | ||
| 400 | |||
| 401 | domain = irq_find_host(oirq.np); | ||
| 402 | if (!domain) | ||
| 403 | return -EPROBE_DEFER; | ||
| 404 | |||
| 405 | return irq_create_of_mapping(&oirq); | ||
| 406 | } | ||
| 407 | |||
| 408 | /** | ||
| 383 | * of_irq_count - Count the number of IRQs a node uses | 409 | * of_irq_count - Count the number of IRQs a node uses |
| 384 | * @dev: pointer to device tree node | 410 | * @dev: pointer to device tree node |
| 385 | */ | 411 | */ |
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 404d1daebefa..bd47fbc53dc9 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c | |||
| @@ -168,7 +168,9 @@ struct platform_device *of_device_alloc(struct device_node *np, | |||
| 168 | rc = of_address_to_resource(np, i, res); | 168 | rc = of_address_to_resource(np, i, res); |
| 169 | WARN_ON(rc); | 169 | WARN_ON(rc); |
| 170 | } | 170 | } |
| 171 | WARN_ON(of_irq_to_resource_table(np, res, num_irq) != num_irq); | 171 | if (of_irq_to_resource_table(np, res, num_irq) != num_irq) |
| 172 | pr_debug("not all legacy IRQ resources mapped for %s\n", | ||
| 173 | np->name); | ||
| 172 | } | 174 | } |
| 173 | 175 | ||
| 174 | dev->dev.of_node = of_node_get(np); | 176 | dev->dev.of_node = of_node_get(np); |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index ae4450070503..fe70b86bcffb 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 11 | #include <linux/of.h> | 11 | #include <linux/of.h> |
| 12 | #include <linux/of_irq.h> | 12 | #include <linux/of_irq.h> |
| 13 | #include <linux/of_platform.h> | ||
| 13 | #include <linux/list.h> | 14 | #include <linux/list.h> |
| 14 | #include <linux/mutex.h> | 15 | #include <linux/mutex.h> |
| 15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
| @@ -427,6 +428,36 @@ static void __init of_selftest_match_node(void) | |||
| 427 | } | 428 | } |
| 428 | } | 429 | } |
| 429 | 430 | ||
| 431 | static void __init of_selftest_platform_populate(void) | ||
| 432 | { | ||
| 433 | int irq; | ||
| 434 | struct device_node *np; | ||
| 435 | struct platform_device *pdev; | ||
| 436 | |||
| 437 | np = of_find_node_by_path("/testcase-data"); | ||
| 438 | of_platform_populate(np, of_default_bus_match_table, NULL, NULL); | ||
| 439 | |||
| 440 | /* Test that a missing irq domain returns -EPROBE_DEFER */ | ||
| 441 | np = of_find_node_by_path("/testcase-data/testcase-device1"); | ||
| 442 | pdev = of_find_device_by_node(np); | ||
| 443 | if (!pdev) | ||
| 444 | selftest(0, "device 1 creation failed\n"); | ||
| 445 | irq = platform_get_irq(pdev, 0); | ||
| 446 | if (irq != -EPROBE_DEFER) | ||
| 447 | selftest(0, "device deferred probe failed - %d\n", irq); | ||
| 448 | |||
| 449 | /* Test that a parsing failure does not return -EPROBE_DEFER */ | ||
| 450 | np = of_find_node_by_path("/testcase-data/testcase-device2"); | ||
| 451 | pdev = of_find_device_by_node(np); | ||
| 452 | if (!pdev) | ||
| 453 | selftest(0, "device 2 creation failed\n"); | ||
| 454 | irq = platform_get_irq(pdev, 0); | ||
| 455 | if (irq >= 0 || irq == -EPROBE_DEFER) | ||
| 456 | selftest(0, "device parsing error failed - %d\n", irq); | ||
| 457 | |||
| 458 | selftest(1, "passed"); | ||
| 459 | } | ||
| 460 | |||
| 430 | static int __init of_selftest(void) | 461 | static int __init of_selftest(void) |
| 431 | { | 462 | { |
| 432 | struct device_node *np; | 463 | struct device_node *np; |
| @@ -445,6 +476,7 @@ static int __init of_selftest(void) | |||
| 445 | of_selftest_parse_interrupts(); | 476 | of_selftest_parse_interrupts(); |
| 446 | of_selftest_parse_interrupts_extended(); | 477 | of_selftest_parse_interrupts_extended(); |
| 447 | of_selftest_match_node(); | 478 | of_selftest_match_node(); |
| 479 | of_selftest_platform_populate(); | ||
| 448 | pr_info("end of selftest - %i passed, %i failed\n", | 480 | pr_info("end of selftest - %i passed, %i failed\n", |
| 449 | selftest_results.passed, selftest_results.failed); | 481 | selftest_results.passed, selftest_results.failed); |
| 450 | return 0; | 482 | return 0; |
diff --git a/drivers/of/testcase-data/tests-interrupts.dtsi b/drivers/of/testcase-data/tests-interrupts.dtsi index c843720bd3e5..da4695f60351 100644 --- a/drivers/of/testcase-data/tests-interrupts.dtsi +++ b/drivers/of/testcase-data/tests-interrupts.dtsi | |||
| @@ -54,5 +54,18 @@ | |||
| 54 | <&test_intmap1 1 2>; | 54 | <&test_intmap1 1 2>; |
| 55 | }; | 55 | }; |
| 56 | }; | 56 | }; |
| 57 | |||
| 58 | testcase-device1 { | ||
| 59 | compatible = "testcase-device"; | ||
| 60 | interrupt-parent = <&test_intc0>; | ||
| 61 | interrupts = <1>; | ||
| 62 | }; | ||
| 63 | |||
| 64 | testcase-device2 { | ||
| 65 | compatible = "testcase-device"; | ||
| 66 | interrupt-parent = <&test_intc2>; | ||
| 67 | interrupts = <1>; /* invalid specifier - too short */ | ||
| 68 | }; | ||
| 57 | }; | 69 | }; |
| 70 | |||
| 58 | }; | 71 | }; |
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index 3f23b4472c31..6404253d810d 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h | |||
| @@ -44,11 +44,16 @@ extern void of_irq_init(const struct of_device_id *matches); | |||
| 44 | 44 | ||
| 45 | #ifdef CONFIG_OF_IRQ | 45 | #ifdef CONFIG_OF_IRQ |
| 46 | extern int of_irq_count(struct device_node *dev); | 46 | extern int of_irq_count(struct device_node *dev); |
| 47 | extern int of_irq_get(struct device_node *dev, int index); | ||
| 47 | #else | 48 | #else |
| 48 | static inline int of_irq_count(struct device_node *dev) | 49 | static inline int of_irq_count(struct device_node *dev) |
| 49 | { | 50 | { |
| 50 | return 0; | 51 | return 0; |
| 51 | } | 52 | } |
| 53 | static inline int of_irq_get(struct device_node *dev, int index) | ||
| 54 | { | ||
| 55 | return 0; | ||
| 56 | } | ||
| 52 | #endif | 57 | #endif |
| 53 | 58 | ||
| 54 | #if defined(CONFIG_OF) | 59 | #if defined(CONFIG_OF) |
