Skip to contentSkip to conversation

irqchip: dw-apb-ictl: support hierarchy irq domain

PATCH Superseded Zhen Lei 2 participants 11 messages Sep 18, 2020 – Sep 24, 2020

Subsystems (5)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

v5 cover irqchip: dw-apb-ictl: support hierarchy irq domain

v4 --> v5:
1. Add WARN_ON(1) in set_handle_irq() if !GENERIC_IRQ_MULTI_HANDLER
2. Convert "snps,dw-apb-ictl.txt" to "snps,dw-apb-ictl.yaml"
3. Fix the errors detected by "snps,dw-apb-ictl.yaml" on arch/arc

v3 --> v4:
1. remove "gc->chip_types[0].chip.irq_eoi = irq_gc_noop;", the "chip.irq_eoi" hook is not needed by handle_level_irq(). Thanks for Marc Zyngier's review.
2. Add a new patch: define an empty function set_handle_irq() if !GENERIC_IRQ_MULTI_HANDLER to avoid compilation error on arch/arc system.

v2 --> v3:
1. change (1 << hwirq) to BIT(hwirq).
2. change __exception_irq_entry to __irq_entry, so we can "#include <linux/interrupt.h>" instead of "#include <asm/exception.h>". Ohterwise, an compilation error will be reported on arch/csky.
drivers/irqchip/irq-dw-apb-ictl.c:20:10: fatal error: asm/exception.h: No such file or directory
3. use "if (!parent || (np == parent))" to determine whether it is primary interrupt controller.
4. make the primary interrupt controller case also use function handle_level_irq(), I used handle_fasteoi_irq() as flow_handler before.
5. Other minor changes are not detailed.

v1 --> v2:
According to Marc Zyngier's suggestion, discard adding an independent SD5203-VIC driver, but make the dw-apb-ictl irqchip driver to support hierarchy irq domain. It was originally available only for secondary interrupt controller, now it can also be used as primary interrupt controller. The related dt-bindings is updated appropriately.

Add "Suggested-by: Marc Zyngier <[email protected]>". Add "Tested-by: Haoyu Lv <[email protected]>".

v1:
The interrupt controller of SD5203 SoC is VIC(vector interrupt controller), it's based on Synopsys DesignWare APB interrupt controller (dw_apb_ictl) IP, but it can not directly use dw_apb_ictl driver. The main reason is that VIC is used as primary interrupt controller and dw_apb_ictl driver worked for secondary interrupt controller. So add a new driver: "hisilicon,sd5203-vic".

Zhen Lei (6):
genirq: define an empty function set_handle_irq() if
!GENERIC_IRQ_MULTI_HANDLER
irqchip: dw-apb-ictl: prepare for support hierarchy irq domain
irqchip: dw-apb-ictl: support hierarchy irq domain
dt-bindings: dw-apb-ictl: support hierarchy irq domain
dt-bindings: dw-apb-ictl: convert to json-schema
ARC: [dts] fix the errors detected by dtbs_check

 .../interrupt-controller/snps,dw-apb-ictl.txt      | 31 --------
 .../interrupt-controller/snps,dw-apb-ictl.yaml     | 75 +++++++++++++++++++
 arch/arc/boot/dts/axc001.dtsi                      |  2 +-
 arch/arc/boot/dts/axc003.dtsi                      |  2 +-
 arch/arc/boot/dts/axc003_idu.dtsi                  |  2 +-
 arch/arc/boot/dts/vdk_axc003.dtsi                  |  2 +-
 arch/arc/boot/dts/vdk_axc003_idu.dtsi              |  2 +-
 drivers/irqchip/Kconfig                            |  2 +-
 drivers/irqchip/irq-dw-apb-ictl.c                  | 83 ++++++++++++++++++----
 include/linux/irq.h                                |  6 ++
 10 files changed, 158 insertions(+), 49 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml
Signature · 1 line
1.8.3
author
#1 lore raw

PATCH v5 1/6 genirq: define an empty function set_handle_irq() if !GENERIC_IRQ_MULTI_HANDLER

To avoid compilation error if an irqchip driver references the function set_handle_irq() but may not select GENERIC_IRQ_MULTI_HANDLER on some systems.

For example, the Synopsys DesignWare APB interrupt controller (dw_apb_ictl) is used as the secondary interrupt controller on arc, csky, arm64, and most arm32 SoCs, and it's also used as the primary interrupt controller on Hisilicon SD5203 (an arm32 SoC). The latter need to use set_handle_irq() to register the top-level IRQ handler, but this multi irq handler registration mechanism is not implemented on arc system.

