Skip to contentSkip to conversation

Add Mediatek CIRQ interrupt controller

PATCH Applied Youlin Pei 3 participants 7 messages Apr 7, 2017 – May 10, 2017

Subsystems (3)
lore
Share & tools
lore

Youlin Pei

author
#0 lore raw

v4 cover Add Mediatek CIRQ interrupt controller

In Mediatek SOCs, the CIRQ is a low power interrupt controller designed to works outside MCUSYS which comprises with Cortex-Ax cores,CCI and GIC.

The CIRQ controller is integrated in between MCUSYS and interrupt sources as the second level interrupt controller. The external interrupts which outside MCUSYS will feed through CIRQ then bypass to GIC.

In normal mode(where MCUSYS is active), CIRQ is disabled and interrupts will directly issue to MCUSYS. When MCUSYS enters sleep mode, where GIC is power downed. CIRQ will be enabled and monitor all edge trigger interrupts(only edge trigger interrupts will be lost in this scenario). When an edge interrupt is triggered, CIRQ will record the status and generated a pulse signal to GIC when flush command is executed.

With CIRQ, MCUSYS can be completely turned off to improve the system power consumption without losing interrupts.

change in v4:
1. add some comment to explain CIRQ suspend callback.
2. rebase on 4.11

change in v3:
1. add an explicit cirq range in DT and do the range check in driver.
2. change the option "mediatek,ext-irq-start" to s"mediatek,ext-irq-range".
3. remove mtk_cirq_eoi and clear the irq status in suspend callback.
4. remove some pure copy code.
5. rebase on 4.10-rc2.

change in v2:
1. fix coding style issue.
2. change the compatible string.
3. resolve IRQ offset at alloc time.
4. clear irq status in irq_eoi function.
5. rebase on 4.9-rc1.

v1:
http://lists.infradead.org/pipermail/linux-mediatek/2016-October/007213.html
v2:
http://lists.infradead.org/pipermail/linux-mediatek/2016-November/007350.html
v3:
http://lists.infradead.org/pipermail/linux-mediatek/2017-February/008134.html

Youlin Pei (3):
binding: irqchip: mtk-cirq: Add binding document
irqchip: mtk-cirq: Add mediatek mtk-cirq implement
ARM: dts: mt2701: Add mtk-cirq node for mt2701

author
#1 lore raw

PATCH v4 1/3 binding: irqchip: mtk-cirq: Add binding document

This commit adds the device tree binding document for the mediatek cirq.

---
 .../interrupt-controller/mediatek,cirq.txt         |   35 ++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/mediatek,cirq.txt
Documentation/devicetree/bindings/interrupt-controller/mediatek,cirq.txt new file +35 -0
new file mode 100644
index 0000000..a7efdbc
@@ -0,0 +1,35 @@
+* Mediatek 27xx cirq
+
+In Mediatek SOCs, the CIRQ is a low power interrupt controller designed to
+work outside MCUSYS which comprises with Cortex-Ax cores,CCI and GIC.
+The external interrupts (outside MCUSYS) will feed through CIRQ and connect
+to GIC in MCUSYS. When CIRQ is enabled, it will record the edge-sensitive
+interrupts and generate a pulse signal to parent interrupt controller when
+flush command is executed. With CIRQ, MCUSYS can be completely turned off
+to improve the system power consumption without losing interrupts.
+
+Required properties:
+- compatible: should be one of
+  - "mediatek,mt2701-cirq" for mt2701 CIRQ
+  - "mediatek,mt8135-cirq" for mt8135 CIRQ
+  - "mediatek,mt8173-cirq" for mt8173 CIRQ
+  and "mediatek,cirq" as a fallback.
+- interrupt-controller : Identifies the node as an interrupt controller.
+- #interrupt-cells : Use the same format as specified by GIC in arm,gic.txt.
+- interrupt-parent: phandle of irq parent for cirq. The parent must
+  use the same interrupt-cells format as GIC.
+- reg: Physical base address of the cirq registers and length of memory
+  mapped region.
+- mediatek,ext-irq-range: Identifies external irq number range in different
+  SOCs.
+
+Example:
+	cirq: interrupt-controller at 10204000 {
+		compatible = "mediatek,mt2701-cirq",
+			     "mediatek,mtk-cirq";
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		interrupt-parent = <&sysirq>;
+		reg = <0 0x10204000 0 0x400>;
+		mediatek,ext-irq-start = <32 200>;
+	};
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v4 2/3 irqchip: mtk-cirq: Add mediatek mtk-cirq implement

