Re: [RFC PATCH v4 12/13] irqchip: ti-sci-inta: Add support for Interrupt Aggregator driver

From: Lokesh Vutla
Date: Wed Jan 02 2019 - 07:27:39 EST

Hi Peter,

On 02/01/19 5:19 PM, Peter Ujfalusi wrote:

On 27/12/2018 8.13, Lokesh Vutla wrote:
Texas Instruments' K3 generation SoCs has an IP Interrupt Aggregator
which is an interrupt controller that does the following:
- Converts events to interrupts that can be understood by
an interrupt router.
- Allows for multiplexing of events to interrupts.

Configuration of the interrupt aggregator registers can only be done by
a system co-processor and the driver needs to send a message to this
co processor over TISCI protocol.

Add support for Interrupt Aggregator driver over TISCI protocol.

Signed-off-by: Lokesh Vutla <lokeshvutla@xxxxxx>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
drivers/irqchip/Kconfig | 12 +
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-ti-sci-inta.c | 561 ++++++++++++++++++++++++++++++
4 files changed, 575 insertions(+)
create mode 100644 drivers/irqchip/irq-ti-sci-inta.c

index aebce615151e..7d12788c844a 100644
@@ -15026,6 +15026,7 @@ F: drivers/reset/reset-ti-sci.c
F: Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
F: Documentation/devicetree/bindings/interrupt-controller/ti,sci-inta.txt
F: drivers/irqchip/irq-ti-sci-intr.c
+F: drivers/irqchip/irq-ti-sci-inta.c
Texas Instruments ASoC drivers
M: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index a8d9bed0254b..d16fd39408ad 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -417,6 +417,18 @@ config TI_SCI_INTR_IRQCHIP
If you wish to use interrupt router irq resources managed by the
TI System Controller, say Y here. Otherwise, say N.
+ bool
+ depends on TI_SCI_PROTOCOL && ARCH_K3
+ select IRQ_DOMAIN
+ help
+ This enables the irqchip driver support for K3 Interrupt aggregator
+ over TI System Control Interface available on some new TI's SoCs.
+ If you wish to use interrupt aggregator irq resources managed by the
+ TI System Controller, say Y here. Otherwise, say N.
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index b4ff376a08ef..a679490a7059 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -95,3 +95,4 @@ obj-$(CONFIG_SIFIVE_PLIC) += irq-sifive-plic.o
obj-$(CONFIG_IMX_IRQSTEER) += irq-imx-irqsteer.o
obj-$(CONFIG_MADERA_IRQ) += irq-madera.o
obj-$(CONFIG_TI_SCI_INTR_IRQCHIP) += irq-ti-sci-intr.o
+obj-$(CONFIG_TI_SCI_INTA_IRQCHIP) += irq-ti-sci-inta.o
diff --git a/drivers/irqchip/irq-ti-sci-inta.c b/drivers/irqchip/irq-ti-sci-inta.c
new file mode 100644
index 000000000000..78bfc83a079a
--- /dev/null
+++ b/drivers/irqchip/irq-ti-sci-inta.c
@@ -0,0 +1,561 @@
+// SPDX-License-Identifier: GPL-2.0
+ * Texas Instruments' K3 Interrupt Aggregator irqchip driver
+ *
+ * Copyright (C) 2018 Texas Instruments Incorporated -
+ * Lokesh Vutla <lokeshvutla@xxxxxx>
+ */
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/msi.h>
+#include <linux/irqchip.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/irqdomain.h>

To fix this:

drivers/irqchip/irq-ti-sci-inta.c: In function âinta_msi_irq_handlerâ:
drivers/irqchip/irq-ti-sci-inta.c:308:8: error: âIRQF_TRIGGER_HIGHâ undeclared (first use in this function); did you mean âIRQD_TRIGGER_MASKâ?
drivers/irqchip/irq-ti-sci-inta.c:308:8: note: each undeclared identifier is reported only once for each function it appears in
drivers/irqchip/irq-ti-sci-inta.c: In function âti_sci_inta_alloc_parent_irqâ:
drivers/irqchip/irq-ti-sci-inta.c:360:27: error: âIRQF_TRIGGER_HIGHâ undeclared (first use in this function); did you mean âIRQD_TRIGGER_MASKâ?
parent_fwspec.param[2] = IRQF_TRIGGER_HIGH;
make[3]: *** [scripts/ drivers/irqchip/irq-ti-sci-inta.o] Error 1

Add this:
#include <linux/interrupt.h>

I did not see any such build error during my testing as shown below. But agree about the report. Will fix it in next version

â linux git:(nex-master) v8make defconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/preprocess.o
LEX scripts/kconfig/zconf.lex.c
YACC scripts/kconfig/
HOSTCC scripts/kconfig/zconf.lex.o
YACC scripts/kconfig/
HOSTCC scripts/kconfig/
v8 HOSTLD scripts/kconfig/conf
*** Default configuration is based on 'defconfig'
make #
# configuration written to .config
â linux git:(nex-master) v8make Image dtbs -j4 -s
arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts:25.9-29.5: Warning (graph_port): /edp-panel/ports: graph port node name should be 'port'
arch/arm64/boot/dts/rockchip/rk3399-gru-kevin.dts:46.9-50.5: Warning (graph_port): /edp-panel/ports: graph port node name should be 'port'
arch/arm64/boot/dts/rockchip/rk3399-sapphire-excavator.dts:94.9-98.5: Warning (graph_port): /edp-panel/ports: graph port node name should be 'port'
<stdin>:1339:2: warning: #warning syscall open_tree not implemented [-Wcpp]
<stdin>:1342:2: warning: #warning syscall move_mount not implemented [-Wcpp]
<stdin>:1345:2: warning: #warning syscall fsopen not implemented [-Wcpp]
<stdin>:1348:2: warning: #warning syscall fsconfig not implemented [-Wcpp]
<stdin>:1351:2: warning: #warning syscall fsmount not implemented [-Wcpp]
<stdin>:1354:2: warning: #warning syscall fspick not implemented [-Wcpp]
â linux git:(nex-master)

Thanks and regards,