2020-08-17 13:44:54

by Grzegorz Jaszczyk

[permalink] [raw]
Subject: [PATCH v5 0/5] Add TI PRUSS Local Interrupt Controller IRQChip driver

Hi All,

The following is a v4 version of the series [1-4] that adds an IRQChip
driver for the local interrupt controller present within a Programmable
Real-Time Unit and Industrial Communication Subsystem (PRU-ICSS) present on a
number of TI SoCs including OMAP architecture based AM335x, AM437x, AM57xx SoCs,
Keystone 2 architecture based 66AK2G SoCs, Davinci architecture based
OMAP-L138/DA850 SoCs and the latest K3 architecture based AM65x and J721E SoCs.
Please see the v1 cover-letter [1] for details about the features of this
interrupt controller. More details can be found in any of the supported SoC
TRMs. Eg: Chapter 30.1.6 of AM5728 TRM [5]

Please see the individual patches for exact changes in each patch, following are
the main changes from v4:
- Update dt-binding description (no functional changes).
- Use more meaningful define/variable names, drop redundant error messages, fix
error handling in case of irq == 0 (patch #2).

[1] https://patchwork.kernel.org/cover/11034561/
[2] https://patchwork.kernel.org/cover/11069749/
[3] https://patchwork.kernel.org/cover/11639055/
[4] https://patchwork.kernel.org/cover/11688727/
[5] http://www.ti.com/lit/pdf/spruhz6

Best regards
Grzegorz

David Lechner (1):
irqchip/irq-pruss-intc: Implement irq_{get,set}_irqchip_state ops

Grzegorz Jaszczyk (1):
irqchip/irq-pruss-intc: Add a PRUSS irqchip driver for PRUSS
interrupts

Suman Anna (3):
dt-bindings: irqchip: Add PRU-ICSS interrupt controller bindings
irqchip/irq-pruss-intc: Add logic for handling reserved interrupts
irqchip/irq-pruss-intc: Add support for ICSSG INTC on K3 SoCs

.../interrupt-controller/ti,pruss-intc.yaml | 158 +++++
drivers/irqchip/Kconfig | 10 +
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-pruss-intc.c | 658 +++++++++++++++++++++
4 files changed, 827 insertions(+)
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/ti,pruss-intc.yaml
create mode 100644 drivers/irqchip/irq-pruss-intc.c

--
2.7.4


2020-08-17 21:15:46

by Grzegorz Jaszczyk

[permalink] [raw]
Subject: [PATCH v5 4/5] irqchip/irq-pruss-intc: Implement irq_{get,set}_irqchip_state ops

From: David Lechner <[email protected]>

This implements the irq_get_irqchip_state and irq_set_irqchip_state
callbacks for the TI PRUSS INTC driver. The set callback can be used
by drivers to "kick" a PRU by injecting a PRU system event.

Example:
irq_set_irqchip_state(irq, IRQCHIP_STATE_PENDING, true);

Signed-off-by: David Lechner <[email protected]>
Signed-off-by: Suman Anna <[email protected]>
Signed-off-by: Grzegorz Jaszczyk <[email protected]>
Reviewed-by: Lee Jones <[email protected]>
---
v4->v5:
- No change.
v3->v4:
- Update commit message
v2->v3:
- Get rid of unnecessary pruss_intc_check_write() and use
pruss_intc_write_reg directly.
v1->v2:
- https://patchwork.kernel.org/patch/11069769/
---
drivers/irqchip/irq-pruss-intc.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)

diff --git a/drivers/irqchip/irq-pruss-intc.c b/drivers/irqchip/irq-pruss-intc.c
index 1a72591..15f0407 100644
--- a/drivers/irqchip/irq-pruss-intc.c
+++ b/drivers/irqchip/irq-pruss-intc.c
@@ -9,6 +9,7 @@
* Copyright (C) 2019 David Lechner <[email protected]>
*/

+#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h>
@@ -319,6 +320,43 @@ static void pruss_intc_irq_relres(struct irq_data *data)
module_put(THIS_MODULE);
}

+static int pruss_intc_irq_get_irqchip_state(struct irq_data *data,
+ enum irqchip_irq_state which,
+ bool *state)
+{
+ struct pruss_intc *intc = irq_data_get_irq_chip_data(data);
+ u32 reg, mask, srsr;
+
+ if (which != IRQCHIP_STATE_PENDING)
+ return -EINVAL;
+
+ reg = PRU_INTC_SRSR(data->hwirq / 32);
+ mask = BIT(data->hwirq % 32);
+
+ srsr = pruss_intc_read_reg(intc, reg);
+
+ *state = !!(srsr & mask);
+
+ return 0;
+}
+
+static int pruss_intc_irq_set_irqchip_state(struct irq_data *data,
+ enum irqchip_irq_state which,
+ bool state)
+{
+ struct pruss_intc *intc = irq_data_get_irq_chip_data(data);
+
+ if (which != IRQCHIP_STATE_PENDING)
+ return -EINVAL;
+
+ if (state)
+ pruss_intc_write_reg(intc, PRU_INTC_SISR, data->hwirq);
+ else
+ pruss_intc_write_reg(intc, PRU_INTC_SICR, data->hwirq);
+
+ return 0;
+}
+
static struct irq_chip pruss_irqchip = {
.name = "pruss-intc",
.irq_ack = pruss_intc_irq_ack,
@@ -326,6 +364,8 @@ static struct irq_chip pruss_irqchip = {
.irq_unmask = pruss_intc_irq_unmask,
.irq_request_resources = pruss_intc_irq_reqres,
.irq_release_resources = pruss_intc_irq_relres,
+ .irq_get_irqchip_state = pruss_intc_irq_get_irqchip_state,
+ .irq_set_irqchip_state = pruss_intc_irq_set_irqchip_state,
};

static int pruss_intc_validate_mapping(struct pruss_intc *intc, int event,
--
2.7.4