Skip to contentSkip to conversation

Initial support for the Realtek interrupt controller

PATCH In review James Tai 3 participants 10 messages Dec 28, 2023 – Jan 9, 2024

Subsystems (2)
lore
Share & tools
lore

James Tai

author
#0 lore raw

v4 cover Initial support for the Realtek interrupt controller

Introduce an interrupt controller driver for Realtek DHC (Digital Home Center) SoCs.

Change log:
v3 -> v4:
- Adjusted the allOf block to add constraints on the interrupts per variant
- Adjusted the error path and label
- Added the 'irq_domain_remove' to the error path
- Removed the 'devm_kfree' from the error path
- Replaced the 'irq_of_parse_and_map' with 'of_irq_get'
- Replaced the 'raw_spin_lock' with 'raw_spin_lock_irqsave'
- Adjusted the return value of the 'realtek_intc_subset'
- Replaced the '~1' with macro 'CLEAN_INTC_STATUS'
- Improved code comments and description
- Fixed coding style issues
- Fixed the incorrect control register in mask and unmask functions
- Changed the 'EXPORT_SYMBOL' to the 'EXPORT_SYMBOL_GPL'
- Renamed the 'realtek_intc_subset_cfg' to 'realtek_intc_mask'
- Removed unused and unnecessary code
- Removed 'irq_enable' and 'irq_disable' callback
- Replaced the 'core_initcall' with 'module_init'
- Removed redundant header files
- Moved the function of suspend and resume to common code
- Improved the description of config

v2 -> v3:
- Retested the bindings using the new version of the dtschema
- Fixed the order of property items
- Removed redundant files and replaced them with 'realtek,intc.yaml'
- Replaced 'interrupts-extended' with 'interrupts'
- Added a description for 'interrupts'
- Reduced the example code
- Resolved kernel test robot build warnings

v1 -> v2:
- Tested the bindings using 'make dt_binding_check'
- Fixed code style issues
- Resolved kernel test robot build warnings
- Replaced spin_lock_irqsave with raw_spin_lock
- Replaced magic number with macro
- Removed the realtek_intc_set_affinity function

James Tai (6):
dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs
irqchip: Add interrupt controller support for Realtek DHC SoCs
irqchip: Introduce RTD1319 support using the Realtek common interrupt
controller driver
irqchip: Introduce RTD1319D support using the Realtek common interrupt
controller driver
irqchip: Introduce RTD1325 support using the Realtek common interrupt
controller driver
irqchip: Introduce RTD1619B support using the Realtek common interrupt
controller driver

 .../interrupt-controller/realtek,intc.yaml    | 131 +++++++++++
 drivers/irqchip/Kconfig                       |  44 ++++
 drivers/irqchip/Makefile                      |   5 +
 drivers/irqchip/irq-realtek-intc-common.c     | 211 ++++++++++++++++++
 drivers/irqchip/irq-realtek-intc-common.h     |  76 +++++++
 drivers/irqchip/irq-realtek-rtd1319.c         | 187 ++++++++++++++++
 drivers/irqchip/irq-realtek-rtd1319d.c        | 196 ++++++++++++++++
 drivers/irqchip/irq-realtek-rtd1325.c         | 196 ++++++++++++++++
 drivers/irqchip/irq-realtek-rtd1619b.c        | 186 +++++++++++++++
 9 files changed, 1232 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml
 create mode 100644 drivers/irqchip/irq-realtek-intc-common.c
 create mode 100644 drivers/irqchip/irq-realtek-intc-common.h
 create mode 100644 drivers/irqchip/irq-realtek-rtd1319.c
 create mode 100644 drivers/irqchip/irq-realtek-rtd1319d.c
 create mode 100644 drivers/irqchip/irq-realtek-rtd1325.c
 create mode 100644 drivers/irqchip/irq-realtek-rtd1619b.c
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v4 1/6 dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs

Add the YAML documentation for Realtek DHC (Digital Home Center) SoCs.

---
CC: Thomas Gleixner <[email protected]>
CC: Marc Zyngier <[email protected]>
CC: Rob Herring <[email protected]>
CC: Krzysztof Kozlowski <[email protected]>
CC: Conor Dooley <[email protected]>
CC: [email protected]
CC: [email protected]

v3 to v4 change:
- Adjusted the allOf block to add constraints on the interrupts per variant

v2 to v3 change:
- Retested the bindings using the new version of the dtschema
- Fixed the order of property items
- Removed redundant files and replaced them with 'realtek,intc.yaml'
- Replaced 'interrupts-extended' with 'interrupts'
- Added a description for 'interrupts'
- Reduced the example code

v1 to v2 change:
- Tested the bindings using 'make dt_binding_check'
- Fixed code style issues

 .../interrupt-controller/realtek,intc.yaml    | 131 ++++++++++++++++++
 1 file changed, 131 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +131 -0
new file mode 100644
index 000000000000..d3e4919850cc
@@ -0,0 +1,131 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/realtek,intc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek DHC SoCs Interrupt Controller
+
+maintainers:
+  - James Tai <[email protected]>
+
+description:
+  This interrupt controller is a component of Realtek DHC (Digital Home Center)
+  SoCs and is designed to receive interrupts from peripheral devices.
+
+  Each DHC SoC has two sets of interrupt controllers, each capable of
+  handling up to 32 interrupts.
+
+properties:
+  compatible:
+    enum:
+      - realtek,rtd1319-intc-iso
+      - realtek,rtd1319-intc-misc
+      - realtek,rtd1319d-intc-iso
+      - realtek,rtd1319d-intc-misc
+      - realtek,rtd1325-intc-iso
+      - realtek,rtd1325-intc-misc
+      - realtek,rtd1619b-intc-iso
+      - realtek,rtd1619b-intc-misc
+
+  reg:
+    maxItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 1
+
+  '#address-cells':
+    const: 0
+
+  interrupts:
+    minItems: 1
+    maxItems: 3
+    description:
+      Contains the GIC SPI IRQs mapped to the external interrupt lines.
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+  - '#address-cells'
+  - interrupts
+
+additionalProperties: false
+
+allOf:
+  - $ref: /schemas/interrupt-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          enum:
+            - realtek,rtd1319-intc-iso
+    then:
+      properties:
+        interrupts:
+          minItems: 1
+          items:
+            - description: isolation irqs
+            - description: rtc irq
+  - if:
+      properties:
+        compatible:
+          enum:
+            - realtek,rtd1319d-intc-iso
+            - realtek,rtd1325-intc-iso
+            - realtek,rtd1619b-intc-iso
+    then:
+      properties:
+        interrupts:
+          minItems: 1
+          items:
+            - description: isolation irqs
+            - description: watchdog irq
+  - if:
+      properties:
+        compatible:
+          enum:
+            - realtek,rtd1319-intc-misc
+    then:
+      properties:
+        interrupts:
+          minItems: 3
+          items:
+            - description: miscellaneous irqs
+            - description: watchdog irq
+            - description: uart1 irq
+            - description: uart2 irq
+  - if:
+      properties:
+        compatible:
+          enum:
+            - realtek,rtd1319d-intc-misc
+            - realtek,rtd1325-intc-misc
+            - realtek,rtd1619b-intc-misc
+    then:
+      properties:
+        interrupts:
+          minItems: 2
+          items:
+            - description: miscellaneous irqs
+            - description: uart1 irq
+            - description: uart2 irq
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    realtek_iso_intc: interrupt-controller@40 {
+      compatible = "realtek,rtd1319-intc-iso";
+      reg = <0x00 0x40>;
+      interrupt-parent = <&gic>;
+      interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
+                   <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>;
+      interrupt-controller;
+      #address-cells = <0>;
+      #interrupt-cells = <1>;
+    };
+...
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v4 1/6] dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs

Quoted 3 lines · James Tai

Add the YAML documentation for Realtek DHC (Digital Home Center) SoCs.

Thank you for your patch. There is something to discuss/improve.

Quoted 7 lines
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +7 -0
+  interrupts:
+    minItems: 1
+    maxItems: 3
+    description:
+      Contains the GIC SPI IRQs mapped to the external interrupt lines.
+
+required:

Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml line 58

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +10 -0
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+  - '#address-cells'
+  - interrupts
+
+additionalProperties: false
+
+allOf:

If there is going to be new version/resend, allOf: block goes before additionalProperties:.

Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml line 68

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +10 -0
+  - $ref: /schemas/interrupt-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          enum:
+            - realtek,rtd1319-intc-iso
+    then:
+      properties:
+        interrupts:
+          minItems: 1

Why the second interrupt is optional? It's a SoC, the pins are not configurable usually. Same question for other cases.

Quoted 1 line

+...

Best regards,
Krzysztof

#3 lore raw

RE: [PATCH v4 1/6] dt-bindings: interrupt-controller: Add support for Realtek DHC SoCs

Hi Krzysztof,

Quoted 18 lines
Quoted 3 lines

Add the YAML documentation for Realtek DHC (Digital Home Center) SoCs.

Thank you for your patch. There is something to discuss/improve.

Quoted 12 lines
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +12 -0
+  interrupts:
+    minItems: 1
+    maxItems: 3
+    description:
+      Contains the GIC SPI IRQs mapped to the external interrupt lines.
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+  - '#address-cells'
Quoted 9 lines

Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml line 58

Quoted 5 lines
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +5 -0
+  - interrupts
+
+additionalProperties: false
+
+allOf:

If there is going to be new version/resend, allOf: block goes before additionalProperties:.

I will move the 'allOf: block' to go before 'additionalPropertie' in next patches.

Quoted 11 lines

Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml line 68

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/realtek,intc.yaml new file +10 -0
+  - $ref: /schemas/interrupt-controller.yaml#
+  - if:
+      properties:
+        compatible:
+          enum:
+            - realtek,rtd1319-intc-iso
+    then:
+      properties:
+        interrupts:
+          minItems: 1
Quoted 3 lines

Why the second interrupt is optional? It's a SoC, the pins are not configurable usually. Same question for other cases.

I thought it was defined this way to accommodate different SoCs.
I will remove the 'minItems'. Should the correct version look like the following?

allOf:
- $ref: /schemas/interrupt-controller.yaml#
- if:
properties:
compatible:
enum:
- realtek,rtd1319-intc-iso
then:
properties:
interrupts:
items:
- description: isolation irqs
- description: rtc irq
...
...

Thanks for your feedback.

Regards,
James

author
#4 lore raw

PATCH v4 2/6 irqchip: Add interrupt controller support for Realtek DHC SoCs

In reply to James Tai

Realtek DHC (Digital Home Center) SoCs share a common interrupt controller design. This universal interrupt controller driver provides support for various variants within the Realtek DHC SoC family.

Each DHC SoC features two sets of extended interrupt controllers, each capable of handling up to 32 interrupts. These expansion controllers are connected to the GIC (Generic Interrupt Controller).

---
CC: Thomas Gleixner <[email protected]>
CC: Marc Zyngier <[email protected]>
CC: [email protected]

v3 to v4 change:
- Adjusted the error path and label
- Added the 'irq_domain_remove' to the error path
- Removed the 'devm_kfree' from the error path
- Replaced the 'irq_of_parse_and_map' with 'of_irq_get'
- Replaced the 'raw_spin_lock' with 'raw_spin_lock_irqsave'
- Adjusted the return value of the 'realtek_intc_subset'
- Replaced the '~1' with macro 'CLEAN_INTC_STATUS'
- Improved code comments and description
- Fixed coding style issues
- Fixed the incorrect control register in mask and unmask functions
- Changed the 'EXPORT_SYMBOL' to the 'EXPORT_SYMBOL_GPL'
- Renamed the 'realtek_intc_subset_cfg' to 'realtek_intc_mask'
- Removed unused and unnecessary code
- Removed 'irq_enable' and 'irq_disable' callback