The input parameter "handle_irq" maybe defined as static and only set_handle_irq() references it. This will trigger "defined but not used" warning. So add "(void)handle_irq" to suppress it.

---
 include/linux/irq.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/irq.h +6 -0
index 1b7f4dfee35b397..b167baef88c0b43 100644
@@ -1252,6 +1252,12 @@ void irq_matrix_free(struct irq_matrix *m, unsigned int cpu,
  * top-level IRQ handler.
  */
 extern void (*handle_arch_irq)(struct pt_regs *) __ro_after_init;
+#else
+#define set_handle_irq(handle_irq)		\
+	do {					\
+		(void)handle_irq;		\
+		WARN_ON(1);			\
+	} while (0)
 #endif
 
 #endif /* _LINUX_IRQ_H */
Signature · 1 line
1.8.3
author
#2 lore raw

PATCH v5 2/6 irqchip: dw-apb-ictl: prepare for support hierarchy irq domain

In reply to Zhen Lei

Rename some functions and variables in advance, to make the next patch looks more clear. The details are as follows:
1. rename dw_apb_ictl_handler() to dw_apb_ictl_handle_irq_cascaded().
2. change (1 << hwirq) to BIT(hwirq).

In function dw_apb_ictl_init():
1. rename local variable irq to parent_irq.
2. add "const struct irq_domain_ops *domain_ops = &irq_generic_chip_ops", then replace &irq_generic_chip_ops in other places with domain_ops.

No functional change.

---
 drivers/irqchip/irq-dw-apb-ictl.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/irqchip/irq-dw-apb-ictl.c +9 -8
index e4550e9c810ba94..5458004242e9d20 100644
@@ -26,7 +26,7 @@
 #define APB_INT_FINALSTATUS_H	0x34
 #define APB_INT_BASE_OFFSET	0x04
 
-static void dw_apb_ictl_handler(struct irq_desc *desc)
+static void dw_apb_ictl_handle_irq_cascaded(struct irq_desc *desc)
 {
 	struct irq_domain *d = irq_desc_get_handler_data(desc);
 	struct irq_chip *chip = irq_desc_get_chip(desc);
@@ -43,7 +43,7 @@ static void dw_apb_ictl_handler(struct irq_desc *desc)
 			u32 virq = irq_find_mapping(d, gc->irq_base + hwirq);
 
 			generic_handle_irq(virq);
-			stat &= ~(1 << hwirq);
+			stat &= ~BIT(hwirq);
 		}
 	}
 
