Commit a9ecdc0f authored by Florian Fainelli's avatar Florian Fainelli Committed by Grant Likely

of/irq: Fix lookup to use 'interrupts-extended' property first

In case the Device Tree blob passed by the boot agent supplies both an
'interrupts-extended' and an 'interrupts' property in order to allow for
older kernels to be usable, prefer the new-style 'interrupts-extended'
property which conveys a lot more information.

This allows us to have bootloaders willingly maintaining backwards
compatibility with older kernels without entirely deprecating the
'interrupts' property.

Update the bindings documentation to describe a situation where both the
'interrupts-extended' and the 'interrupts' property are present, and
which one takes precedence over the other.

Cc: stable@vger.kernel.org # 3.13+
Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
parent b951f9dc
...@@ -4,11 +4,13 @@ Specifying interrupt information for devices ...@@ -4,11 +4,13 @@ Specifying interrupt information for devices
1) Interrupt client nodes 1) Interrupt client nodes
------------------------- -------------------------
Nodes that describe devices which generate interrupts must contain an either an Nodes that describe devices which generate interrupts must contain an
"interrupts" property or an "interrupts-extended" property. These properties "interrupts" property, an "interrupts-extended" property, or both. If both are
contain a list of interrupt specifiers, one per output interrupt. The format of present, the latter should take precedence; the former may be provided simply
the interrupt specifier is determined by the interrupt controller to which the for compatibility with software that does not recognize the latter. These
interrupts are routed; see section 2 below for details. properties contain a list of interrupt specifiers, one per output interrupt. The
format of the interrupt specifier is determined by the interrupt controller to
which the interrupts are routed; see section 2 below for details.
Example: Example:
interrupt-parent = <&intc1>; interrupt-parent = <&intc1>;
......
...@@ -301,16 +301,17 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar ...@@ -301,16 +301,17 @@ int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_ar
/* Get the reg property (if any) */ /* Get the reg property (if any) */
addr = of_get_property(device, "reg", NULL); addr = of_get_property(device, "reg", NULL);
/* Get the interrupts property */ /* Try the new-style interrupts-extended first */
intspec = of_get_property(device, "interrupts", &intlen);
if (intspec == NULL) {
/* Try the new-style interrupts-extended */
res = of_parse_phandle_with_args(device, "interrupts-extended", res = of_parse_phandle_with_args(device, "interrupts-extended",
"#interrupt-cells", index, out_irq); "#interrupt-cells", index, out_irq);
if (res) if (!res)
return -EINVAL;
return of_irq_parse_raw(addr, out_irq); return of_irq_parse_raw(addr, out_irq);
}
/* Get the interrupts property */
intspec = of_get_property(device, "interrupts", &intlen);
if (intspec == NULL)
return -EINVAL;
intlen /= sizeof(*intspec); intlen /= sizeof(*intspec);
pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment