[PATCH v2 0/5] Add STM32MP13 EXTI support

STALE1671d

Revision v2 of 3 in this series.

11 messages, 3 authors, 2022-01-04 · open the first message on its own page

[PATCH v2 0/5] Add STM32MP13 EXTI support

From: Alexandre Torgue <alexandre.torgue@foss.st.com>
Date: 2021-12-15 10:59:18

Enhance stm32-exti driver to support STM32MP13 SoC. This SoC uses the same
hardware version than STM32MP15. Only EXTI line mapping is changed and
following EXTI lines are supported: GPIO, RTC, I2C[1-5], UxART[1-8],
USBH_EHCI, USBH_OHCI, USB_OTG, LPTIM[1-5], ETH[1-2].

This series adds also the possibility to define EXTI GIC mapping through
devicetree.

Changes since v1:
- add possibility to define EXTI/GIC mapping in devicetree
- define STM32MP13 EXTI/GIC mapping in devicetree.


regards
Alex

Alexandre Torgue (5):
  dt-bindings: interrupt-controller: Update STM32 EXTI interrupt
    controller
  irqchip/stm32: use device tree to define EXTI-GIC mapping
  dt-bindings: interrupt-controller: stm32-exti: document
    st,stm32mp13-exti
  irqchip/stm32-exti: add STM32MP13 support
  ARM: dts: stm32: Enable EXTI on stm32mp13

 .../interrupt-controller/st,stm32-exti.yaml   | 12 +++
 arch/arm/boot/dts/stm32mp131.dtsi             | 47 ++++++++++
 drivers/irqchip/irq-stm32-exti.c              | 87 ++++++++++++++++---
 .../interrupt-controller/stm32-exti.h         | 10 +++
 4 files changed, 145 insertions(+), 11 deletions(-)
 create mode 100644 include/dt-bindings/interrupt-controller/stm32-exti.h

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH v2 3/5] dt-bindings: interrupt-controller: stm32-exti: document st,stm32mp13-exti

From: Alexandre Torgue <alexandre.torgue@foss.st.com>
Date: 2021-12-15 10:59:19

Support of STM32MP13 SoC implies a new EXTI-GIC mapping.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
index e08bb51e97a8..532425b1e5bb 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
+++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
@@ -20,6 +20,7 @@ properties:
       - items:
           - enum:
               - st,stm32mp1-exti
+              - st,stm32mp13-exti
           - const: syscon
 
   "#interrupt-cells":
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH v2 3/5] dt-bindings: interrupt-controller: stm32-exti: document st,stm32mp13-exti

From: Rob Herring <robh@kernel.org>
Date: 2021-12-16 20:15:49

On Wed, 15 Dec 2021 11:58:45 +0100, Alexandre Torgue wrote:
Support of STM32MP13 SoC implies a new EXTI-GIC mapping.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
Acked-by: Rob Herring <robh@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH v2 4/5] irqchip/stm32-exti: add STM32MP13 support

From: Alexandre Torgue <alexandre.torgue@foss.st.com>
Date: 2021-12-15 10:59:21

Enhance stm32-exti driver to support STM32MP13 SoC. This SoC uses the same
hardware version than STM32MP15. Only EXTI line mapping is changed and
following EXTI lines are supported: GPIO, RTC, I2C[1-5], UxART[1-8],
USBH_EHCI, USBH_OHCI, USB_OTG, LPTIM[1-5], ETH[1-2].

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index b56530675799..646fd15972c9 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -224,6 +224,11 @@ static const struct stm32_exti_drv_data stm32mp1_drv_data = {
 	.irq_nr = ARRAY_SIZE(stm32mp1_desc_irq),
 };
 
+static const struct stm32_exti_drv_data stm32mp13_drv_data = {
+	.exti_banks = stm32mp1_exti_banks,
+	.bank_nr = ARRAY_SIZE(stm32mp1_exti_banks),
+};
+
 static struct
 stm32_desc_irq *stm32_exti_get_desc(struct stm32_exti_host_data *host_data, irq_hw_number_t hwirq)
 {
@@ -981,6 +986,7 @@ static int stm32_exti_probe(struct platform_device *pdev)
 /* platform driver only for MP1 */
 static const struct of_device_id stm32_exti_ids[] = {
 	{ .compatible = "st,stm32mp1-exti", .data = &stm32mp1_drv_data},
+	{ .compatible = "st,stm32mp13-exti", .data = &stm32mp13_drv_data},
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_exti_ids);
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH v2 2/5] irqchip/stm32: use device tree to define EXTI-GIC mapping