v2 to v3 change:
- Resolved kernel test robot build warnings
https://lore.kernel.org/r/[email protected]/

v1 to v2 change:
- Fixed code style issues
- Removed the realtek_intc_set_affinity funcation
- Replaced spin_lock_irqsave with raw_spin_lock

 drivers/irqchip/Kconfig                   |   4 +
 drivers/irqchip/Makefile                  |   1 +
 drivers/irqchip/irq-realtek-intc-common.c | 211 ++++++++++++++++++++++
 drivers/irqchip/irq-realtek-intc-common.h |  76 ++++++++
 4 files changed, 292 insertions(+)
 create mode 100644 drivers/irqchip/irq-realtek-intc-common.c
 create mode 100644 drivers/irqchip/irq-realtek-intc-common.h
drivers/irqchip/Kconfig +4 -0
index f7149d0f3d45..267c3429b48d 100644
@@ -218,6 +218,10 @@ config RDA_INTC
 	bool
 	select IRQ_DOMAIN
 
+config REALTEK_DHC_INTC
+	tristate
+	select IRQ_DOMAIN
+
 config RENESAS_INTC_IRQPIN
 	bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST
 	select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
index ffd945fe71aa..f6774af7fde2 100644
@@ -47,6 +47,7 @@ obj-$(CONFIG_IRQ_MIPS_CPU)		+= irq-mips-cpu.o
 obj-$(CONFIG_IXP4XX_IRQ)		+= irq-ixp4xx.o
 obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RDA_INTC)			+= irq-rda-intc.o
+obj-$(CONFIG_REALTEK_DHC_INTC)		+= irq-realtek-intc-common.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_RENESAS_RZA1_IRQC)		+= irq-renesas-rza1.o
drivers/irqchip/irq-realtek-intc-common.c new file +211 -0

211 lines not on this page · raw message

drivers/irqchip/irq-realtek-intc-common.h new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#5 lore raw

PATCH v4 3/6 irqchip: Introduce RTD1319 support using the Realtek common interrupt controller driver

In reply to James Tai

Add support for the RTD1319 platform.

---
CC: Thomas Gleixner <[email protected]>
CC: Marc Zyngier <[email protected]>
CC: [email protected]

v3 to v4 change:
- Replaced the 'core_initcall' with 'module_init'
- Removed redundant header files
- Moved the function of suspend and resume to common code
- Improved the description of config

v2 to v3 change:
- Unchanged

v1 to v2 change:
- Resolved kernel test robot build warnings
- Replaced magic number with macro
- Fixed code style issues

 drivers/irqchip/Kconfig               |  10 ++
 drivers/irqchip/Makefile              |   1 +
 drivers/irqchip/irq-realtek-rtd1319.c | 187 ++++++++++++++++++++++++++
 3 files changed, 198 insertions(+)
 create mode 100644 drivers/irqchip/irq-realtek-rtd1319.c
drivers/irqchip/Kconfig +10 -0
index 267c3429b48d..b17006ff38c4 100644
@@ -222,6 +222,16 @@ config REALTEK_DHC_INTC
 	tristate
 	select IRQ_DOMAIN
 
+config REALTEK_RTD1319_INTC
+	tristate "Realtek RTD1319 interrupt controller"
+	select REALTEK_DHC_INTC
+	help
+	  Enable support for the Realtek RTD1319 SoC Interrupt Controller.
+	  Each Realtek DHC SoC has two sets of interrupt controllers, each
+	  capable of handling up to 32 interrupts.
+
+	  If unsure, say N.
+
 config RENESAS_INTC_IRQPIN
 	bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST
 	select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