In reply to Youlin Pei

In Mediatek SOCs, the CIRQ is a low power interrupt controller designed to works outside MCUSYS which comprises with Cortex-Ax cores,CCI and GIC.

The CIRQ controller is integrated in between MCUSYS( include Cortex-Ax, CCI and GIC ) and interrupt sources as the second level interrupt controller. The external interrupts which outside MCUSYS will feed through CIRQ then bypass to GIC. CIRQ can monitors all edge trigger interupts. When an edge interrupt is triggered, CIRQ can record the status and generate a pulse signal to GIC when flush command executed.

When system enters sleep mode, MCUSYS will be turned off to improve power consumption, also GIC is power down. The edge trigger interrupts will be lost in this scenario without CIRQ.

This commit provides the CIRQ irqchip implement.

---
 drivers/irqchip/Makefile       |    2 +-
 drivers/irqchip/irq-mtk-cirq.c |  306 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 307 insertions(+), 1 deletion(-)
 create mode 100644 drivers/irqchip/irq-mtk-cirq.c
drivers/irqchip/Makefile +1 -1
index 152bc40..dc806f7 100644
@@ -62,7 +62,7 @@ obj-$(CONFIG_BCM7120_L2_IRQ)		+= irq-bcm7120-l2.o
 obj-$(CONFIG_BRCMSTB_L2_IRQ)		+= irq-brcmstb-l2.o
 obj-$(CONFIG_KEYSTONE_IRQ)		+= irq-keystone.o
 obj-$(CONFIG_MIPS_GIC)			+= irq-mips-gic.o
-obj-$(CONFIG_ARCH_MEDIATEK)		+= irq-mtk-sysirq.o
+obj-$(CONFIG_ARCH_MEDIATEK)		+= irq-mtk-sysirq.o irq-mtk-cirq.o
 obj-$(CONFIG_ARCH_DIGICOLOR)		+= irq-digicolor.o
 obj-$(CONFIG_RENESAS_H8300H_INTC)	+= irq-renesas-h8300h.o
 obj-$(CONFIG_RENESAS_H8S_INTC)		+= irq-renesas-h8s.o
drivers/irqchip/irq-mtk-cirq.c new file +306 -0

306 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v4 3/3 ARM: dts: mt2701: Add mtk-cirq node for mt2701

In reply to Youlin Pei

This commit add mtk-cirq node to mt2701 dtsi.

---
 arch/arm/boot/dts/mt2701.dtsi |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
