Hi All,
The RZ/G2L Interrupt Controller is a front-end for the GIC found on
Renesas RZ/G2L SoC's with below pins:
- IRQ sense select for 8 external interrupts, mapped to 8 GIC SPI interrupts
- GPIO pins used as external interrupt input pins out of GPIOINT0-122 a
maximum of only 32 can be mapped to 32 GIC SPI interrupts,
- NMI edge select.
_____________
| GIC |
| ________ |
____________ | | | |
NMI ------------------------------------>| | SPI0-479 | | GIC-600| |
_______ | |------------>| | |
| | | | PPI16-31 | | | |
| | IRQ0-IRQ7 | IRQC |------------>| | |
P0_P48_4 ------>| GPIO |---------------->| | | |________| |
| |GPIOINT0-122 | | | |
| |---------------->| TINT0-31 | | |
|______| |__________| |____________|
The proposed patches add hierarchical IRQ domain, one in IRQC driver and another in
pinctrl driver. Upon interrupt requests map the interrupt to GIC. Out of GPIOINT0-122
only 32 can be mapped to GIC SPI, this mapping is handled by the pinctrl and IRQC driver.
Cheers,
Prabhakar
Changes for RFCV4 -> V1:
* Used unevaluatedProperties.
* Altered the sequence of reg property
* Set the parent type
* Used raw_spin_lock() instead of raw_spin_lock_irqsave()
* Simplified parsing IRQ map.
* Will send the GPIO and pinctrl changes as part of separate series
Changes for v4:
* Used locking while RMW
* Now using interrupts property instead of interrupt-map
* Patch series depends on [0]
* Updated binding doc
* Fixed comments pointed by Andy
[0] https://patchwork.kernel.org/project/linux-renesas-soc/patch/
20220316200633.28974-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
Changes for v3:
-> Re-structured the driver as a hierarchical irq domain instead of chained
-> made use of IRQCHIP_* macros
-> dropped locking
-> Added support for IRQ0-7 interrupts
-> Introduced 2 new patches for GPIOLIB
-> Switched to using GPIOLIB for irqdomains in pinctrl
RFC v2: https://patchwork.kernel.org/project/linux-renesas-soc/cover/
20210921193028.13099-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
RFC v1: https://patchwork.kernel.org/project/linux-renesas-soc/cover/
20210803175109.1729-1-prabhakar.mahadev-lad.rj@bp.renesas.com/
Lad Prabhakar (2):
dt-bindings: interrupt-controller: Add Renesas RZ/G2L Interrupt
Controller
irqchip: Add RZ/G2L IA55 Interrupt Controller driver
.../renesas,rzg2l-irqc.yaml | 131 +++++
drivers/irqchip/Kconfig | 8 +
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-renesas-rzg2l.c | 447 ++++++++++++++++++
4 files changed, 587 insertions(+)
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,rzg2l-irqc.yaml
create mode 100644 drivers/irqchip/irq-renesas-rzg2l.c
--
2.17.1
Add a driver for the Renesas RZ/G2L Interrupt Controller.
This supports external pins being used as interrupts. It supports
one line for NMI, 8 external pins and 32 GPIO pins (out of 123)
to be used as IRQ lines.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
drivers/irqchip/Kconfig | 8 +
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-renesas-rzg2l.c | 447 ++++++++++++++++++++++++++++
3 files changed, 456 insertions(+)
create mode 100644 drivers/irqchip/irq-renesas-rzg2l.c
@@ -0,0 +1,131 @@+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/interrupt-controller/renesas,rzg2l-irqc.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Renesas RZ/G2L (and alike SoC's) Interrupt Controller (IA55)++maintainers:+-Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>+-Geert Uytterhoeven <geert+renesas@glider.be>++description:|+IA55 performs various interrupt controls including synchronization for the external+interrupts of NMI, IRQ, and GPIOINT and the interrupts of the built-in peripheral+interrupts output by each IP. And it notifies the interrupt to the GIC+-IRQ sense select for 8 external interrupts, mapped to 8 GIC SPI interrupts+-GPIO pins used as external interrupt input pins, mapped to 32 GIC SPI interrupts+-NMI edge select (NMI is not treated as NMI exception and supports fall edge and+stand-up edge detection interrupts)++allOf:+-$ref:/schemas/interrupt-controller.yaml#++properties:+compatible:+items:+-enum:+-renesas,r9a07g044-irqc# RZ/G2L+-const:renesas,rzg2l-irqc++'#interrupt-cells':+const:2
What is the meaning of the cells? IRQ number + flags, I assume?
How are the numbers mapped, do you need a DT bindings header?
Perhaps it would make sense to increase to 3 cells, so you can use
one cell for the type (cfr. e.g. GIC_SPI), and the second for the
plain index within the type?
The rest LGTM, but I'm not an interrupt expert, so I'm curious in
hearing Marc's opinion.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi Prabhakar,
On Fri, Apr 22, 2022 at 12:12 AM Lad Prabhakar
[off-list ref] wrote:
Add a driver for the Renesas RZ/G2L Interrupt Controller.
This supports external pins being used as interrupts. It supports
one line for NMI, 8 external pins and 32 GPIO pins (out of 123)
to be used as IRQ lines.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
= IRQC_TINT_START + IRQC_TINT_COUNT
Should these be in a DT binding header file?
Combining all types into a single linear number space makes it hard
to extend the range, when reusing for an SoC that supports more
interrupt sources.
As writes to the unused upper bits are ignored, you can drop the
masking with GENMASK(IRQC_IRQ_COUNT - 1, 0), and be prepared for more
interrupt sources.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
@@ -0,0 +1,131 @@+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/interrupt-controller/renesas,rzg2l-irqc.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Renesas RZ/G2L (and alike SoC's) Interrupt Controller (IA55)++maintainers:+-Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>+-Geert Uytterhoeven <geert+renesas@glider.be>++description:|+IA55 performs various interrupt controls including synchronization for the external+interrupts of NMI, IRQ, and GPIOINT and the interrupts of the built-in peripheral+interrupts output by each IP. And it notifies the interrupt to the GIC+-IRQ sense select for 8 external interrupts, mapped to 8 GIC SPI interrupts+-GPIO pins used as external interrupt input pins, mapped to 32 GIC SPI interrupts+-NMI edge select (NMI is not treated as NMI exception and supports fall edge and+stand-up edge detection interrupts)++allOf:+-$ref:/schemas/interrupt-controller.yaml#++properties:+compatible:+items:+-enum:+-renesas,r9a07g044-irqc# RZ/G2L+-const:renesas,rzg2l-irqc++'#interrupt-cells':+const:2
What is the meaning of the cells? IRQ number + flags, I assume?
IRQ number and the type.
How are the numbers mapped, do you need a DT bindings header?
No, just plain numbers are used (driver handles the validation of the
interrupt numbering), for example like below,
ð0 {
...
status = "okay";
phy0: ethernet-phy@7 {
compatible = "ethernet-phy-id0022.1640",
"ethernet-phy-ieee802.3-c22";
reg = <7>;
interrupt-parent = <&irqc>;
interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
...
};
};
And for the GPIO:
key-1 {
gpios = <&pinctrl RZG2L_GPIO(43, 0) GPIO_ACTIVE_HIGH>;
linux,code = <KEY_1>;
linux,input-type = <EV_KEY>;
wakeup-source;
label = "SW1";
};
Perhaps it would make sense to increase to 3 cells, so you can use
one cell for the type (cfr. e.g. GIC_SPI), and the second for the
plain index within the type?
Could you please elaborate on this. Are you referring to the type here
as the type to be set up in the GIC?
Cheers,
Prabhakar
The rest LGTM, but I'm not an interrupt expert, so I'm curious in
hearing Marc's opinion.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
@@ -0,0 +1,131 @@+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/interrupt-controller/renesas,rzg2l-irqc.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Renesas RZ/G2L (and alike SoC's) Interrupt Controller (IA55)++maintainers:+-Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>+-Geert Uytterhoeven <geert+renesas@glider.be>++description:|+IA55 performs various interrupt controls including synchronization for the external+interrupts of NMI, IRQ, and GPIOINT and the interrupts of the built-in peripheral+interrupts output by each IP. And it notifies the interrupt to the GIC+-IRQ sense select for 8 external interrupts, mapped to 8 GIC SPI interrupts+-GPIO pins used as external interrupt input pins, mapped to 32 GIC SPI interrupts+-NMI edge select (NMI is not treated as NMI exception and supports fall edge and+stand-up edge detection interrupts)++allOf:+-$ref:/schemas/interrupt-controller.yaml#++properties:+compatible:+items:+-enum:+-renesas,r9a07g044-irqc# RZ/G2L+-const:renesas,rzg2l-irqc++'#interrupt-cells':+const:2
What is the meaning of the cells? IRQ number + flags, I assume?
IRQ number and the type.
quoted
How are the numbers mapped, do you need a DT bindings header?
No, just plain numbers are used (driver handles the validation of the
interrupt numbering), for example like below,
ð0 {
...
status = "okay";
phy0: ethernet-phy@7 {
compatible = "ethernet-phy-id0022.1640",
"ethernet-phy-ieee802.3-c22";
reg = <7>;
interrupt-parent = <&irqc>;
interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
OK, so the number must be an external interrupt number (0..7).
...
};
};
And for the GPIO:
key-1 {
gpios = <&pinctrl RZG2L_GPIO(43, 0) GPIO_ACTIVE_HIGH>;
linux,code = <KEY_1>;
linux,input-type = <EV_KEY>;
wakeup-source;
label = "SW1";
};
OK, so in this case the interrupt number is obtained implicitly, and
no interrupts property is used.
quoted
Perhaps it would make sense to increase to 3 cells, so you can use
one cell for the type (cfr. e.g. GIC_SPI), and the second for the
plain index within the type?
Could you please elaborate on this. Are you referring to the type here
as the type to be set up in the GIC?
Please ignore, you don't need the type, as it's always an external
interrupt number, right?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi Geert,
Thank you for the review.
On Thu, Apr 28, 2022 at 10:42 AM Geert Uytterhoeven
[off-list ref] wrote:
Hi Prabhakar,
On Fri, Apr 22, 2022 at 12:12 AM Lad Prabhakar
[off-list ref] wrote:
quoted
Add a driver for the Renesas RZ/G2L Interrupt Controller.
This supports external pins being used as interrupts. It supports
one line for NMI, 8 external pins and 32 GPIO pins (out of 123)
to be used as IRQ lines.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Should these be in a DT binding header file?
Combining all types into a single linear number space makes it hard
to extend the range, when reusing for an SoC that supports more
interrupt sources.
As writes to the unused upper bits are ignored, you can drop the
masking with GENMASK(IRQC_IRQ_COUNT - 1, 0), and be prepared for more
interrupt sources.
You mean instead of a mask just use the reg instead?
Cheers,
Prabhakar
quoted
+ priv->base + TSCR);
+}
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
@@ -0,0 +1,131 @@+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)+%YAML1.2+---+$id:http://devicetree.org/schemas/interrupt-controller/renesas,rzg2l-irqc.yaml#+$schema:http://devicetree.org/meta-schemas/core.yaml#++title:Renesas RZ/G2L (and alike SoC's) Interrupt Controller (IA55)++maintainers:+-Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>+-Geert Uytterhoeven <geert+renesas@glider.be>++description:|+IA55 performs various interrupt controls including synchronization for the external+interrupts of NMI, IRQ, and GPIOINT and the interrupts of the built-in peripheral+interrupts output by each IP. And it notifies the interrupt to the GIC+-IRQ sense select for 8 external interrupts, mapped to 8 GIC SPI interrupts+-GPIO pins used as external interrupt input pins, mapped to 32 GIC SPI interrupts+-NMI edge select (NMI is not treated as NMI exception and supports fall edge and+stand-up edge detection interrupts)++allOf:+-$ref:/schemas/interrupt-controller.yaml#++properties:+compatible:+items:+-enum:+-renesas,r9a07g044-irqc# RZ/G2L+-const:renesas,rzg2l-irqc++'#interrupt-cells':+const:2
What is the meaning of the cells? IRQ number + flags, I assume?
IRQ number and the type.
quoted
How are the numbers mapped, do you need a DT bindings header?
No, just plain numbers are used (driver handles the validation of the
interrupt numbering), for example like below,
ð0 {
...
status = "okay";
phy0: ethernet-phy@7 {
compatible = "ethernet-phy-id0022.1640",
"ethernet-phy-ieee802.3-c22";
reg = <7>;
interrupt-parent = <&irqc>;
interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
OK, so the number must be an external interrupt number (0..7).
Yep that's right.
quoted
...
};
};
And for the GPIO:
key-1 {
gpios = <&pinctrl RZG2L_GPIO(43, 0) GPIO_ACTIVE_HIGH>;
linux,code = <KEY_1>;
linux,input-type = <EV_KEY>;
wakeup-source;
label = "SW1";
};
OK, so in this case the interrupt number is obtained implicitly, and
no interrupts property is used.
Indeed.
quoted
quoted
Perhaps it would make sense to increase to 3 cells, so you can use
one cell for the type (cfr. e.g. GIC_SPI), and the second for the
plain index within the type?
Could you please elaborate on this. Are you referring to the type here
as the type to be set up in the GIC?
Please ignore, you don't need the type, as it's always an external
interrupt number, right?
Yep that's right.
Cheers,
Prabhakar
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi Prabhakar,
On Fri, Apr 29, 2022 at 11:43 AM Lad, Prabhakar
[off-list ref] wrote:
On Thu, Apr 28, 2022 at 10:42 AM Geert Uytterhoeven
[off-list ref] wrote:
quoted
On Fri, Apr 22, 2022 at 12:12 AM Lad Prabhakar
[off-list ref] wrote:
quoted
Add a driver for the Renesas RZ/G2L Interrupt Controller.
This supports external pins being used as interrupts. It supports
one line for NMI, 8 external pins and 32 GPIO pins (out of 123)
to be used as IRQ lines.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Should these be in a DT binding header file?
Combining all types into a single linear number space makes it hard
to extend the range, when reusing for an SoC that supports more
interrupt sources.
Or DT data maybe?
Let's leave it for now. As I missed that DT consumers will refer to
external interrupt numbers only (is that actually enforced?), there
won't be an issue.
The driver can be changed later to derive IRQC_IRQ_COUNT from the
compatible value, when needed.
As writes to the unused upper bits are ignored, you can drop the
masking with GENMASK(IRQC_IRQ_COUNT - 1, 0), and be prepared for more
interrupt sources.
You mean instead of a mask just use the reg instead?
No, I meant to drop the masking with GENMASK(IRQC_TINT_COUNT - 1, 0),
cfr. for external interrupts.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi Geert,
On Fri, Apr 29, 2022 at 10:53 AM Geert Uytterhoeven
[off-list ref] wrote:
Hi Prabhakar,
On Fri, Apr 29, 2022 at 11:43 AM Lad, Prabhakar
[off-list ref] wrote:
quoted
On Thu, Apr 28, 2022 at 10:42 AM Geert Uytterhoeven
[off-list ref] wrote:
quoted
On Fri, Apr 22, 2022 at 12:12 AM Lad Prabhakar
[off-list ref] wrote:
quoted
Add a driver for the Renesas RZ/G2L Interrupt Controller.
This supports external pins being used as interrupts. It supports
one line for NMI, 8 external pins and 32 GPIO pins (out of 123)
to be used as IRQ lines.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Should these be in a DT binding header file?
Combining all types into a single linear number space makes it hard
to extend the range, when reusing for an SoC that supports more
interrupt sources.
Or DT data maybe?
Let's leave it for now. As I missed that DT consumers will refer to
external interrupt numbers only (is that actually enforced?), there
won't be an issue.
The driver can be changed later to derive IRQC_IRQ_COUNT from the
compatible value, when needed.
As writes to the unused upper bits are ignored, you can drop the
masking with GENMASK(IRQC_IRQ_COUNT - 1, 0), and be prepared for more
interrupt sources.
You mean instead of a mask just use the reg instead?
No, I meant to drop the masking with GENMASK(IRQC_TINT_COUNT - 1, 0),
cfr. for external interrupts.
Ahh right, I missed that.
Cheers,
Prabhakar
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi Geert,
On Fri, Apr 29, 2022 at 10:59 AM Lad, Prabhakar
[off-list ref] wrote:
Hi Geert,
On Fri, Apr 29, 2022 at 10:53 AM Geert Uytterhoeven
[off-list ref] wrote:
quoted
Hi Prabhakar,
On Fri, Apr 29, 2022 at 11:43 AM Lad, Prabhakar
[off-list ref] wrote:
quoted
On Thu, Apr 28, 2022 at 10:42 AM Geert Uytterhoeven
[off-list ref] wrote:
quoted
On Fri, Apr 22, 2022 at 12:12 AM Lad Prabhakar
[off-list ref] wrote:
quoted
Add a driver for the Renesas RZ/G2L Interrupt Controller.
This supports external pins being used as interrupts. It supports
one line for NMI, 8 external pins and 32 GPIO pins (out of 123)
to be used as IRQ lines.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Should these be in a DT binding header file?
Combining all types into a single linear number space makes it hard
to extend the range, when reusing for an SoC that supports more
interrupt sources.
Or DT data maybe?
Let's leave it for now. As I missed that DT consumers will refer to
external interrupt numbers only (is that actually enforced?), there
won't be an issue.
The driver can be changed later to derive IRQC_IRQ_COUNT from the
compatible value, when needed.
As writes to the unused upper bits are ignored, you can drop the
masking with GENMASK(IRQC_IRQ_COUNT - 1, 0), and be prepared for more
interrupt sources.