index f6774af7fde2..6a2650b0a924 100644
@@ -48,6 +48,7 @@ obj-$(CONFIG_IXP4XX_IRQ)		+= irq-ixp4xx.o
 obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RDA_INTC)			+= irq-rda-intc.o
 obj-$(CONFIG_REALTEK_DHC_INTC)		+= irq-realtek-intc-common.o
+obj-$(CONFIG_REALTEK_RTD1319_INTC)	+= irq-realtek-rtd1319.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_RENESAS_RZA1_IRQC)		+= irq-renesas-rza1.o
drivers/irqchip/irq-realtek-rtd1319.c new file +187 -0

187 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#6 lore raw

PATCH v4 4/6 irqchip: Introduce RTD1319D support using the Realtek common interrupt controller driver

In reply to James Tai

Add support for the RTD1319D platform.

---
CC: Thomas Gleixner <[email protected]>
CC: Marc Zyngier <[email protected]>
CC: [email protected]

v3 to v4 change:
- Replaced the 'core_initcall' with 'module_init'
- Removed redundant header files
- Moved the function of suspend and resume to common code
- Improved the description of config

v2 to v3 change:
- Unchanged

v1 to v2 change:
- Resolved kernel test robot build warnings
- Replaced magic number with macro
- Fixed code style issues

 drivers/irqchip/Kconfig                |  10 ++
 drivers/irqchip/Makefile               |   1 +
 drivers/irqchip/irq-realtek-rtd1319d.c | 196 +++++++++++++++++++++++++
 3 files changed, 207 insertions(+)
 create mode 100644 drivers/irqchip/irq-realtek-rtd1319d.c
drivers/irqchip/Kconfig +10 -0
index b17006ff38c4..e34312ef7cd4 100644
@@ -232,6 +232,16 @@ config REALTEK_RTD1319_INTC
 
 	  If unsure, say N.
 
+config REALTEK_RTD1319D_INTC
+	tristate "Realtek RTD1319D interrupt controller"
+	select REALTEK_DHC_INTC
+	help
+	  Enable support for the Realtek RTD1319D SoC Interrupt Controller.
+	  Each Realtek DHC SoC has two sets of interrupt controllers, each
+	  capable of handling up to 32 interrupts.
+
+	  If unsure, say N.
+
 config RENESAS_INTC_IRQPIN
 	bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST
 	select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
index 6a2650b0a924..c8adaed4c1b2 100644
@@ -49,6 +49,7 @@ obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RDA_INTC)			+= irq-rda-intc.o
 obj-$(CONFIG_REALTEK_DHC_INTC)		+= irq-realtek-intc-common.o
 obj-$(CONFIG_REALTEK_RTD1319_INTC)	+= irq-realtek-rtd1319.o
+obj-$(CONFIG_REALTEK_RTD1319D_INTC)	+= irq-realtek-rtd1319d.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_RENESAS_RZA1_IRQC)		+= irq-renesas-rza1.o
drivers/irqchip/irq-realtek-rtd1319d.c new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
2.25.1
#7 lore raw

Re: [PATCH v4 4/6] irqchip: Introduce RTD1319D support using the Realtek common interrupt controller driver

kernel test robot noticed the following build errors:

Hi James,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on robh/for-next linus/master v6.7 next-20240108] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/James-Tai/dt-bindings-interrupt-controller-Add-support-for-Realtek-DHC-SoCs/20231228-141213
base:   tip/irq/core
patch link:    https://lore.kernel.org/r/20231228060825.1380439-5-james.tai%40realtek.com
patch subject: [PATCH v4 4/6] irqchip: Introduce RTD1319D support using the Realtek common interrupt controller driver
config: s390-randconfig-r113-20240109 (https://download.01.org/0day-ci/archive/20240109/[email protected]/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 7e186d366d6c7def0543acc255931f617e76dff0)
reproduce: (https://download.01.org/0day-ci/archive/20240109/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/irqchip/irq-realtek-intc-common.c:8:
In file included from include/linux/irqchip.h:17:
In file included from include/linux/of_irq.h:7:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:78:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]

     547 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     560 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
         |                                                           ^
   include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
     102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
         |                                                      ^
   In file included from drivers/irqchip/irq-realtek-intc-common.c:8:
   In file included from include/linux/irqchip.h:17:
   In file included from include/linux/of_irq.h:7:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:78:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     573 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
         |                                                           ^
   include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
     115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
         |                                                      ^
   In file included from drivers/irqchip/irq-realtek-intc-common.c:8:
   In file included from include/linux/irqchip.h:17:
   In file included from include/linux/of_irq.h:7:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/s390/include/asm/io.h:78:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     584 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     594 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     604 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     692 |         readsb(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     700 |         readsw(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     708 |         readsl(PCI_IOBASE + addr, buffer, count);
         |                ~~~~~~~~~~ ^
   include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     717 |         writesb(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     726 |         writesw(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
   include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     735 |         writesl(PCI_IOBASE + addr, buffer, count);
         |                 ~~~~~~~~~~ ^
>> drivers/irqchip/irq-realtek-intc-common.c:204:3: error: call to undeclared function 'iounmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     204 |                 iounmap(data->base);
         |                 ^
   arch/s390/include/asm/io.h:29:17: note: expanded from macro 'iounmap'
      29 | #define iounmap iounmap
         |                 ^
   drivers/irqchip/irq-realtek-intc-common.c:204:3: note: did you mean 'vunmap'?
   arch/s390/include/asm/io.h:29:17: note: expanded from macro 'iounmap'
      29 | #define iounmap iounmap
         |                 ^
   include/linux/vmalloc.h:167:13: note: 'vunmap' declared here
     167 | extern void vunmap(const void *addr);
         |             ^

12 warnings and 1 error generated.

vim +/iounmap +204 drivers/irqchip/irq-realtek-intc-common.c

59fe9dce1f284e James Tai 2023-12-28  161  
59fe9dce1f284e James Tai 2023-12-28  162  int realtek_intc_probe(struct platform_device *pdev, const struct realtek_intc_info *info)
59fe9dce1f284e James Tai 2023-12-28  163  {
59fe9dce1f284e James Tai 2023-12-28  164  	struct realtek_intc_data *data;
59fe9dce1f284e James Tai 2023-12-28  165  	struct device *dev = &pdev->dev;
59fe9dce1f284e James Tai 2023-12-28  166  	struct device_node *node = dev->of_node;
59fe9dce1f284e James Tai 2023-12-28  167  	int ret, i;
59fe9dce1f284e James Tai 2023-12-28  168  
59fe9dce1f284e James Tai 2023-12-28  169  	data = devm_kzalloc(dev, struct_size(data, subset_data, info->subset_num), GFP_KERNEL);
59fe9dce1f284e James Tai 2023-12-28  170  	if (!data)
59fe9dce1f284e James Tai 2023-12-28  171  		return -ENOMEM;
59fe9dce1f284e James Tai 2023-12-28  172  
59fe9dce1f284e James Tai 2023-12-28  173  	data->base = of_iomap(node, 0);
59fe9dce1f284e James Tai 2023-12-28  174  	if (!data->base)
59fe9dce1f284e James Tai 2023-12-28  175  		goto iomap_cleanup;
59fe9dce1f284e James Tai 2023-12-28  176  
59fe9dce1f284e James Tai 2023-12-28  177  	data->info = info;
59fe9dce1f284e James Tai 2023-12-28  178  
59fe9dce1f284e James Tai 2023-12-28  179  	raw_spin_lock_init(&data->lock);
59fe9dce1f284e James Tai 2023-12-28  180  
59fe9dce1f284e James Tai 2023-12-28  181  	data->domain = irq_domain_add_linear(node, 32, &realtek_intc_domain_ops, data);
59fe9dce1f284e James Tai 2023-12-28  182  	if (!data->domain)
59fe9dce1f284e James Tai 2023-12-28  183  		goto iomap_cleanup;
59fe9dce1f284e James Tai 2023-12-28  184  
59fe9dce1f284e James Tai 2023-12-28  185  	data->subset_data_num = info->subset_num;
59fe9dce1f284e James Tai 2023-12-28  186  	for (i = 0; i < info->subset_num; i++) {
59fe9dce1f284e James Tai 2023-12-28  187  		ret = realtek_intc_subset(node, data, i);
59fe9dce1f284e James Tai 2023-12-28  188  		if (ret <= 0) {
59fe9dce1f284e James Tai 2023-12-28  189  			dev_err(dev, "failed to init subset %d: %d", i, ret);
59fe9dce1f284e James Tai 2023-12-28  190  			goto irq_domain_cleanup;
59fe9dce1f284e James Tai 2023-12-28  191  		}
59fe9dce1f284e James Tai 2023-12-28  192  	}
59fe9dce1f284e James Tai 2023-12-28  193  
59fe9dce1f284e James Tai 2023-12-28  194  	platform_set_drvdata(pdev, data);
59fe9dce1f284e James Tai 2023-12-28  195  
59fe9dce1f284e James Tai 2023-12-28  196  	return 0;
59fe9dce1f284e James Tai 2023-12-28  197  
59fe9dce1f284e James Tai 2023-12-28  198  irq_domain_cleanup:
59fe9dce1f284e James Tai 2023-12-28  199  	if (data->domain)
59fe9dce1f284e James Tai 2023-12-28  200  		irq_domain_remove(data->domain);
59fe9dce1f284e James Tai 2023-12-28  201  
59fe9dce1f284e James Tai 2023-12-28  202  iomap_cleanup:
59fe9dce1f284e James Tai 2023-12-28  203  	if (data->base)
59fe9dce1f284e James Tai 2023-12-28 @204  		iounmap(data->base);
59fe9dce1f284e James Tai 2023-12-28  205  
59fe9dce1f284e James Tai 2023-12-28  206  	return -ENOMEM;
59fe9dce1f284e James Tai 2023-12-28  207  }
59fe9dce1f284e James Tai 2023-12-28  208  EXPORT_SYMBOL_GPL(realtek_intc_probe);
59fe9dce1f284e James Tai 2023-12-28  209  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author
#8 lore raw

PATCH v4 5/6 irqchip: Introduce RTD1325 support using the Realtek common interrupt controller driver

In reply to James Tai

Add support for the RTD1325 platform.

---
CC: Thomas Gleixner <[email protected]>
CC: Marc Zyngier <[email protected]>
CC: [email protected]

v3 to v4 change:
- Replaced the 'core_initcall' with 'module_init'
- Removed redundant header files
- Moved the function of suspend and resume to common code
- Improved the description of config

v2 to v3 change:
- Unchanged

v1 to v2 change:
- Resolved kernel test robot build warnings
- Replaced magic number with macro
- Fixed code style issues

 drivers/irqchip/Kconfig               |  10 ++
 drivers/irqchip/Makefile              |   1 +
 drivers/irqchip/irq-realtek-rtd1325.c | 196 ++++++++++++++++++++++++++
 3 files changed, 207 insertions(+)
 create mode 100644 drivers/irqchip/irq-realtek-rtd1325.c
drivers/irqchip/Kconfig +10 -0
index e34312ef7cd4..9354445ea0bb 100644
@@ -242,6 +242,16 @@ config REALTEK_RTD1319D_INTC
 
 	  If unsure, say N.
 
+config REALTEK_RTD1325_INTC
+	tristate "Realtek RTD1325 interrupt controller"
+	select REALTEK_DHC_INTC
+	help
+	  Enable support for the Realtek RTD1325 SoC Interrupt Controller.
+	  Each Realtek DHC SoC has two sets of interrupt controllers, each
+	  capable of handling up to 32 interrupts.
+
+	  If unsure, say N.
+
 config RENESAS_INTC_IRQPIN
 	bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST
 	select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
index c8adaed4c1b2..eaa12928d60b 100644
@@ -50,6 +50,7 @@ obj-$(CONFIG_RDA_INTC)			+= irq-rda-intc.o
 obj-$(CONFIG_REALTEK_DHC_INTC)		+= irq-realtek-intc-common.o
 obj-$(CONFIG_REALTEK_RTD1319_INTC)	+= irq-realtek-rtd1319.o
 obj-$(CONFIG_REALTEK_RTD1319D_INTC)	+= irq-realtek-rtd1319d.o
+obj-$(CONFIG_REALTEK_RTD1325_INTC)	+= irq-realtek-rtd1325.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_RENESAS_RZA1_IRQC)		+= irq-renesas-rza1.o
drivers/irqchip/irq-realtek-rtd1325.c new file +196 -0

196 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#9 lore raw

PATCH v4 6/6 irqchip: Introduce RTD1619B support using the Realtek common interrupt controller driver

In reply to James Tai

Add support for the RTD1619B platform.

---
CC: Thomas Gleixner <[email protected]>
CC: Marc Zyngier <[email protected]>
CC: [email protected]

v3 to v4 change:
- Replaced the 'core_initcall' with 'module_init'
- Removed redundant header files
- Moved the function of suspend and resume to common code
- Improved the description of config

v2 to v3 change:
- Unchanged

v1 to v2 change:
- Resolved kernel test robot build warnings
- Replaced magic number with macro
- Fixed code style issues

 drivers/irqchip/Kconfig                |  10 ++
 drivers/irqchip/Makefile               |   1 +
 drivers/irqchip/irq-realtek-rtd1619b.c | 186 +++++++++++++++++++++++++
 3 files changed, 197 insertions(+)
 create mode 100644 drivers/irqchip/irq-realtek-rtd1619b.c
drivers/irqchip/Kconfig +10 -0
index 9354445ea0bb..0dc2a16dce70 100644
@@ -252,6 +252,16 @@ config REALTEK_RTD1325_INTC
 
 	  If unsure, say N.
 
+config REALTEK_RTD1619B_INTC
+	tristate "Realtek RTD1619B interrupt controller"
+	select REALTEK_DHC_INTC
+	help
+	  Enable support for the Realtek RTD1619B SoC Interrupt Controller.
+	  Each Realtek DHC SoC has two sets of interrupt controllers, each
+	  capable of handling up to 32 interrupts.
+
+	  If unsure, say N.
+
 config RENESAS_INTC_IRQPIN
 	bool "Renesas INTC External IRQ Pin Support" if COMPILE_TEST
 	select IRQ_DOMAIN
drivers/irqchip/Makefile +1 -0
index eaa12928d60b..da308aefcb87 100644
@@ -51,6 +51,7 @@ obj-$(CONFIG_REALTEK_DHC_INTC)		+= irq-realtek-intc-common.o
 obj-$(CONFIG_REALTEK_RTD1319_INTC)	+= irq-realtek-rtd1319.o
 obj-$(CONFIG_REALTEK_RTD1319D_INTC)	+= irq-realtek-rtd1319d.o
 obj-$(CONFIG_REALTEK_RTD1325_INTC)	+= irq-realtek-rtd1325.o
+obj-$(CONFIG_REALTEK_RTD1619B_INTC)	+= irq-realtek-rtd1619b.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_RENESAS_RZA1_IRQC)		+= irq-renesas-rza1.o
drivers/irqchip/irq-realtek-rtd1619b.c new file +186 -0

186 lines not on this page · raw message

Signature · 1 line
2.25.1