arch/arm/boot/dts/mt2701.dtsi +11 -1
index 8037210..5daacfe 100644
@@ -22,7 +22,7 @@
 
 / {
 	compatible = "mediatek,mt2701";
-	interrupt-parent = <&sysirq>;
+	interrupt-parent = <&cirq>;
 
 	cpus {
 		#address-cells = <1>;
@@ -210,6 +210,16 @@
 		reg = <0 0x10200100 0 0x1c>;
 	};
 
+	cirq: interrupt-controller at 10204000 {
+		compatible = "mediatek,mt2701-cirq",
+			     "mediatek,mtk-cirq";
+		interrupt-controller;
+		#interrupt-cells = <3>;
+		interrupt-parent = <&sysirq>;
+		reg = <0 0x10204000 0 0x400>;
+		mediatek,ext-irq-range = <32 200>;
+	};
+
 	iommu: mmsys_iommu at 10205000 {
 		compatible = "mediatek,mt2701-m4u";
 		reg = <0 0x10205000 0 0x1000>;
Signature · 1 line
1.7.9.5
#4 lore raw
In reply to Youlin Pei
Quoted 14 lines · Youlin Pei

In Mediatek SOCs, the CIRQ is a low power interrupt controller designed to works outside MCUSYS which comprises with Cortex-Ax cores,CCI and GIC.

The CIRQ controller is integrated in between MCUSYS and interrupt sources as the second level interrupt controller. The external interrupts which outside MCUSYS will feed through CIRQ then bypass to GIC.

In normal mode(where MCUSYS is active), CIRQ is disabled and interrupts will directly issue to MCUSYS. When MCUSYS enters sleep mode, where GIC is power downed. CIRQ will be enabled and monitor all edge trigger interrupts(only edge trigger interrupts will be lost in this scenario). When an edge interrupt is triggered, CIRQ will record the status and generated a pulse signal to GIC when flush command is executed.

Quoted 6 lines

With CIRQ, MCUSYS can be completely turned off to improve the system power consumption without losing interrupts.

change in v4:
1. add some comment to explain CIRQ suspend callback.
2. rebase on 4.11

Hi Youlin,

I'm happy to take the first two patches through the irq tree. How do we deal with the third one? It seems to me that it'd be better routed via armsoc.

Let me know what you and Matthias want to do.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
author
#5 lore raw
Quoted 22 lines · Marc Zyngier
Quoted 14 lines · Youlin Pei

In Mediatek SOCs, the CIRQ is a low power interrupt controller designed to works outside MCUSYS which comprises with Cortex-Ax cores,CCI and GIC.

The CIRQ controller is integrated in between MCUSYS and interrupt sources as the second level interrupt controller. The external interrupts which outside MCUSYS will feed through CIRQ then bypass to GIC.

In normal mode(where MCUSYS is active), CIRQ is disabled and interrupts will directly issue to MCUSYS. When MCUSYS enters sleep mode, where GIC is power downed. CIRQ will be enabled and monitor all edge trigger interrupts(only edge trigger interrupts will be lost in this scenario). When an edge interrupt is triggered, CIRQ will record the status and generated a pulse signal to GIC when flush command is executed.

Quoted 6 lines

With CIRQ, MCUSYS can be completely turned off to improve the system power consumption without losing interrupts.

change in v4:
1. add some comment to explain CIRQ suspend callback.
2. rebase on 4.11

Quoted 7 lines

Hi Youlin,

I'm happy to take the first two patches through the irq tree. How do we deal with the third one? It seems to me that it'd be better routed via armsoc.

Let me know what you and Matthias want to do.

Hi Marc,

Thanks for your review. I think that driver and dtsi can merged separately.

Hi Matthias,
Could you help to review the dtsi patch?
Thanks a lot!

Quoted 4 lines

Thanks,

	M.
maintainer Applied
#6 lore raw
Quoted 31 lines · Youlin Pei
Quoted 22 lines · Marc Zyngier
Quoted 14 lines · Youlin Pei

In Mediatek SOCs, the CIRQ is a low power interrupt controller designed to works outside MCUSYS which comprises with Cortex-Ax cores,CCI and GIC.

The CIRQ controller is integrated in between MCUSYS and interrupt sources as the second level interrupt controller. The external interrupts which outside MCUSYS will feed through CIRQ then bypass to GIC.

In normal mode(where MCUSYS is active), CIRQ is disabled and interrupts will directly issue to MCUSYS. When MCUSYS enters sleep mode, where GIC is power downed. CIRQ will be enabled and monitor all edge trigger interrupts(only edge trigger interrupts will be lost in this scenario). When an edge interrupt is triggered, CIRQ will record the status and generated a pulse signal to GIC when flush command is executed.

Quoted 6 lines

With CIRQ, MCUSYS can be completely turned off to improve the system power consumption without losing interrupts.

change in v4:
1. add some comment to explain CIRQ suspend callback.
2. rebase on 4.11

Quoted 7 lines

Hi Youlin,

I'm happy to take the first two patches through the irq tree. How do we deal with the third one? It seems to me that it'd be better routed via armsoc.

Let me know what you and Matthias want to do.

Quoted 7 lines

Hi Marc,

Thanks for your review. I think that driver and dtsi can merged separately.

Hi Matthias,
Could you help to review the dtsi patch?

queued now for v4.12-next/dts32
sorry for the late answer.

Matthias

Quoted 8 lines

Thanks a lot!

Quoted 4 lines

Thanks,

	M.