Message ID | 20190923101513.32719-3-kurt@linutronix.de |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | Add support for Layerscape external interrupt lines | expand |
Context | Check | Description |
---|---|---|
robh/checkpatch | success |
On Mon, Sep 23, 2019 at 12:15:13PM +0200, Kurt Kanzenbach wrote: > From: Rasmus Villemoes <rasmus.villemoes@prevas.dk> > > This adds Device Tree binding documentation for the external interrupt > lines with configurable polarity present on some Layerscape SOCs. > > Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> > Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> > --- > > Changes since v5: > > - Add #address-cells and #size-cells to parent > - Mention LS2088A and the ISC unit Repeating some of my lost comments from v2 2 years ago... > > .../interrupt-controller/fsl,ls-extirq.txt | 47 +++++++++++++++++++ > 1 file changed, 47 insertions(+) > create mode 100644 Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt > > diff --git a/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt b/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt > new file mode 100644 > index 000000000000..7b53f9cc8019 > --- /dev/null > +++ b/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt > @@ -0,0 +1,47 @@ > +* Freescale Layerscape external IRQs > + > +Some Layerscape SOCs (LS1021A, LS1043A, LS1046A, LS2088A) 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) or the Interrupt Sampling > +Control (ISC) Unit. > + > +Required properties: > +- compatible: should be "fsl,<soc-name>-extirq", e.g. "fsl,ls1021a-extirq". > +- interrupt-controller: Identifies the node as an interrupt controller > +- #interrupt-cells: Must be 2. The first element is the index of the > + external interrupt line. The second element is the trigger type. > +- interrupt-parent: phandle of GIC. > +- reg: Specifies the Interrupt Polarity Control Register (INTPCR) in the SCFG. > +- fsl,extirq-map: Specifies the mapping to interrupt numbers in the parent > + interrupt controller. Interrupts are mapped one-to-one to parent > + interrupts. This should be an 'interrupt-map' instead. > + > +Optional properties: > +- fsl,bit-reverse: This boolean property should be set on the LS1021A > + if the SCFGREVCR register has been set to all-ones (which is usually > + the case), meaning that all reads and writes of SCFG registers are > + implicitly bit-reversed. Other compatible platforms do not have such > + a register. Couldn't you just read that register and tell? Does this apply to only the extirq register or all of scfg? > + > +Example: > + scfg: scfg@1570000 { > + compatible = "fsl,ls1021a-scfg", "syscon"; > + #address-cells = <1>; > + #size-cells = <0>; As the child node(s) are memory mapped, this should not be 0. And you need 'ranges'. > + ... > + extirq: interrupt-controller { > + compatible = "fsl,ls1021a-extirq"; > + #interrupt-cells = <2>; > + interrupt-controller; > + interrupt-parent = <&gic>; > + reg = <0x1ac>; > + fsl,extirq-map = <163 164 165 167 168 169>; > + fsl,bit-reverse; > + }; > + }; > + > + > + interrupts-extended = <&gic GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, > + <&extirq 1 IRQ_TYPE_LEVEL_LOW>; > -- > 2.20.1 >
On 27/09/2019 18.11, Rob Herring wrote: > On Mon, Sep 23, 2019 at 12:15:13PM +0200, Kurt Kanzenbach wrote: >> From: Rasmus Villemoes <rasmus.villemoes@prevas.dk> >> >> This adds Device Tree binding documentation for the external interrupt >> lines with configurable polarity present on some Layerscape SOCs. >> >> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> >> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> >> --- >> >> +* Freescale Layerscape external IRQs >> + >> +Some Layerscape SOCs (LS1021A, LS1043A, LS1046A, LS2088A) 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) or the Interrupt Sampling >> +Control (ISC) Unit. >> + >> +Required properties: >> +- compatible: should be "fsl,<soc-name>-extirq", e.g. "fsl,ls1021a-extirq". >> +- interrupt-controller: Identifies the node as an interrupt controller >> +- #interrupt-cells: Must be 2. The first element is the index of the >> + external interrupt line. The second element is the trigger type. >> +- interrupt-parent: phandle of GIC. >> +- reg: Specifies the Interrupt Polarity Control Register (INTPCR) in the SCFG. >> +- fsl,extirq-map: Specifies the mapping to interrupt numbers in the parent >> + interrupt controller. Interrupts are mapped one-to-one to parent >> + interrupts. > > This should be an 'interrupt-map' instead. Rob, thanks for your review comments. I know you said the same thing at v5, and it might seem like they are ignored. However, I asked a couple of followup questions (https://lore.kernel.org/lkml/0bb4533d-c749-d8ff-e1f2-4b08eb724713@prevas.dk/). I'd really appreciate it if you could (a) point to some documentation on how to write that interrupt-map and (b) explain how this is different from the Qualcomm PDC case I tried to copy and which had your Reviewed-By. >> + >> +Optional properties: >> +- fsl,bit-reverse: This boolean property should be set on the LS1021A >> + if the SCFGREVCR register has been set to all-ones (which is usually >> + the case), meaning that all reads and writes of SCFG registers are >> + implicitly bit-reversed. Other compatible platforms do not have such >> + a register. > > Couldn't you just read that register and tell? In theory, yes, but as far as I understand (and as I wrote) it's specific to the ls1021a. Of course one can decide whether it's necessary/possible to read it based on the compatible string, but one would also need an extra reg property to have its address - but that register is not really part of the extirq "device" we're trying to describe. So would it need to be represented as its own subnode of scfg? If it is set at all, it's done within the first few instructions after reset (before control is even handed to the bootloader), so I see it as a kind of quirk of the hardware. The data sheet says "SCFG bit reverse (SCFG_SCFGREVCR) must be written 0xFFFF_FFFF as a part of initialization sequence before writing to any other SCFG register." which, taken literally, means we don't need the property at all and can just assume it for the ls1021a (i.e., do it based on compatible string alone) - but I think it should be read as "if you're going to write this register, it must be done first thing". > Does this apply to only the extirq register or all of scfg? All of scfg. It really seems like some accident/bad joke coming out of a discussion between a hardware and software engineer on the enumeration of bits, with the hardware guy ending up saying "alright, have it whichever way you want it", causing even more pain :( >> + >> +Example: >> + scfg: scfg@1570000 { >> + compatible = "fsl,ls1021a-scfg", "syscon"; >> + #address-cells = <1>; >> + #size-cells = <0>; > > As the child node(s) are memory mapped, this should not be 0. And you > need 'ranges'. Indeed - I think I understand this a little better now than I did back then. Thanks, Rasmus
On Fri, Sep 27, 2019 at 09:16:50PM +0000, Rasmus Villemoes wrote: > On 27/09/2019 18.11, Rob Herring wrote: > > On Mon, Sep 23, 2019 at 12:15:13PM +0200, Kurt Kanzenbach wrote: > >> +Required properties: > >> +- compatible: should be "fsl,<soc-name>-extirq", e.g. "fsl,ls1021a-extirq". > >> +- interrupt-controller: Identifies the node as an interrupt controller > >> +- #interrupt-cells: Must be 2. The first element is the index of the > >> + external interrupt line. The second element is the trigger type. > >> +- interrupt-parent: phandle of GIC. > >> +- reg: Specifies the Interrupt Polarity Control Register (INTPCR) in the SCFG. > >> +- fsl,extirq-map: Specifies the mapping to interrupt numbers in the parent > >> + interrupt controller. Interrupts are mapped one-to-one to parent > >> + interrupts. > > > > This should be an 'interrupt-map' instead. > > Rob, thanks for your review comments. I know you said the same thing at > v5, and it might seem like they are ignored. Well, I didn't ignore them. It just wasn't clear to me from the previous discussions which way you want to go. > However, I asked a couple of followup questions > (https://lore.kernel.org/lkml/0bb4533d-c749-d8ff-e1f2-4b08eb724713@prevas.dk/). > I'd really appreciate it if you could (a) point to some documentation > on how to write that interrupt-map and (b) explain how this is > different from the Qualcomm PDC case I tried to copy and which had > your Reviewed-By. I guess, we can have a look at other interrupt controllers and how they handle the interrupt-map property. For example: https://www.kernel.org/doc/Documentation/devicetree/bindings/interrupt-controller/renesas,rza1-irqc.txt I need to send a v7 anyway, because I forgot to include the SOC_LS1021A in the build process. > > >> + > >> +Optional properties: > >> +- fsl,bit-reverse: This boolean property should be set on the LS1021A > >> + if the SCFGREVCR register has been set to all-ones (which is usually > >> + the case), meaning that all reads and writes of SCFG registers are > >> + implicitly bit-reversed. Other compatible platforms do not have such > >> + a register. > > > > Couldn't you just read that register and tell? > > In theory, yes, but as far as I understand (and as I wrote) it's > specific to the ls1021a. Of course one can decide whether it's > necessary/possible to read it based on the compatible string, but one > would also need an extra reg property to have its address - but that > register is not really part of the extirq "device" we're trying to > describe. So would it need to be represented as its own subnode of scfg? Keep in mind, that not all Layerscapes have that feature and the corresponding register. As you said that may be handled via compatible string. However, the bit-reverse property looks like the simplest solution to me. > > If it is set at all, it's done within the first few instructions after > reset (before control is even handed to the bootloader), so I see it as > a kind of quirk of the hardware. The data sheet says "SCFG bit reverse > (SCFG_SCFGREVCR) must be written 0xFFFF_FFFF as a part of initialization > sequence before writing to any other SCFG register." which, taken > literally, means we don't need the property at all and can just assume > it for the ls1021a (i.e., do it based on compatible string alone) - but > I think it should be read as "if you're going to write this register, it > must be done first thing". > > > Does this apply to only the extirq register or all of scfg? > > All of scfg. It really seems like some accident/bad joke coming out of a > discussion between a hardware and software engineer on the enumeration > of bits, with the hardware guy ending up saying "alright, have it > whichever way you want it", causing even more pain :( > > >> + > >> +Example: > >> + scfg: scfg@1570000 { > >> + compatible = "fsl,ls1021a-scfg", "syscon"; > >> + #address-cells = <1>; > >> + #size-cells = <0>; > > > > As the child node(s) are memory mapped, this should not be 0. And you > > need 'ranges'. > > Indeed - I think I understand this a little better now than I did back then. > Okay. > Thanks, > Rasmus Thanks, Kurt
On Fri, Sep 27, 2019 at 4:16 PM Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote: > > On 27/09/2019 18.11, Rob Herring wrote: > > On Mon, Sep 23, 2019 at 12:15:13PM +0200, Kurt Kanzenbach wrote: > >> From: Rasmus Villemoes <rasmus.villemoes@prevas.dk> > >> > >> This adds Device Tree binding documentation for the external interrupt > >> lines with configurable polarity present on some Layerscape SOCs. > >> > >> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> > >> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de> > >> --- > >> > >> +* Freescale Layerscape external IRQs > >> + > >> +Some Layerscape SOCs (LS1021A, LS1043A, LS1046A, LS2088A) 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) or the Interrupt Sampling > >> +Control (ISC) Unit. > >> + > >> +Required properties: > >> +- compatible: should be "fsl,<soc-name>-extirq", e.g. "fsl,ls1021a-extirq". > >> +- interrupt-controller: Identifies the node as an interrupt controller > >> +- #interrupt-cells: Must be 2. The first element is the index of the > >> + external interrupt line. The second element is the trigger type. > >> +- interrupt-parent: phandle of GIC. > >> +- reg: Specifies the Interrupt Polarity Control Register (INTPCR) in the SCFG. > >> +- fsl,extirq-map: Specifies the mapping to interrupt numbers in the parent > >> + interrupt controller. Interrupts are mapped one-to-one to parent > >> + interrupts. > > > > This should be an 'interrupt-map' instead. > > Rob, thanks for your review comments. I know you said the same thing at > v5, and it might seem like they are ignored. However, I asked a couple > of followup questions > (https://lore.kernel.org/lkml/0bb4533d-c749-d8ff-e1f2-4b08eb724713@prevas.dk/). > I'd really appreciate it if you could (a) point to some documentation on > how to write that interrupt-map and (b) explain how this is different > from the Qualcomm PDC case I tried to copy and which had your Reviewed-By. https://www.devicetree.org/specifications/ https://elinux.org/Device_Tree_Usage#Advanced_Interrupt_Mapping For QC PDC, it could be a large number of interrupts to remap which interrupt-map doesn't scale to very well. Also, I think it sits in parallel to the GIC rather than downstream. The interrupt binding doesn't really have a way to express that. > >> +Optional properties: > >> +- fsl,bit-reverse: This boolean property should be set on the LS1021A > >> + if the SCFGREVCR register has been set to all-ones (which is usually > >> + the case), meaning that all reads and writes of SCFG registers are > >> + implicitly bit-reversed. Other compatible platforms do not have such > >> + a register. > > > > Couldn't you just read that register and tell? > > In theory, yes, but as far as I understand (and as I wrote) it's > specific to the ls1021a. Of course one can decide whether it's > necessary/possible to read it based on the compatible string, but one > would also need an extra reg property to have its address - but that > register is not really part of the extirq "device" we're trying to > describe. So would it need to be represented as its own subnode of scfg? Why? You should know where the register is because you know what chip you are on (from the compatible). > > If it is set at all, it's done within the first few instructions after > reset (before control is even handed to the bootloader), so I see it as > a kind of quirk of the hardware. The data sheet says "SCFG bit reverse > (SCFG_SCFGREVCR) must be written 0xFFFF_FFFF as a part of initialization > sequence before writing to any other SCFG register." which, taken > literally, means we don't need the property at all and can just assume > it for the ls1021a (i.e., do it based on compatible string alone) - but > I think it should be read as "if you're going to write this register, it > must be done first thing". > > > Does this apply to only the extirq register or all of scfg? > > All of scfg. It really seems like some accident/bad joke coming out of a > discussion between a hardware and software engineer on the enumeration > of bits, with the hardware guy ending up saying "alright, have it > whichever way you want it", causing even more pain :( If all of the scfg bits change, then if you have this property, it should be in the scfg node. But I prefer you use the compatible instead if that works. Rob
diff --git a/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt b/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt new file mode 100644 index 000000000000..7b53f9cc8019 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/fsl,ls-extirq.txt @@ -0,0 +1,47 @@ +* Freescale Layerscape external IRQs + +Some Layerscape SOCs (LS1021A, LS1043A, LS1046A, LS2088A) 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) or the Interrupt Sampling +Control (ISC) Unit. + +Required properties: +- compatible: should be "fsl,<soc-name>-extirq", e.g. "fsl,ls1021a-extirq". +- interrupt-controller: Identifies the node as an interrupt controller +- #interrupt-cells: Must be 2. The first element is the index of the + external interrupt line. The second element is the trigger type. +- interrupt-parent: phandle of GIC. +- reg: Specifies the Interrupt Polarity Control Register (INTPCR) in the SCFG. +- fsl,extirq-map: Specifies the mapping to interrupt numbers in the parent + interrupt controller. Interrupts are mapped one-to-one to parent + interrupts. + +Optional properties: +- fsl,bit-reverse: This boolean property should be set on the LS1021A + if the SCFGREVCR register has been set to all-ones (which is usually + the case), meaning that all reads and writes of SCFG registers are + implicitly bit-reversed. Other compatible platforms do not have such + a register. + +Example: + scfg: scfg@1570000 { + compatible = "fsl,ls1021a-scfg", "syscon"; + #address-cells = <1>; + #size-cells = <0>; + ... + extirq: interrupt-controller { + compatible = "fsl,ls1021a-extirq"; + #interrupt-cells = <2>; + interrupt-controller; + interrupt-parent = <&gic>; + reg = <0x1ac>; + fsl,extirq-map = <163 164 165 167 168 169>; + fsl,bit-reverse; + }; + }; + + + interrupts-extended = <&gic GIC_SPI 88 IRQ_TYPE_LEVEL_HIGH>, + <&extirq 1 IRQ_TYPE_LEVEL_LOW>;