From: Alexandre Torgue <alexandre.torgue@foss.st.com>
Date: 2021-12-15 10:59:24

Hardware mapping between EXTI line and GIC line better fits with device
tree description. It avoids also to waste memory space as this mapping is
SoC dependent. Note that stm32mp15 table is kept to ensure backward
compatibility.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index b7cb2da71888..b56530675799 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -21,6 +21,7 @@
 #include <linux/syscore_ops.h>
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/interrupt-controller/stm32-exti.h>
 
 #define IRQS_PER_BANK 32
 
@@ -46,7 +47,7 @@ struct stm32_desc_irq {
 
 struct stm32_exti_drv_data {
 	const struct stm32_exti_bank **exti_banks;
-	const struct stm32_desc_irq *desc_irqs;
+	struct stm32_desc_irq *desc_irqs;
 	u32 bank_nr;
 	u32 irq_nr;
 };
@@ -66,6 +67,8 @@ struct stm32_exti_host_data {
 	struct stm32_exti_chip_data *chips_data;
 	const struct stm32_exti_drv_data *drv_data;
 	struct hwspinlock *hwlock;
+	struct stm32_desc_irq *desc_irqs;
+	u32 irq_nr;
 };
 
 static struct stm32_exti_host_data *stm32_host_data;
@@ -169,7 +172,7 @@ static const struct stm32_exti_bank *stm32mp1_exti_banks[] = {
 static struct irq_chip stm32_exti_h_chip;
 static struct irq_chip stm32_exti_h_chip_direct;
 
-static const struct stm32_desc_irq stm32mp1_desc_irq[] = {
+static struct stm32_desc_irq stm32mp1_desc_irq[] = {
 	{ .exti = 0, .irq_parent = 6, .chip = &stm32_exti_h_chip },
 	{ .exti = 1, .irq_parent = 7, .chip = &stm32_exti_h_chip },
 	{ .exti = 2, .irq_parent = 8, .chip = &stm32_exti_h_chip },
@@ -221,20 +224,28 @@ static const struct stm32_exti_drv_data stm32mp1_drv_data = {
 	.irq_nr = ARRAY_SIZE(stm32mp1_desc_irq),
 };
 
-static const struct
-stm32_desc_irq *stm32_exti_get_desc(const struct stm32_exti_drv_data *drv_data,
-				    irq_hw_number_t hwirq)
+static struct
+stm32_desc_irq *stm32_exti_get_desc(struct stm32_exti_host_data *host_data, irq_hw_number_t hwirq)
 {
-	const struct stm32_desc_irq *desc = NULL;
+	const struct stm32_exti_drv_data *drv_data = host_data->drv_data;
+	struct stm32_desc_irq *desc = NULL;
+	u32 irq_nr;
 	int i;
 
-	if (!drv_data->desc_irqs)
+	if (host_data->desc_irqs) {
+		desc = &host_data->desc_irqs[0];
+		irq_nr = host_data->irq_nr;
+	} else if (drv_data && drv_data->desc_irqs) {
+		desc = &drv_data->desc_irqs[0];
+		irq_nr = drv_data->irq_nr;
+	} else {
 		return NULL;
+	}
 
-	for (i = 0; i < drv_data->irq_nr; i++) {
-		desc = &drv_data->desc_irqs[i];
+	for (i = 0; i < irq_nr; i++) {
 		if (desc->exti == hwirq)
 			break;
+		desc++;
 	}
 
 	return desc;
@@ -657,7 +668,7 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
 {
 	struct stm32_exti_host_data *host_data = dm->host_data;
 	struct stm32_exti_chip_data *chip_data;
-	const struct stm32_desc_irq *desc;
+	struct stm32_desc_irq *desc;
 	struct irq_fwspec *fwspec = data;
 	struct irq_fwspec p_fwspec;
 	irq_hw_number_t hwirq;
@@ -668,7 +679,7 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
 	chip_data = &host_data->chips_data[bank];
 
 
-	desc = stm32_exti_get_desc(host_data->drv_data, hwirq);
+	desc = stm32_exti_get_desc(host_data, hwirq);
 	if (!desc)
 		return -EINVAL;
 
@@ -687,6 +698,50 @@ static int stm32_exti_h_domain_alloc(struct irq_domain *dm,
 	return 0;
 }
 
+static int stm32_exti_get_irq_mapping(struct device *dev, struct stm32_exti_host_data *host_data)
+{
+	struct device_node *np = dev->of_node;
+	const __be32 *p = NULL;
+	struct property *prop;
+	int i, ret;
+	u32 chip;
+
+	prop = of_find_property(np, "st,exti-mapping", NULL);
+	if (!prop) {
+		dev_dbg(dev, "st,exti-mapping DT property not provided");
+		return 0;
+	}
+
+	ret = of_property_count_elems_of_size(np, "st,exti-mapping",
+					      STM32_EXTI_MAPPING_CELL_NB * sizeof(u32));
+	if (ret <= 0) {
+		dev_err(dev, "Wrong EXTI/GIC mapping!\n");
+		return ret;
+	}
+
+	host_data->irq_nr = ret;
+
+	host_data->desc_irqs = devm_kzalloc(dev, host_data->irq_nr * sizeof(*host_data->desc_irqs),
+					    GFP_KERNEL);
+	if (!host_data->desc_irqs)
+		return -ENOMEM;
+
+	for (i = 0; i < host_data->irq_nr; i++) {
+		p = of_prop_next_u32(prop, p, &host_data->desc_irqs[i].exti);
+		p = of_prop_next_u32(prop, p, &host_data->desc_irqs[i].irq_parent);
+		p = of_prop_next_u32(prop, p, &chip);
+
+		if (chip == STM32_EXTI_TYPE_CONFIGURABLE)
+			host_data->desc_irqs[i].chip = &stm32_exti_h_chip;
+		else if (chip == STM32_EXTI_TYPE_DIRECT)
+			host_data->desc_irqs[i].chip = &stm32_exti_h_chip_direct;
+		else
+			return -EINVAL;
+	}
+
+	return 0;
+}
+
 static struct
 stm32_exti_host_data *stm32_exti_host_init(const struct stm32_exti_drv_data *dd,
 					   struct device_node *node)
@@ -910,6 +965,10 @@ static int stm32_exti_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	ret = stm32_exti_get_irq_mapping(dev, host_data);
+	if (ret)
+		return ret;
+
 	ret = devm_add_action_or_reset(dev, stm32_exti_remove_irq, domain);
 	if (ret)
 		return ret;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH v2 1/5] dt-bindings: interrupt-controller: Update STM32 EXTI interrupt controller

From: Alexandre Torgue <alexandre.torgue@foss.st.com>
Date: 2021-12-15 10:59:29

Document new entry "st,exti-mapping" which links EXTI lines with GIC
interrupt lines and add an include file to define EXTI interrupt type.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
index d19c881b4abc..e08bb51e97a8 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
+++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
@@ -41,6 +41,17 @@ properties:
     description:
       Interrupts references to primary interrupt controller
 
+  st,exti-mapping:
+    $ref: "/schemas/types.yaml#/definitions/uint32-matrix"
+    description: |
+            Define mapping between EXTI lines and GIC irq lines. Should be:
+            st,exti-mapping = <EXTI_LINE GIC_IRQ EXTI_TYPE>, ...;
+            With:
+            - EXTI_LINE: EXTI line number.
+            - GIC_IRQ: GIC IRQ associated to the EXTI line.
+            - EXTI_TYPE: STM32_EXTI_TYPE_CONFIGURABLE or STM32_EXTI_TYPE_DIRECT.
+              Defined in include/dt-bindings/interrupt-controller/stm32-exti.h
+
 required:
   - "#interrupt-cells"
   - compatible
diff --git a/include/dt-bindings/interrupt-controller/stm32-exti.h b/include/dt-bindings/interrupt-controller/stm32-exti.h
new file mode 100644
index 000000000000..02b7e0e30cf7
--- /dev/null
+++ b/include/dt-bindings/interrupt-controller/stm32-exti.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _DT_BINDINGS_INTERRUPT_CONTROLLER_STM32_EXTI_H
+#define _DT_BINDINGS_INTERRUPT_CONTROLLER_STM32_EXTI_H
+
+#define STM32_EXTI_TYPE_CONFIGURABLE	0
+#define STM32_EXTI_TYPE_DIRECT		1
+
+#define STM32_EXTI_MAPPING_CELL_NB	3
+
+#endif
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH v2 1/5] dt-bindings: interrupt-controller: Update STM32 EXTI interrupt controller

From: Rob Herring <robh@kernel.org>
Date: 2021-12-16 20:15:18

On Wed, Dec 15, 2021 at 11:58:43AM +0100, Alexandre Torgue wrote:
quoted hunk
Document new entry "st,exti-mapping" which links EXTI lines with GIC
interrupt lines and add an include file to define EXTI interrupt type.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
index d19c881b4abc..e08bb51e97a8 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
+++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
@@ -41,6 +41,17 @@ properties:
     description:
       Interrupts references to primary interrupt controller
 
+  st,exti-mapping:
+    $ref: "/schemas/types.yaml#/definitions/uint32-matrix"
+    description: |
+            Define mapping between EXTI lines and GIC irq lines. Should be:
+            st,exti-mapping = <EXTI_LINE GIC_IRQ EXTI_TYPE>, ...;
+            With:
+            - EXTI_LINE: EXTI line number.
+            - GIC_IRQ: GIC IRQ associated to the EXTI line.
+            - EXTI_TYPE: STM32_EXTI_TYPE_CONFIGURABLE or STM32_EXTI_TYPE_DIRECT.
+              Defined in include/dt-bindings/interrupt-controller/stm32-exti.h
No custom properties for this. See[1][2][3].

Rob


[1] https://lore.kernel.org/all/20211122103032.517923-1-maz@kernel.org/
[2] https://lore.kernel.org/all/87k0g8jlmg.wl-maz@kernel.org/
[3] https://lore.kernel.org/all/CAL_JsqK2Shj6smam7HgNAmy3UG+vVQPkU3Q0OjyEHOEJB45n0A@mail.gmail.com/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH v2 1/5] dt-bindings: interrupt-controller: Update STM32 EXTI interrupt controller

From: Alexandre TORGUE <alexandre.torgue@foss.st.com>
Date: 2021-12-17 13:39:51

On 12/16/21 9:15 PM, Rob Herring wrote:
On Wed, Dec 15, 2021 at 11:58:43AM +0100, Alexandre Torgue wrote:
quoted
Document new entry "st,exti-mapping" which links EXTI lines with GIC
interrupt lines and add an include file to define EXTI interrupt type.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
index d19c881b4abc..e08bb51e97a8 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
+++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
@@ -41,6 +41,17 @@ properties:
      description:
        Interrupts references to primary interrupt controller
  
+  st,exti-mapping:
+    $ref: "/schemas/types.yaml#/definitions/uint32-matrix"
+    description: |
+            Define mapping between EXTI lines and GIC irq lines. Should be:
+            st,exti-mapping = <EXTI_LINE GIC_IRQ EXTI_TYPE>, ...;
+            With:
+            - EXTI_LINE: EXTI line number.
+            - GIC_IRQ: GIC IRQ associated to the EXTI line.
+            - EXTI_TYPE: STM32_EXTI_TYPE_CONFIGURABLE or STM32_EXTI_TYPE_DIRECT.
+              Defined in include/dt-bindings/interrupt-controller/stm32-exti.h
No custom properties for this. See[1][2][3].
Thanks for inputs. In my case the mapping consists to map an EXTI line 
with a GIC irq line which could be done using interrupt-map (avoiding to 
parse it in my driver). But for each EXTI/GIC association I would like 
also to describe the EXTI_TYPE (which actually describe the well irqchip 
to use inside my exti driver) . This property is not generic and so I 
assume I can't use a generic binding such "interrupt-map".

If the solution consists to use a common binding (i.e. interrupt-map) 
plus a conversion table in exti driver to affect the well irq_chip to 
the well EXTI line then we could envisage to keep the whole mapping 
inside the driver (even if it's not the best solution).

Another solution could be to define two exti irq-controllers (one for 
configurable type and another one for direct type) and use interrupt-map 
inside each. It means to have 2 child node inside (one per irq 
controller) EXTI node.

Alex

Rob


[1] https://lore.kernel.org/all/20211122103032.517923-1-maz@kernel.org/
[2] https://lore.kernel.org/all/87k0g8jlmg.wl-maz@kernel.org/
[3] https://lore.kernel.org/all/CAL_JsqK2Shj6smam7HgNAmy3UG+vVQPkU3Q0OjyEHOEJB45n0A@mail.gmail.com/

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH v2 1/5] dt-bindings: interrupt-controller: Update STM32 EXTI interrupt controller

From: Marc Zyngier <maz@kernel.org>
Date: 2021-12-20 12:34:51

On Fri, 17 Dec 2021 13:39:11 +0000,
Alexandre TORGUE [off-list ref] wrote:
On 12/16/21 9:15 PM, Rob Herring wrote:
quoted
On Wed, Dec 15, 2021 at 11:58:43AM +0100, Alexandre Torgue wrote:
quoted
Document new entry "st,exti-mapping" which links EXTI lines with GIC
interrupt lines and add an include file to define EXTI interrupt type.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
index d19c881b4abc..e08bb51e97a8 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
+++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
@@ -41,6 +41,17 @@ properties:
      description:
        Interrupts references to primary interrupt controller
  +  st,exti-mapping:
+    $ref: "/schemas/types.yaml#/definitions/uint32-matrix"
+    description: |
+            Define mapping between EXTI lines and GIC irq lines. Should be:
+            st,exti-mapping = <EXTI_LINE GIC_IRQ EXTI_TYPE>, ...;
+            With:
+            - EXTI_LINE: EXTI line number.
+            - GIC_IRQ: GIC IRQ associated to the EXTI line.
+            - EXTI_TYPE: STM32_EXTI_TYPE_CONFIGURABLE or STM32_EXTI_TYPE_DIRECT.
+              Defined in include/dt-bindings/interrupt-controller/stm32-exti.h
No custom properties for this. See[1][2][3].
Thanks for inputs. In my case the mapping consists to map an EXTI line
with a GIC irq line which could be done using interrupt-map (avoiding
to parse it in my driver).
The problem is that 'interrupt-map' defines an interrupt mapping
between an input and an output, and that mentioning the GIC in such a
table will only result in your EXTI to be bypassed.

'interrupt-map' really is a dispatch table for targeting an interrupt
controller (or multiple controllers, even), but really isn't the
correct tool to carry configuration informations to an interrupt
controller driver.
But for each EXTI/GIC association I would
like also to describe the EXTI_TYPE (which actually describe the well
irqchip to use inside my exti driver) . This property is not generic
and so I assume I can't use a generic binding such "interrupt-map".

If the solution consists to use a common binding (i.e. interrupt-map)
plus a conversion table in exti driver to affect the well irq_chip to
the well EXTI line then we could envisage to keep the whole mapping
inside the driver (even if it's not the best solution).
A possible solution would be to have:

- A set of standard 'interrupts' properties describing the output
signals

- A set of properties describing the input to output mapping (if
relevant) and additional configuration information that for the
interrupt controller driver.

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH v2 1/5] dt-bindings: interrupt-controller: Update STM32 EXTI interrupt controller

From: Alexandre TORGUE <alexandre.torgue@foss.st.com>
Date: 2022-01-04 17:14:49

Hi Marc

On 12/20/21 1:34 PM, Marc Zyngier wrote:
On Fri, 17 Dec 2021 13:39:11 +0000,
Alexandre TORGUE [off-list ref] wrote:
quoted
On 12/16/21 9:15 PM, Rob Herring wrote:
quoted
On Wed, Dec 15, 2021 at 11:58:43AM +0100, Alexandre Torgue wrote:
quoted
Document new entry "st,exti-mapping" which links EXTI lines with GIC
interrupt lines and add an include file to define EXTI interrupt type.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
index d19c881b4abc..e08bb51e97a8 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
+++ b/Documentation/devicetree/bindings/interrupt-controller/st,stm32-exti.yaml
@@ -41,6 +41,17 @@ properties:
       description:
         Interrupts references to primary interrupt controller
   +  st,exti-mapping:
+    $ref: "/schemas/types.yaml#/definitions/uint32-matrix"
+    description: |
+            Define mapping between EXTI lines and GIC irq lines. Should be:
+            st,exti-mapping = <EXTI_LINE GIC_IRQ EXTI_TYPE>, ...;
+            With:
+            - EXTI_LINE: EXTI line number.
+            - GIC_IRQ: GIC IRQ associated to the EXTI line.
+            - EXTI_TYPE: STM32_EXTI_TYPE_CONFIGURABLE or STM32_EXTI_TYPE_DIRECT.
+              Defined in include/dt-bindings/interrupt-controller/stm32-exti.h
No custom properties for this. See[1][2][3].
Thanks for inputs. In my case the mapping consists to map an EXTI line
with a GIC irq line which could be done using interrupt-map (avoiding
to parse it in my driver).
The problem is that 'interrupt-map' defines an interrupt mapping
between an input and an output, and that mentioning the GIC in such a
table will only result in your EXTI to be bypassed.

'interrupt-map' really is a dispatch table for targeting an interrupt
controller (or multiple controllers, even), but really isn't the
correct tool to carry configuration informations to an interrupt
controller driver.
Ok so let's forget "interrupt-map"
quoted
But for each EXTI/GIC association I would
like also to describe the EXTI_TYPE (which actually describe the well
irqchip to use inside my exti driver) . This property is not generic
and so I assume I can't use a generic binding such "interrupt-map".

If the solution consists to use a common binding (i.e. interrupt-map)
plus a conversion table in exti driver to affect the well irq_chip to
the well EXTI line then we could envisage to keep the whole mapping
inside the driver (even if it's not the best solution).
A possible solution would be to have:

- A set of standard 'interrupts' properties describing the output
signals

- A set of properties describing the input to output mapping (if
relevant) and additional configuration information that for the
interrupt controller driver.
Does it means to have my own description of "interrupt" property using 
xlate function in EXTI driver ?

something like that:

interrupt = <GIC_SPI 6 EXTI_LINE EXTI_TYPE>, ...

regards
Alex
	M.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

[PATCH v2 5/5] ARM: dts: stm32: Enable EXTI on stm32mp13

From: Alexandre Torgue <alexandre.torgue@foss.st.com>
Date: 2021-12-15 10:59:33

Enable EXTI hardware peripheral for STM32MP13 SoC and define EXTI/GIC
mapping.

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
diff --git a/arch/arm/boot/dts/stm32mp131.dtsi b/arch/arm/boot/dts/stm32mp131.dtsi
index 86126dc0d898..5bd384295619 100644
--- a/arch/arm/boot/dts/stm32mp131.dtsi
+++ b/arch/arm/boot/dts/stm32mp131.dtsi
@@ -4,6 +4,7 @@
  * Author: Alexandre Torgue <alexandre.torgue@foss.st.com> for STMicroelectronics.
  */
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/interrupt-controller/stm32-exti.h>
 
 / {
 	#address-cells = <1>;
@@ -115,6 +116,52 @@
 			status = "disabled";
 		};
 
+		exti: interrupt-controller@5000d000 {
+			compatible = "st,stm32mp13-exti", "syscon";
+			interrupt-controller;
+			#interrupt-cells = <2>;
+			reg = <0x5000d000 0x400>;
+			st,exti-mapping = <0 6 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <1 7 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <2 8 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <3 9 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <4 10 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <5 24 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <6 65 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <7 66 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <8 67 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <9 68 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <10 41 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <11 43 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <12 77 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <13 78 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <14 106 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <15 109 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <16 1 STM32_EXTI_TYPE_CONFIGURABLE>,
+					  <19 3 STM32_EXTI_TYPE_DIRECT>,
+					  <21 32 STM32_EXTI_TYPE_DIRECT>,
+					  <22 34 STM32_EXTI_TYPE_DIRECT>,
+					  <23 73 STM32_EXTI_TYPE_DIRECT>,
+					  <24 93 STM32_EXTI_TYPE_DIRECT>,
+					  <25 114 STM32_EXTI_TYPE_DIRECT>,
+					  <26 38 STM32_EXTI_TYPE_DIRECT>,
+					  <27 39 STM32_EXTI_TYPE_DIRECT>,
+					  <28 40 STM32_EXTI_TYPE_DIRECT>,
+					  <29 72 STM32_EXTI_TYPE_DIRECT>,
+					  <30 53 STM32_EXTI_TYPE_DIRECT>,
+					  <31 54 STM32_EXTI_TYPE_DIRECT>,
+					  <32 83 STM32_EXTI_TYPE_DIRECT>,
+					  <33 84 STM32_EXTI_TYPE_DIRECT>,
+					  <44 96 STM32_EXTI_TYPE_DIRECT>,
+					  <47 92 STM32_EXTI_TYPE_DIRECT>,
+					  <48 116 STM32_EXTI_TYPE_DIRECT>,
+					  <50 117 STM32_EXTI_TYPE_DIRECT>,
+					  <52 118 STM32_EXTI_TYPE_DIRECT>,
+					  <53 119 STM32_EXTI_TYPE_DIRECT>,
+					  <68 63 STM32_EXTI_TYPE_DIRECT>,
+					  <70 98 STM32_EXTI_TYPE_DIRECT>;
+		};
+
 		syscfg: syscon@50020000 {
 			compatible = "st,stm32mp157-syscfg", "syscon";
 			reg = <0x50020000 0x400>;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help