Add support for Layerscape external interrupt lines
Subsystems (2)
v7 cover Add support for Layerscape external interrupt lines
In v7, I've tried to change from a custom binding to use interrupt-map, modelled on the recent addition of the renesas,rza1-irqc (commits a644ccb819bc and 5e27a314a11f). It's possible that the interrupt-map parsing code can be factored to a common helper, but it's a bit hard to generalize from two examples to know what a good interface would look like.
The interrupt-map-mask is a bit arbitrary. 0xff would likely work just as well (but I think the ls2088a has 32 external lines, so it has to be a least 0x1f).
Also, this drops the fsl,bit-reverse property and instead reads the SCFGREVCR register to determine if bit-reversing is needed.
The dt/bindings patch now comes first in accordance with Documentation/devicetree/bindings/submitting-patches.txt.
Earlier versions can be found here:
v6: https://lore.kernel.org/lkml/[email protected]/
v5: https://lore.kernel.org/lkml/[email protected]/
Rasmus Villemoes (2):
dt/bindings: Add bindings for Layerscape external irqs
irqchip: add support for Layerscape external interrupt lines
.../interrupt-controller/fsl,ls-extirq.txt | 49 +++++ drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ls-extirq.c | 197 ++++++++++++++++++ 4 files changed, 251 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt create mode 100644 drivers/irqchip/irq-ls-extirq.c
Signature · 1 line
2.23.0
PATCH v7 1/2 dt/bindings: Add bindings for Layerscape external irqs
This adds Device Tree binding documentation for the external interrupt lines with configurable polarity present on some Layerscape SOCs.
--- .../interrupt-controller/fsl,ls-extirq.txt | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt
Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt new file +49 -0
@@ -0,0 +1,49 @@ +* Freescale Layerscape external IRQs + +Some Layerscape SOCs (LS1021A, LS1043A, LS1046A) support inverting +the polarity of certain external interrupt lines. + +The device node must be a child of the node representing the +Supplemental Configuration Unit (SCFG). + +Required properties: +- compatible: should be "fsl,<soc-name>-extirq", e.g. "fsl,ls1021a-extirq". +- #interrupt-cells: Must be 2. The first element is the index of the + external interrupt line. The second element is the trigger type. +- #address-cells: Must be 0. +- interrupt-controller: Identifies the node as an interrupt controller +- reg: Specifies the Interrupt Polarity Control Register (INTPCR) in + the SCFG. +- interrupt-map: Specifies the mapping from external interrupts to GIC + interrupts. +- interrupt-map-mask: Must be <0xffffffff 0>. + +Example: + scfg: scfg@1570000 { + compatible = "fsl,ls1021a-scfg", "syscon"; + reg = <0x0 0x1570000 0x0 0x10000>; + big-endian; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x0 0x1570000 0x10000>; + + extirq: interrupt-controller@1ac { + compatible = "fsl,ls1021a-extirq"; + #interrupt-cells = <2>; + #address-cells = <0>; + interrupt-controller; + reg = <0x1ac 4>; + interrupt-map = + <0 0 &gic GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, + <1 0 &gic GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, + <2 0 &gic GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, + <3 0 &gic GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, + <4 0 &gic GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <5 0 &gic GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; + interrupt-map-mask = <0xffffffff 0x0>; + }; + }; + + + interrupts-extended = <&gic GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, + <&extirq 1 IRQ_TYPE_LEVEL_LOW>;
Signature · 1 line
2.23.0
[tip: irq/core] dt/bindings: Add bindings for Layerscape external irqs
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 87cd38dfd9e67ffa7c3d3d1a54a2482ed23f1307 Gitweb: https://git.kernel.org/tip/87cd38dfd9e67ffa7c3d3d1a54a2482ed23f1307 Author: Rasmus Villemoes <[email protected]> AuthorDate: Thu, 07 Nov 2019 13:21:14 +01:00 Committer: Marc Zyngier <[email protected]> CommitterDate: Sun, 10 Nov 2019 18:47:48
dt/bindings: Add bindings for Layerscape external irqs
This adds Device Tree binding documentation for the external interrupt lines with configurable polarity present on some Layerscape SOCs.
--- Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt
Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt new file +49 -0
@@ -0,0 +1,49 @@ +* Freescale Layerscape external IRQs + +Some Layerscape SOCs (LS1021A, LS1043A, LS1046A) support inverting +the polarity of certain external interrupt lines. + +The device node must be a child of the node representing the +Supplemental Configuration Unit (SCFG). + +Required properties: +- compatible: should be "fsl,<soc-name>-extirq", e.g. "fsl,ls1021a-extirq". +- #interrupt-cells: Must be 2. The first element is the index of the + external interrupt line. The second element is the trigger type. +- #address-cells: Must be 0. +- interrupt-controller: Identifies the node as an interrupt controller +- reg: Specifies the Interrupt Polarity Control Register (INTPCR) in + the SCFG. +- interrupt-map: Specifies the mapping from external interrupts to GIC + interrupts. +- interrupt-map-mask: Must be <0xffffffff 0>. + +Example: + scfg: scfg@1570000 { + compatible = "fsl,ls1021a-scfg", "syscon"; + reg = <0x0 0x1570000 0x0 0x10000>; + big-endian; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x0 0x1570000 0x10000>; + + extirq: interrupt-controller@1ac { + compatible = "fsl,ls1021a-extirq"; + #interrupt-cells = <2>; + #address-cells = <0>; + interrupt-controller; + reg = <0x1ac 4>; + interrupt-map = + <0 0 &gic GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>, + <1 0 &gic GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>, + <2 0 &gic GIC_SPI 165 IRQ_TYPE_LEVEL_HIGH>, + <3 0 &gic GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, + <4 0 &gic GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, + <5 0 &gic GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>; + interrupt-map-mask = <0xffffffff 0x0>; + }; + }; + + + interrupts-extended = <&gic GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, + <&extirq 1 IRQ_TYPE_LEVEL_LOW>;
PATCH v7 2/2 irqchip: add support for Layerscape external interrupt lines
In reply to Rasmus VillemoesThe LS1021A allows inverting the polarity of six interrupt lines IRQ[0:5] via the scfg_intpcr register, effectively allowing IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_EDGE_FALLING for those. We just need to check the type, set the relevant bit in INTPCR accordingly, and fixup the type argument before calling the GIC's irq_set_type.
In fact, the power-on-reset value of the INTPCR register on the LS1021A is so that all six lines have their polarity inverted. Hence any hardware connected to those lines is unusable without this: If the line is indeed active low, the generic GIC code will reject an irq spec with IRQ_TYPE_LEVEL_LOW, while if the line is active high, we must obviously disable the polarity inversion (writing 0 to the relevant bit) before unmasking the interrupt.
Some other Layerscape SOCs (LS1043A, LS1046A) have a similar feature, just with a different number of external interrupt lines (and a different POR value for the INTPCR register). This driver should be prepared for supporting those by properly filling out the device tree node. I have the reference manuals for all three boards, but I've only tested the driver on an LS1021A.
Unfortunately, the Kconfig symbol ARCH_LAYERSCAPE only exists on arm64, so do as is done for irq-ls-scfg-msi.c: introduce a new symbol which is set when either ARCH_LAYERSCAPE or SOC_LS1021A is set.
--- drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ls-extirq.c | 197 ++++++++++++++++++++++++++++++++ 3 files changed, 202 insertions(+) create mode 100644 drivers/irqchip/irq-ls-extirq.c
drivers/irqchip/Kconfig +4 -0
@@ -370,6 +370,10 @@ config MVEBU_PIC config MVEBU_SEI bool +config LS_EXTIRQ + def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE + select MFD_SYSCON + config LS_SCFG_MSI def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE depends on PCI && PCI_MSI
drivers/irqchip/Makefile +1 -0
@@ -84,6 +84,7 @@ obj-$(CONFIG_MVEBU_ICU) += irq-mvebu-icu.o obj-$(CONFIG_MVEBU_ODMI) += irq-mvebu-odmi.o obj-$(CONFIG_MVEBU_PIC) += irq-mvebu-pic.o obj-$(CONFIG_MVEBU_SEI) += irq-mvebu-sei.o +obj-$(CONFIG_LS_EXTIRQ) += irq-ls-extirq.o obj-$(CONFIG_LS_SCFG_MSI) += irq-ls-scfg-msi.o obj-$(CONFIG_EZNPS_GIC) += irq-eznps.o obj-$(CONFIG_ARCH_ASPEED) += irq-aspeed-vic.o irq-aspeed-i2c-ic.o
drivers/irqchip/irq-ls-extirq.c new file +197 -0
197 lines not on this page · raw message
Signature · 1 line
2.23.0
[tip: irq/core] irqchip: Add support for Layerscape external interrupt lines
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 0dcd9f872769547f336741880bc7e721149c8d0a Gitweb: https://git.kernel.org/tip/0dcd9f872769547f336741880bc7e721149c8d0a Author: Rasmus Villemoes <[email protected]> AuthorDate: Thu, 07 Nov 2019 13:21:15 +01:00 Committer: Marc Zyngier <[email protected]> CommitterDate: Sun, 10 Nov 2019 18:47:49
irqchip: Add support for Layerscape external interrupt lines
The LS1021A allows inverting the polarity of six interrupt lines IRQ[0:5] via the scfg_intpcr register, effectively allowing IRQ_TYPE_LEVEL_LOW and IRQ_TYPE_EDGE_FALLING for those. We just need to check the type, set the relevant bit in INTPCR accordingly, and fixup the type argument before calling the GIC's irq_set_type.
In fact, the power-on-reset value of the INTPCR register on the LS1021A is so that all six lines have their polarity inverted. Hence any hardware connected to those lines is unusable without this: If the line is indeed active low, the generic GIC code will reject an irq spec with IRQ_TYPE_LEVEL_LOW, while if the line is active high, we must obviously disable the polarity inversion (writing 0 to the relevant bit) before unmasking the interrupt.
Some other Layerscape SOCs (LS1043A, LS1046A) have a similar feature, just with a different number of external interrupt lines (and a different POR value for the INTPCR register). This driver should be prepared for supporting those by properly filling out the device tree node. I have the reference manuals for all three boards, but I've only tested the driver on an LS1021A.
Unfortunately, the Kconfig symbol ARCH_LAYERSCAPE only exists on arm64, so do as is done for irq-ls-scfg-msi.c: introduce a new symbol which is set when either ARCH_LAYERSCAPE or SOC_LS1021A is set.
--- drivers/irqchip/Kconfig | 4 +- drivers/irqchip/Makefile | 1 +- drivers/irqchip/irq-ls-extirq.c | 197 +++++++++++++++++++++++++++++++- 3 files changed, 202 insertions(+) create mode 100644 drivers/irqchip/irq-ls-extirq.c
drivers/irqchip/Kconfig +4 -0
@@ -370,6 +370,10 @@ config MVEBU_PIC config MVEBU_SEI bool +config LS_EXTIRQ + def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE + select MFD_SYSCON + config LS_SCFG_MSI def_bool y if SOC_LS1021A || ARCH_LAYERSCAPE depends on PCI && PCI_MSI
drivers/irqchip/Makefile +1 -0
@@ -84,6 +84,7 @@ obj-$(CONFIG_MVEBU_ICU) += irq-mvebu-icu.o obj-$(CONFIG_MVEBU_ODMI) += irq-mvebu-odmi.o obj-$(CONFIG_MVEBU_PIC) += irq-mvebu-pic.o obj-$(CONFIG_MVEBU_SEI) += irq-mvebu-sei.o +obj-$(CONFIG_LS_EXTIRQ) += irq-ls-extirq.o obj-$(CONFIG_LS_SCFG_MSI) += irq-ls-scfg-msi.o obj-$(CONFIG_EZNPS_GIC) += irq-eznps.o obj-$(CONFIG_ARCH_ASPEED) += irq-aspeed-vic.o irq-aspeed-i2c-ic.o
drivers/irqchip/irq-ls-extirq.c new file +197 -0
197 lines not on this page · raw message
Marc Zyngier
AppliedQuoted 36 lines · Rasmus Villemoes
In v7, I've tried to change from a custom binding to use interrupt-map, modelled on the recent addition of the renesas,rza1-irqc (commits
a644ccb819bcand5e27a314a11f). It's possible that the interrupt-map parsing code can be factored to a common helper, but it's a bit hard to generalize from two examples to know what a good interface would look like.The interrupt-map-mask is a bit arbitrary.
0xffwould likely work just as well (but I think the ls2088a has 32 external lines, so it has to be a least0x1f).Also, this drops the fsl,bit-reverse property and instead reads the SCFGREVCR register to determine if bit-reversing is needed.
The dt/bindings patch now comes first in accordance with
Documentation/devicetree/bindings/submitting-patches.txt.Earlier versions can be found here:
v6: https://lore.kernel.org/lkml/[email protected]/
v5:https://lore.kernel.org/lkml/[email protected]/
Rasmus Villemoes (2):
dt/bindings: Add bindings for Layerscape external irqs
irqchip: add support for Layerscape external interrupt lines.../interrupt-controller/fsl,ls-extirq.txt | 49 +++++ drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ls-extirq.c | 197 ++++++++++++++++++ 4 files changed, 251 insertions(+) create mode 100644
Quoted 2 lines
Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txtcreate mode 100644 drivers/irqchip/irq-ls-extirq.c
Applied to irqchip-next.
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Vladimir Oltean
Tested-byQuoted 43 lines · Marc Zyngier
Quoted 38 lines · Rasmus Villemoes
In v7, I've tried to change from a custom binding to use interrupt-map, modelled on the recent addition of the renesas,rza1-irqc (commits
a644ccb819bcand5e27a314a11f). It's possible that the interrupt-map parsing code can be factored to a common helper, but it's a bit hard to generalize from two examples to know what a good interface would look like.The interrupt-map-mask is a bit arbitrary.
0xffwould likely work just
as well (but I think the ls2088a has 32 external lines, so it has to be a least0x1f).Also, this drops the fsl,bit-reverse property and instead reads the SCFGREVCR register to determine if bit-reversing is needed.
The dt/bindings patch now comes first in accordance with
Documentation/devicetree/bindings/submitting-patches.txt.Earlier versions can be found here:
v6:
https://lore.kernel.org/lkml/[email protected]/
v5:https://lore.kernel.org/lkml/[email protected]/
Rasmus Villemoes (2):
dt/bindings: Add bindings for Layerscape external irqs
irqchip: add support for Layerscape external interrupt lines.../interrupt-controller/fsl,ls-extirq.txt | 49 +++++ drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ls-extirq.c | 197 ++++++++++++++++++ 4 files changed, 251 insertions(+) create mode 100644Quoted 2 lines
Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txtcreate mode 100644 drivers/irqchip/irq-ls-extirq.c
Quoted 7 lines
Applied to irqchip-next.
Thanks,
M.--
Jazz is not dead. It just smells funny...
A bit late, but for what it's worth,
Background: https://www.spinics.net/lists/netdev/msg611505.html
Thanks,
-Vladimir
Quoted 13 lines · Marc Zyngier
Quoted 11 lines · Rasmus Villemoes
Rasmus Villemoes (2):
dt/bindings: Add bindings for Layerscape external irqs
irqchip: add support for Layerscape external interrupt lines.../interrupt-controller/fsl,ls-extirq.txt | 49 +++++ drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ls-extirq.c | 197 ++++++++++++++++++
4 files changed, 251 insertions(+)create mode 100644
Quoted 4 lines
Quoted 2 lines
Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txtcreate mode 100644drivers/irqchip/irq-ls-extirq.cApplied to irqchip-next.
Thanks! Can I assume that branch doesn't get rebased so 87cd38dfd9e6 is a stable SHA1? I want to send a patch adding the node to ls1021a.dtsi, and I hope not to have to wait another release cycle.
Rasmus
Quoted 16 lines · Rasmus Villemoes
Quoted 15 lines · Marc Zyngier
Quoted 13 lines · Rasmus Villemoes
Rasmus Villemoes (2):
dt/bindings: Add bindings for Layerscape external irqs
irqchip: add support for Layerscape external interrupt lines.../interrupt-controller/fsl,ls-extirq.txt | 49 +++++ drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-ls-extirq.c | 197
++++++++++++++++++4 files changed, 251 insertions(+)create mode 100644
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txtcreate mode 100644drivers/irqchip/irq-ls-extirq.cApplied to irqchip-next.
Thanks! Can I assume that branch doesn't get rebased so
87cd38dfd9e6is a stable SHA1? I want to send a patch adding the node tols1021a.dtsi, and I hope not to have to wait another release cycle.
I usually try to avoid rebasing it, unless something really bad shows up.
Now, just adding a node to a DT shouldn't break anything, right? You should be able to do that change and get things working magically once this code hits mainline.
Or am I missing something?
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Quoted 9 lines · Marc Zyngier
Quoted 7 lines · Rasmus Villemoes
Quoted 1 line · Marc Zyngier
Applied to irqchip-next.
Thanks! Can I assume that branch doesn't get rebased so
87cd38dfd9e6is a stable SHA1? I want to send a patch adding the node tols1021a.dtsi, and I hope not to have to wait another release cycle.
Quoted 5 lines
I usually try to avoid rebasing it, unless something really bad shows up.
Now, just adding a node to a DT shouldn't break anything, right? You should be able to do that change and get things working magically once this code hits mainline.
Well, yes, but I wanted to refer to the binding documentation in the form of a reference to that SHA1. But I suppose I can just do that in the cover letter or below ---.
Thanks,
Rasmus