@@ -73,12 +73,13 @@ static int __init dw_apb_ictl_init(struct device_node *np,
 	struct irq_domain *domain;
 	struct irq_chip_generic *gc;
 	void __iomem *iobase;
-	int ret, nrirqs, irq, i;
+	int ret, nrirqs, parent_irq, i;
 	u32 reg;
+	const struct irq_domain_ops *domain_ops = &irq_generic_chip_ops;
 
 	/* Map the parent interrupt for the chained handler */
-	irq = irq_of_parse_and_map(np, 0);
-	if (irq <= 0) {
+	parent_irq = irq_of_parse_and_map(np, 0);
+	if (parent_irq <= 0) {
 		pr_err("%pOF: unable to parse irq\n", np);
 		return -EINVAL;
 	}
@@ -120,8 +121,7 @@ static int __init dw_apb_ictl_init(struct device_node *np,
 	else
 		nrirqs = fls(readl_relaxed(iobase + APB_INT_ENABLE_L));
 
-	domain = irq_domain_add_linear(np, nrirqs,
-				       &irq_generic_chip_ops, NULL);
+	domain = irq_domain_add_linear(np, nrirqs, domain_ops, NULL);
 	if (!domain) {
 		pr_err("%pOF: unable to add irq domain\n", np);
 		ret = -ENOMEM;
@@ -146,7 +146,8 @@ static int __init dw_apb_ictl_init(struct device_node *np,
 		gc->chip_types[0].chip.irq_resume = dw_apb_ictl_resume;
 	}
 
-	irq_set_chained_handler_and_data(irq, dw_apb_ictl_handler, domain);
+	irq_set_chained_handler_and_data(parent_irq,
+				dw_apb_ictl_handle_irq_cascaded, domain);
 
 	return 0;
 
Signature · 1 line
1.8.3
author
#3 lore raw

PATCH v5 3/6 irqchip: dw-apb-ictl: support hierarchy irq domain

In reply to Zhen Lei

Add support to use dw-apb-ictl as primary interrupt controller.

---
 drivers/irqchip/Kconfig           |  2 +-
 drivers/irqchip/irq-dw-apb-ictl.c | 74 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 67 insertions(+), 9 deletions(-)
drivers/irqchip/Kconfig +1 -1
index bfc9719dbcdc31c..7c2d1c8fa551a66 100644
@@ -148,7 +148,7 @@ config DAVINCI_CP_INTC
 config DW_APB_ICTL
 	bool
 	select GENERIC_IRQ_CHIP
-	select IRQ_DOMAIN
+	select IRQ_DOMAIN_HIERARCHY
 
 config FARADAY_FTINTC010
 	bool
drivers/irqchip/irq-dw-apb-ictl.c +66 -8

105 lines not on this page · raw message

Signature · 1 line
1.8.3
author
#4 lore raw

PATCH v5 4/6 dt-bindings: dw-apb-ictl: support hierarchy irq domain

In reply to Zhen Lei

Add support to use dw-apb-ictl as primary interrupt controller.

---
 .../bindings/interrupt-controller/snps,dw-apb-ictl.txt     | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt +13 -1
index 086ff08322db94f..2db59df9408f4c6 100644
@@ -2,7 +2,8 @@ Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
 
 Synopsys DesignWare provides interrupt controller IP for APB known as
 dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
-APB bus, e.g. Marvell Armada 1500.
+APB bus, e.g. Marvell Armada 1500. It can also be used as primary interrupt
+controller in some SoCs, e.g. Hisilicon SD5203.
 
 Required properties:
 - compatible: shall be "snps,dw-apb-ictl"
@@ -10,6 +11,8 @@ Required properties:
   region starting with ENABLE_LOW register
 - interrupt-controller: identifies the node as an interrupt controller
 - #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1
+
+Additional required property when it's used as secondary interrupt controller:
 - interrupts: interrupt reference to primary interrupt controller
 
 The interrupt sources map to the corresponding bits in the interrupt
@@ -21,6 +24,7 @@ registers, i.e.
 - (optional) fast interrupts start at 64.
 
 Example:
+	/* dw_apb_ictl is used as secondary interrupt controller */
 	aic: interrupt-controller@3000 {
 		compatible = "snps,dw-apb-ictl";
 		reg = <0x3000 0xc00>;
@@ -29,3 +33,11 @@ Example:
 		interrupt-parent = <&gic>;
 		interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
 	};
+
+	/* dw_apb_ictl is used as primary interrupt controller */
+	vic: interrupt-controller@10130000 {
+		compatible = "snps,dw-apb-ictl";
+		reg = <0x10130000 0x1000>;
+		interrupt-controller;
+		#interrupt-cells = <1>;
+	};
Signature · 8 lines
1.8.3



_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
maintainer Reviewed-by on v5 4/6
#5 lore raw

Re: [PATCH v5 4/6] dt-bindings: dw-apb-ictl: support hierarchy irq domain

Quoted 7 lines · Zhen Lei

Add support to use dw-apb-ictl as primary interrupt controller.

---
 .../bindings/interrupt-controller/snps,dw-apb-ictl.txt     | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
author
#6 lore raw

PATCH v5 5/6 dt-bindings: dw-apb-ictl: convert to json-schema

In reply to Zhen Lei

Convert the Synopsys DesignWare APB interrupt controller (dw_apb_ictl) binding to DT schema format using json-schema.

---
 .../interrupt-controller/snps,dw-apb-ictl.txt      | 43 -------------
 .../interrupt-controller/snps,dw-apb-ictl.yaml     | 75 ++++++++++++++++++++++
 2 files changed, 75 insertions(+), 43 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt deleted +0 -43
deleted file mode 100644
index 2db59df9408f4c6..000000000000000
@@ -1,43 +0,0 @@
-Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
-
-Synopsys DesignWare provides interrupt controller IP for APB known as
-dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
-APB bus, e.g. Marvell Armada 1500. It can also be used as primary interrupt
-controller in some SoCs, e.g. Hisilicon SD5203.
-
-Required properties:
-- compatible: shall be "snps,dw-apb-ictl"
-- reg: physical base address of the controller and length of memory mapped
-  region starting with ENABLE_LOW register
-- interrupt-controller: identifies the node as an interrupt controller
-- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1
-
-Additional required property when it's used as secondary interrupt controller:
-- interrupts: interrupt reference to primary interrupt controller
-
-The interrupt sources map to the corresponding bits in the interrupt
-registers, i.e.
-- 0 maps to bit 0 of low interrupts,
-- 1 maps to bit 1 of low interrupts,
-- 32 maps to bit 0 of high interrupts,
-- 33 maps to bit 1 of high interrupts,
-- (optional) fast interrupts start at 64.
-
-Example:
-	/* dw_apb_ictl is used as secondary interrupt controller */
-	aic: interrupt-controller@3000 {
-		compatible = "snps,dw-apb-ictl";
-		reg = <0x3000 0xc00>;
-		interrupt-controller;
-		#interrupt-cells = <1>;
-		interrupt-parent = <&gic>;
-		interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
-	};
-
-	/* dw_apb_ictl is used as primary interrupt controller */
-	vic: interrupt-controller@10130000 {
-		compatible = "snps,dw-apb-ictl";
-		reg = <0x10130000 0x1000>;
-		interrupt-controller;
-		#interrupt-cells = <1>;
-	};
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +75 -0

75 lines not on this page · raw message

Signature · 8 lines
1.8.3



_______________________________________________
linux-snps-arc mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
maintainer
#7 lore raw

Re: [PATCH v5 5/6] dt-bindings: dw-apb-ictl: convert to json-schema

Quoted 66 lines · Zhen Lei

Convert the Synopsys DesignWare APB interrupt controller (dw_apb_ictl) binding to DT schema format using json-schema.

---
 .../interrupt-controller/snps,dw-apb-ictl.txt      | 43 -------------
 .../interrupt-controller/snps,dw-apb-ictl.yaml     | 75 ++++++++++++++++++++++
 2 files changed, 75 insertions(+), 43 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt deleted +0 -43
deleted file mode 100644
index 2db59df9408f4c6..000000000000000
@@ -1,43 +0,0 @@
-Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
-
-Synopsys DesignWare provides interrupt controller IP for APB known as
-dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
-APB bus, e.g. Marvell Armada 1500. It can also be used as primary interrupt
-controller in some SoCs, e.g. Hisilicon SD5203.
-
-Required properties:
-- compatible: shall be "snps,dw-apb-ictl"
-- reg: physical base address of the controller and length of memory mapped
-  region starting with ENABLE_LOW register
-- interrupt-controller: identifies the node as an interrupt controller
-- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1
-
-Additional required property when it's used as secondary interrupt controller:
-- interrupts: interrupt reference to primary interrupt controller
-
-The interrupt sources map to the corresponding bits in the interrupt
-registers, i.e.
-- 0 maps to bit 0 of low interrupts,
-- 1 maps to bit 1 of low interrupts,
-- 32 maps to bit 0 of high interrupts,
-- 33 maps to bit 1 of high interrupts,
-- (optional) fast interrupts start at 64.
-
-Example:
-	/* dw_apb_ictl is used as secondary interrupt controller */
-	aic: interrupt-controller@3000 {
-		compatible = "snps,dw-apb-ictl";
-		reg = <0x3000 0xc00>;
-		interrupt-controller;
-		#interrupt-cells = <1>;
-		interrupt-parent = <&gic>;
-		interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
-	};
-
-	/* dw_apb_ictl is used as primary interrupt controller */
-	vic: interrupt-controller@10130000 {
-		compatible = "snps,dw-apb-ictl";
-		reg = <0x10130000 0x1000>;
-		interrupt-controller;
-		#interrupt-cells = <1>;
-	};
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +0 -0
new file mode 100644
index 000000000000000..70c12979c843bf0

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 10

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +10 -0
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/snps,dw-apb-ictl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
+
+maintainers:
+  - Marc Zyngier <[email protected]>

Usually this would be an owner for this IP block, not the subsystem maintainer.

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 19

Quoted 9 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +9 -0
+
+description:
+  Synopsys DesignWare provides interrupt controller IP for APB known as
+  dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs
+  with APB bus, e.g. Marvell Armada 1500. It can also be used as primary
+  interrupt controller in some SoCs, e.g. Hisilicon SD5203.
+
+allOf:
+  - $ref: /schemas/interrupt-controller.yaml#

You can drop this, it's already applied based on node name.

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 30

Quoted 11 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +11 -0
+
+properties:
+  compatible:
+    const: snps,dw-apb-ictl
+
+  interrupt-controller: true
+
+  reg:
+    description:
+      Physical base address of the controller and length of memory mapped
+      region starting with ENABLE_LOW register.

Need to define how many reg regions (maxItems: 1).

Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +4 -0
+
+  interrupts:
+    description:
+      Interrupt reference to primary interrupt controller.

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +10 -0
+
+      The interrupt sources map to the corresponding bits in the interrupt
+      registers, i.e.
+      - 0 maps to bit 0 of low interrupts,
+      - 1 maps to bit 1 of low interrupts,
+      - 32 maps to bit 0 of high interrupts,
+      - 33 maps to bit 1 of high interrupts,
+      - (optional) fast interrupts start at 64.
+    minItems: 1
+    maxItems: 65

65 connections to the primary interrupt controller? I think this is for the child interrupts? If so, move to #interrupt-cells description instead.

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 48

Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +4 -0
+
+  "#interrupt-cells":
+    description:
+      Number of cells to encode an interrupt-specifier.

Drop. No need to redefine common properties.

Quoted 31 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +27 -0
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+
+examples:
+  - |
+    /* dw_apb_ictl is used as secondary interrupt controller */
+    aic: interrupt-controller@3000 {
+        compatible = "snps,dw-apb-ictl";
+        reg = <0x3000 0xc00>;
+        interrupt-controller;
+        #interrupt-cells = <1>;
+        interrupt-parent = <&gic>;
+        interrupts = <0 3 4>;
+    };
+
+    /* dw_apb_ictl is used as primary interrupt controller */
+    vic: interrupt-controller@10130000 {
+        compatible = "snps,dw-apb-ictl";
+        reg = <0x10130000 0x1000>;
+        interrupt-controller;
+        #interrupt-cells = <1>;
+    };
Signature · 1 line
1.8.3
#8 lore raw

Re: [PATCH v5 5/6] dt-bindings: dw-apb-ictl: convert to json-schema

Quoted 72 lines · Rob Herring
Quoted 71 lines · Zhen Lei

Convert the Synopsys DesignWare APB interrupt controller (dw_apb_ictl) binding to DT schema format using json-schema.

---
 .../interrupt-controller/snps,dw-apb-ictl.txt      | 43 -------------
 .../interrupt-controller/snps,dw-apb-ictl.yaml     | 75 ++++++++++++++++++++++
 2 files changed, 75 insertions(+), 43 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt deleted +0 -43
deleted file mode 100644
index 2db59df9408f4c6..000000000000000
@@ -1,43 +0,0 @@
-Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
-
-Synopsys DesignWare provides interrupt controller IP for APB known as
-dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
-APB bus, e.g. Marvell Armada 1500. It can also be used as primary interrupt
-controller in some SoCs, e.g. Hisilicon SD5203.
-
-Required properties:
-- compatible: shall be "snps,dw-apb-ictl"
-- reg: physical base address of the controller and length of memory mapped
-  region starting with ENABLE_LOW register
-- interrupt-controller: identifies the node as an interrupt controller
-- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1
-
-Additional required property when it's used as secondary interrupt controller:
-- interrupts: interrupt reference to primary interrupt controller
-
-The interrupt sources map to the corresponding bits in the interrupt
-registers, i.e.
-- 0 maps to bit 0 of low interrupts,
-- 1 maps to bit 1 of low interrupts,
-- 32 maps to bit 0 of high interrupts,
-- 33 maps to bit 1 of high interrupts,
-- (optional) fast interrupts start at 64.
-
-Example:
-	/* dw_apb_ictl is used as secondary interrupt controller */
-	aic: interrupt-controller@3000 {
-		compatible = "snps,dw-apb-ictl";
-		reg = <0x3000 0xc00>;
-		interrupt-controller;
-		#interrupt-cells = <1>;
-		interrupt-parent = <&gic>;
-		interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
-	};
-
-	/* dw_apb_ictl is used as primary interrupt controller */
-	vic: interrupt-controller@10130000 {
-		compatible = "snps,dw-apb-ictl";
-		reg = <0x10130000 0x1000>;
-		interrupt-controller;
-		#interrupt-cells = <1>;
-	};
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +5 -0
new file mode 100644
index 000000000000000..70c12979c843bf0
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/snps,dw-apb-ictl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
Quoted 8 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 10

Quoted 5 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +5 -0
+
+title: Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
+
+maintainers:
+  - Marc Zyngier <[email protected]>

Usually this would be an owner for this IP block, not the subsystem maintainer.

OK, I will change it to the author of the file "snps,dw-apb-ictl.txt".

Quoted 12 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 19

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +9 -0
+
+description:
+  Synopsys DesignWare provides interrupt controller IP for APB known as
+  dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs
+  with APB bus, e.g. Marvell Armada 1500. It can also be used as primary
+  interrupt controller in some SoCs, e.g. Hisilicon SD5203.
+
+allOf:
+  - $ref: /schemas/interrupt-controller.yaml#

You can drop this, it's already applied based on node name.

But if we drop this, the "snps,dw-apb-ictl.yaml" can not require that the node name must match '^interrupt-controller(@[0-9a-f,]+)*$'. The problem of Patch 6/6 was discovered by this.

Quoted 14 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 30

Quoted 12 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +11 -0
+
+properties:
+  compatible:
+    const: snps,dw-apb-ictl
+
+  interrupt-controller: true
+
+  reg:
+    description:
+      Physical base address of the controller and length of memory mapped
+      region starting with ENABLE_LOW register.

Need to define how many reg regions (maxItems: 1).

OK, I will add it.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +10 -0
+
+  interrupts:
+    description:
+      Interrupt reference to primary interrupt controller.
+
+      The interrupt sources map to the corresponding bits in the interrupt
+      registers, i.e.
+      - 0 maps to bit 0 of low interrupts,
+      - 1 maps to bit 1 of low interrupts,
+      - 32 maps to bit 0 of high interrupts,
Quoted 8 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 44

Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +4 -0
+      - 33 maps to bit 1 of high interrupts,
+      - (optional) fast interrupts start at 64.
+    minItems: 1
+    maxItems: 65

65 connections to the primary interrupt controller? I think this is for the child interrupts? If so, move to #interrupt-cells description instead.

Oh, yes. The property "interrupts" here describes which interrupts are used in the primary interrupt controller. We don't known how many will be connected but at least one. I will remove "maxItems: 65", it's my mistake.

Property "#interrupt-cells" describes how many cells of one "interrupts" item. So I will move these descriptions under the top property "properties:"

Quoted 7 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 48

Quoted 5 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +4 -0
+
+  "#interrupt-cells":
+    description:
+      Number of cells to encode an interrupt-specifier.

Drop. No need to redefine common properties.

This is useful. See below, I add "const: 1" to require that the value of "#interrupt-cells" can only be one.

#interrupt-cells = <1>;

I followed the description in "snps,dw-apb-ictl.txt".
-- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1

Quoted 35 lines
Quoted 32 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +27 -0
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+
+examples:
+  - |
+    /* dw_apb_ictl is used as secondary interrupt controller */
+    aic: interrupt-controller@3000 {
+        compatible = "snps,dw-apb-ictl";
+        reg = <0x3000 0xc00>;
+        interrupt-controller;
+        #interrupt-cells = <1>;
+        interrupt-parent = <&gic>;
+        interrupts = <0 3 4>;
+    };
+
+    /* dw_apb_ictl is used as primary interrupt controller */
+    vic: interrupt-controller@10130000 {
+        compatible = "snps,dw-apb-ictl";
+        reg = <0x10130000 0x1000>;
+        interrupt-controller;
+        #interrupt-cells = <1>;
+    };
Signature · 1 line
1.8.3

.

#9 lore raw

Re: [PATCH v5 5/6] dt-bindings: dw-apb-ictl: convert to json-schema

Quoted 139 lines · Leizhen (ThunderTown)
Quoted 72 lines · Rob Herring
Quoted 71 lines · Zhen Lei

Convert the Synopsys DesignWare APB interrupt controller (dw_apb_ictl) binding to DT schema format using json-schema.

---
 .../interrupt-controller/snps,dw-apb-ictl.txt      | 43 -------------
 .../interrupt-controller/snps,dw-apb-ictl.yaml     | 75 ++++++++++++++++++++++
 2 files changed, 75 insertions(+), 43 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.txt deleted +0 -43
deleted file mode 100644
index 2db59df9408f4c6..000000000000000
@@ -1,43 +0,0 @@
-Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
-
-Synopsys DesignWare provides interrupt controller IP for APB known as
-dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs with
-APB bus, e.g. Marvell Armada 1500. It can also be used as primary interrupt
-controller in some SoCs, e.g. Hisilicon SD5203.
-
-Required properties:
-- compatible: shall be "snps,dw-apb-ictl"
-- reg: physical base address of the controller and length of memory mapped
-  region starting with ENABLE_LOW register
-- interrupt-controller: identifies the node as an interrupt controller
-- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1
-
-Additional required property when it's used as secondary interrupt controller:
-- interrupts: interrupt reference to primary interrupt controller
-
-The interrupt sources map to the corresponding bits in the interrupt
-registers, i.e.
-- 0 maps to bit 0 of low interrupts,
-- 1 maps to bit 1 of low interrupts,
-- 32 maps to bit 0 of high interrupts,
-- 33 maps to bit 1 of high interrupts,
-- (optional) fast interrupts start at 64.
-
-Example:
-	/* dw_apb_ictl is used as secondary interrupt controller */
-	aic: interrupt-controller@3000 {
-		compatible = "snps,dw-apb-ictl";
-		reg = <0x3000 0xc00>;
-		interrupt-controller;
-		#interrupt-cells = <1>;
-		interrupt-parent = <&gic>;
-		interrupts = <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>;
-	};
-
-	/* dw_apb_ictl is used as primary interrupt controller */
-	vic: interrupt-controller@10130000 {
-		compatible = "snps,dw-apb-ictl";
-		reg = <0x10130000 0x1000>;
-		interrupt-controller;
-		#interrupt-cells = <1>;
-	};
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +5 -0
new file mode 100644
index 000000000000000..70c12979c843bf0
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/snps,dw-apb-ictl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
Quoted 8 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 10

Quoted 5 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +5 -0
+
+title: Synopsys DesignWare APB interrupt controller (dw_apb_ictl)
+
+maintainers:
+  - Marc Zyngier <[email protected]>

Usually this would be an owner for this IP block, not the subsystem maintainer.

OK, I will change it to the author of the file "snps,dw-apb-ictl.txt".

Quoted 12 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 19

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +9 -0
+
+description:
+  Synopsys DesignWare provides interrupt controller IP for APB known as
+  dw_apb_ictl. The IP is used as secondary interrupt controller in some SoCs
+  with APB bus, e.g. Marvell Armada 1500. It can also be used as primary
+  interrupt controller in some SoCs, e.g. Hisilicon SD5203.
+
+allOf:
+  - $ref: /schemas/interrupt-controller.yaml#

You can drop this, it's already applied based on node name.

But if we drop this, the "snps,dw-apb-ictl.yaml" can not require that the node name must match '^interrupt-controller(@[0-9a-f,]+)*$'. The problem of Patch 6/6 was discovered by this.

Quoted 14 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 30

Quoted 12 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +11 -0
+
+properties:
+  compatible:
+    const: snps,dw-apb-ictl
+
+  interrupt-controller: true
+
+  reg:
+    description:
+      Physical base address of the controller and length of memory mapped
+      region starting with ENABLE_LOW register.

Need to define how many reg regions (maxItems: 1).

OK, I will add it.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +10 -0
+
+  interrupts:
+    description:
+      Interrupt reference to primary interrupt controller.
+
+      The interrupt sources map to the corresponding bits in the interrupt
+      registers, i.e.
+      - 0 maps to bit 0 of low interrupts,
+      - 1 maps to bit 1 of low interrupts,
+      - 32 maps to bit 0 of high interrupts,
Quoted 8 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 44

Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +4 -0
+      - 33 maps to bit 1 of high interrupts,
+      - (optional) fast interrupts start at 64.
+    minItems: 1
+    maxItems: 65

65 connections to the primary interrupt controller? I think this is for the child interrupts? If so, move to #interrupt-cells description instead.

Quoted 3 lines

Oh, yes. The property "interrupts" here describes which interrupts are used in the primary interrupt controller. We don't known how many will be connected but at least one. I will remove "maxItems: 65", it's my mistake.

Oh, I think I should change "minItems: 1" to "maxItems: 1" further, because there is only one connection currently.

Quoted 55 lines

Property "#interrupt-cells" describes how many cells of one "interrupts" item. So I will move these descriptions under the top property "properties:"

Quoted 7 lines

Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml line 48

Quoted 5 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +4 -0
+
+  "#interrupt-cells":
+    description:
+      Number of cells to encode an interrupt-specifier.

Drop. No need to redefine common properties.

This is useful. See below, I add "const: 1" to require that the value of "#interrupt-cells" can only be one.

#interrupt-cells = <1>;

I followed the description in "snps,dw-apb-ictl.txt".
-- #interrupt-cells: number of cells to encode an interrupt-specifier, shall be 1

Quoted 35 lines
Quoted 32 lines
Documentation/devicetree/bindings/interrupt-controller/snps,dw-apb-ictl.yaml new file +27 -0
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+
+examples:
+  - |
+    /* dw_apb_ictl is used as secondary interrupt controller */
+    aic: interrupt-controller@3000 {
+        compatible = "snps,dw-apb-ictl";
+        reg = <0x3000 0xc00>;
+        interrupt-controller;
+        #interrupt-cells = <1>;
+        interrupt-parent = <&gic>;
+        interrupts = <0 3 4>;
+    };
+
+    /* dw_apb_ictl is used as primary interrupt controller */
+    vic: interrupt-controller@10130000 {
+        compatible = "snps,dw-apb-ictl";
+        reg = <0x10130000 0x1000>;
+        interrupt-controller;
+        #interrupt-cells = <1>;
+    };
Signature · 1 line
1.8.3

.

author
#10 lore raw

PATCH v5 6/6 ARC: [dts] fix the errors detected by dtbs_check

In reply to Zhen Lei

xxx/arc/boot/dts/axs101.dt.yaml: dw-apb-ictl@e0012000: $nodename:0: \
'dw-apb-ictl@e0012000' does not match '^interrupt-controller(@[0-9a-f,]+)*$' From schema: xxx/interrupt-controller/snps,dw-apb-ictl.yaml

The node name of the interrupt controller must start with "interrupt-controller" instead of "dw-apb-ictl".

---
 arch/arc/boot/dts/axc001.dtsi         | 2 +-
 arch/arc/boot/dts/axc003.dtsi         | 2 +-
 arch/arc/boot/dts/axc003_idu.dtsi     | 2 +-
 arch/arc/boot/dts/vdk_axc003.dtsi     | 2 +-
 arch/arc/boot/dts/vdk_axc003_idu.dtsi | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)
arch/arc/boot/dts/axc001.dtsi +1 -1
index 79ec27c043c1da7..2a151607b08057c 100644
@@ -91,7 +91,7 @@
 	 * avoid duplicating the MB dtsi file given that IRQ from
 	 * this intc to cpu intc are different for axs101 and axs103
 	 */
-	mb_intc: dw-apb-ictl@e0012000 {
+	mb_intc: interrupt-controller@e0012000 {
 		#interrupt-cells = <1>;
 		compatible = "snps,dw-apb-ictl";
 		reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/axc003.dtsi +1 -1
index ac8e1b463a70992..cd1edcf4f95efe6 100644
@@ -129,7 +129,7 @@
 	 * avoid duplicating the MB dtsi file given that IRQ from
 	 * this intc to cpu intc are different for axs101 and axs103
 	 */
-	mb_intc: dw-apb-ictl@e0012000 {
+	mb_intc: interrupt-controller@e0012000 {
 		#interrupt-cells = <1>;
 		compatible = "snps,dw-apb-ictl";
 		reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/axc003_idu.dtsi +1 -1
index 9da21e7fd246f9f..70779386ca7963a 100644
@@ -135,7 +135,7 @@
 	 * avoid duplicating the MB dtsi file given that IRQ from
 	 * this intc to cpu intc are different for axs101 and axs103
 	 */
-	mb_intc: dw-apb-ictl@e0012000 {
+	mb_intc: interrupt-controller@e0012000 {
 		#interrupt-cells = <1>;
 		compatible = "snps,dw-apb-ictl";
 		reg = < 0x0 0xe0012000 0x0 0x200 >;
arch/arc/boot/dts/vdk_axc003.dtsi +1 -1
index f8be7ba8dad499c..c21d0eb07bf6737 100644
@@ -46,7 +46,7 @@
 
 	};
 
-	mb_intc: dw-apb-ictl@e0012000 {
+	mb_intc: interrupt-controller@e0012000 {
 		#interrupt-cells = <1>;
 		compatible = "snps,dw-apb-ictl";
 		reg = < 0xe0012000 0x200 >;
arch/arc/boot/dts/vdk_axc003_idu.dtsi +1 -1
index 0afa3e53a4e3932..4d348853ac7c5dc 100644
@@ -54,7 +54,7 @@
 
 	};
 
-	mb_intc: dw-apb-ictl@e0012000 {
+	mb_intc: interrupt-controller@e0012000 {
 		#interrupt-cells = <1>;
 		compatible = "snps,dw-apb-ictl";
 		reg = < 0xe0012000 0x200 >;
Signature · 1 line
1.8.3