* [PATCH 0/3] irqchip: Add GPIO interrupt support for Amlogic A9
@ 2026-05-08 7:36 Xianwei Zhao via B4 Relay
2026-05-08 7:36 ` [PATCH 1/3] irqchip/meson-gpio: fix incorrect register address Xianwei Zhao via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Xianwei Zhao via B4 Relay @ 2026-05-08 7:36 UTC (permalink / raw)
To: Thomas Gleixner, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Martin Blumenstingl, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Heiner Kallweit
Cc: linux-kernel, linux-arm-kernel, linux-amlogic, devicetree,
Xianwei Zhao
Fix one error about reg address when set irq type for S4.
Add string of bindings and driver to support A9 GPIO interrupt.
Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
---
Xianwei Zhao (3):
irqchip/meson-gpio: fix incorrect register address
dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs
irqchip/meson-gpio: Add support for Amlogic A9 SoCs
.../amlogic,meson-gpio-intc.yaml | 21 ++++--
drivers/irqchip/irq-meson-gpio.c | 78 +++++++++++++++++++++-
2 files changed, 93 insertions(+), 6 deletions(-)
---
base-commit: 8b379d5e9eb7933c73e77e768d95f11ef2833c26
change-id: 20260508-a9-gpio-irqchip-d76214ec9c6d
Best regards,
--
Xianwei Zhao <xianwei.zhao@amlogic.com>
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH 1/3] irqchip/meson-gpio: fix incorrect register address 2026-05-08 7:36 [PATCH 0/3] irqchip: Add GPIO interrupt support for Amlogic A9 Xianwei Zhao via B4 Relay @ 2026-05-08 7:36 ` Xianwei Zhao via B4 Relay 2026-05-11 13:10 ` [tip: irq/urgent] irqchip/meson-gpio: Use the correct register in meson_s4_gpio_irq_set_type() tip-bot2 for Xianwei Zhao 2026-05-11 13:27 ` tip-bot2 for Xianwei Zhao 2026-05-08 7:36 ` [PATCH 2/3] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs Xianwei Zhao via B4 Relay 2026-05-08 7:36 ` [PATCH 3/3] irqchip/meson-gpio: " Xianwei Zhao via B4 Relay 2 siblings, 2 replies; 9+ messages in thread From: Xianwei Zhao via B4 Relay @ 2026-05-08 7:36 UTC (permalink / raw) To: Thomas Gleixner, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit Cc: linux-kernel, linux-arm-kernel, linux-amlogic, devicetree, Xianwei Zhao From: Xianwei Zhao <xianwei.zhao@amlogic.com> When set gpio irq type(level and single-edge) for S4, register address is REG_EDGE_POL, not both-edge trigger register. This patch fix it. Fixes: bbd6fcc76b39 ("irqchip: Add support for Amlogic A4 and A5 SoCs") Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> --- drivers/irqchip/irq-meson-gpio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index f722e9c57e2e..74a376ef452e 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -415,8 +415,7 @@ static int meson_s4_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) val |= BIT(ctl->params->edge_single_offset + idx); - meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, - BIT(idx) | BIT(12 + idx), val); + meson_gpio_irq_update_bits(ctl, REG_EDGE_POL, BIT(idx) | BIT(12 + idx), val); return 0; }; -- 2.52.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip: irq/urgent] irqchip/meson-gpio: Use the correct register in meson_s4_gpio_irq_set_type() 2026-05-08 7:36 ` [PATCH 1/3] irqchip/meson-gpio: fix incorrect register address Xianwei Zhao via B4 Relay @ 2026-05-11 13:10 ` tip-bot2 for Xianwei Zhao 2026-05-11 13:27 ` tip-bot2 for Xianwei Zhao 1 sibling, 0 replies; 9+ messages in thread From: tip-bot2 for Xianwei Zhao @ 2026-05-11 13:10 UTC (permalink / raw) To: linux-tip-commits; +Cc: Xianwei Zhao, Thomas Gleixner, x86, linux-kernel, maz The following commit has been merged into the irq/urgent branch of tip: Commit-ID: e8d3dcdf9f576c7527f0a088b953abfaa601ae68 Gitweb: https://git.kernel.org/tip/e8d3dcdf9f576c7527f0a088b953abfaa601ae68 Author: Xianwei Zhao <xianwei.zhao@amlogic.com> AuthorDate: Fri, 08 May 2026 07:36:54 Committer: Thomas Gleixner <tglx@kernel.org> CommitterDate: Mon, 11 May 2026 15:06:48 +02:00 irqchip/meson-gpio: Use the correct register in meson_s4_gpio_irq_set_type() meson_s4_gpio_irq_set_type() uses the both-edge trigger register for configuring level type and single edge mode interrupts, which is not correct. Use REG_EDGE_POL instead. Fixes: bbd6fcc76b39 ("irqchip: Add support for Amlogic A4 and A5 SoCs") Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260508-a9-gpio-irqchip-v1-1-9dc5f3e022e0@amlogic.com --- drivers/irqchip/irq-meson-gpio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index f722e9c..74a376e 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -415,8 +415,7 @@ static int meson_s4_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) val |= BIT(ctl->params->edge_single_offset + idx); - meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, - BIT(idx) | BIT(12 + idx), val); + meson_gpio_irq_update_bits(ctl, REG_EDGE_POL, BIT(idx) | BIT(12 + idx), val); return 0; }; ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip: irq/urgent] irqchip/meson-gpio: Use the correct register in meson_s4_gpio_irq_set_type() 2026-05-08 7:36 ` [PATCH 1/3] irqchip/meson-gpio: fix incorrect register address Xianwei Zhao via B4 Relay 2026-05-11 13:10 ` [tip: irq/urgent] irqchip/meson-gpio: Use the correct register in meson_s4_gpio_irq_set_type() tip-bot2 for Xianwei Zhao @ 2026-05-11 13:27 ` tip-bot2 for Xianwei Zhao 1 sibling, 0 replies; 9+ messages in thread From: tip-bot2 for Xianwei Zhao @ 2026-05-11 13:27 UTC (permalink / raw) To: linux-tip-commits Cc: Xianwei Zhao, Thomas Gleixner, stable, x86, linux-kernel, maz The following commit has been merged into the irq/urgent branch of tip: Commit-ID: 5363b67ac8ebcc3e227dbf59fc8061949109841d Gitweb: https://git.kernel.org/tip/5363b67ac8ebcc3e227dbf59fc8061949109841d Author: Xianwei Zhao <xianwei.zhao@amlogic.com> AuthorDate: Fri, 08 May 2026 07:36:54 Committer: Thomas Gleixner <tglx@kernel.org> CommitterDate: Mon, 11 May 2026 15:22:48 +02:00 irqchip/meson-gpio: Use the correct register in meson_s4_gpio_irq_set_type() meson_s4_gpio_irq_set_type() uses the both-edge trigger register for configuring level type and single edge mode interrupts, which is not correct. Use REG_EDGE_POL instead. Fixes: bbd6fcc76b39 ("irqchip: Add support for Amlogic A4 and A5 SoCs") Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260508-a9-gpio-irqchip-v1-1-9dc5f3e022e0@amlogic.com --- drivers/irqchip/irq-meson-gpio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index f722e9c..74a376e 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -415,8 +415,7 @@ static int meson_s4_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) val |= BIT(ctl->params->edge_single_offset + idx); - meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, - BIT(idx) | BIT(12 + idx), val); + meson_gpio_irq_update_bits(ctl, REG_EDGE_POL, BIT(idx) | BIT(12 + idx), val); return 0; }; ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs 2026-05-08 7:36 [PATCH 0/3] irqchip: Add GPIO interrupt support for Amlogic A9 Xianwei Zhao via B4 Relay 2026-05-08 7:36 ` [PATCH 1/3] irqchip/meson-gpio: fix incorrect register address Xianwei Zhao via B4 Relay @ 2026-05-08 7:36 ` Xianwei Zhao via B4 Relay 2026-05-08 15:03 ` Conor Dooley 2026-05-11 13:16 ` [tip: irq/drivers] " tip-bot2 for Xianwei Zhao 2026-05-08 7:36 ` [PATCH 3/3] irqchip/meson-gpio: " Xianwei Zhao via B4 Relay 2 siblings, 2 replies; 9+ messages in thread From: Xianwei Zhao via B4 Relay @ 2026-05-08 7:36 UTC (permalink / raw) To: Thomas Gleixner, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit Cc: linux-kernel, linux-arm-kernel, linux-amlogic, devicetree, Xianwei Zhao From: Xianwei Zhao <xianwei.zhao@amlogic.com> Update dt-binding document for GPIO interrupt controller of Amlogic A9 SoCs. Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> --- .../amlogic,meson-gpio-intc.yaml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml b/Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml index d0fad930de9d..d26671913e89 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml @@ -38,6 +38,8 @@ properties: - amlogic,a4-gpio-intc - amlogic,a4-gpio-ao-intc - amlogic,a5-gpio-intc + - amlogic,a9-gpio-intc + - amlogic,a9-gpio-ao-intc - amlogic,c3-gpio-intc - amlogic,s6-gpio-intc - amlogic,s7-gpio-intc @@ -56,7 +58,7 @@ properties: amlogic,channel-interrupts: description: Array with the upstream hwirq numbers minItems: 2 - maxItems: 12 + maxItems: 20 $ref: /schemas/types.yaml#/definitions/uint32-array required: @@ -76,9 +78,20 @@ then: amlogic,channel-interrupts: maxItems: 2 else: - properties: - amlogic,channel-interrupts: - minItems: 8 + if: + properties: + compatible: + contains: + const: amlogic,a9-gpio-ao-intc + then: + properties: + amlogic,channel-interrupts: + minItems: 20 + else: + properties: + amlogic,channel-interrupts: + minItems: 8 + maxItems: 12 additionalProperties: false -- 2.52.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs 2026-05-08 7:36 ` [PATCH 2/3] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs Xianwei Zhao via B4 Relay @ 2026-05-08 15:03 ` Conor Dooley 2026-05-11 13:16 ` [tip: irq/drivers] " tip-bot2 for Xianwei Zhao 1 sibling, 0 replies; 9+ messages in thread From: Conor Dooley @ 2026-05-08 15:03 UTC (permalink / raw) To: xianwei.zhao Cc: Thomas Gleixner, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit, linux-kernel, linux-arm-kernel, linux-amlogic, devicetree [-- Attachment #1: Type: text/plain, Size: 75 bytes --] Acked-by: Conor Dooley <conor.dooley@microchip.com> pw-bot: not-applicable [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [tip: irq/drivers] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs 2026-05-08 7:36 ` [PATCH 2/3] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs Xianwei Zhao via B4 Relay 2026-05-08 15:03 ` Conor Dooley @ 2026-05-11 13:16 ` tip-bot2 for Xianwei Zhao 1 sibling, 0 replies; 9+ messages in thread From: tip-bot2 for Xianwei Zhao @ 2026-05-11 13:16 UTC (permalink / raw) To: linux-tip-commits Cc: Xianwei Zhao, Thomas Gleixner, Conor Dooley, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: f51c99a0e502dcfd3a1972554ed3f09970a55a07 Gitweb: https://git.kernel.org/tip/f51c99a0e502dcfd3a1972554ed3f09970a55a07 Author: Xianwei Zhao <xianwei.zhao@amlogic.com> AuthorDate: Fri, 08 May 2026 07:36:55 Committer: Thomas Gleixner <tglx@kernel.org> CommitterDate: Mon, 11 May 2026 15:11:29 +02:00 dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs Update dt-binding document for GPIO interrupt controller of Amlogic A9 SoCs. Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Acked-by: Conor Dooley <conor.dooley@microchip.com> Link: https://patch.msgid.link/20260508-a9-gpio-irqchip-v1-2-9dc5f3e022e0@amlogic.com --- Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml b/Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml index d0fad93..d266719 100644 --- a/Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml +++ b/Documentation/devicetree/bindings/interrupt-controller/amlogic,meson-gpio-intc.yaml @@ -38,6 +38,8 @@ properties: - amlogic,a4-gpio-intc - amlogic,a4-gpio-ao-intc - amlogic,a5-gpio-intc + - amlogic,a9-gpio-intc + - amlogic,a9-gpio-ao-intc - amlogic,c3-gpio-intc - amlogic,s6-gpio-intc - amlogic,s7-gpio-intc @@ -56,7 +58,7 @@ properties: amlogic,channel-interrupts: description: Array with the upstream hwirq numbers minItems: 2 - maxItems: 12 + maxItems: 20 $ref: /schemas/types.yaml#/definitions/uint32-array required: @@ -76,9 +78,20 @@ then: amlogic,channel-interrupts: maxItems: 2 else: - properties: - amlogic,channel-interrupts: - minItems: 8 + if: + properties: + compatible: + contains: + const: amlogic,a9-gpio-ao-intc + then: + properties: + amlogic,channel-interrupts: + minItems: 20 + else: + properties: + amlogic,channel-interrupts: + minItems: 8 + maxItems: 12 additionalProperties: false ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] irqchip/meson-gpio: Add support for Amlogic A9 SoCs 2026-05-08 7:36 [PATCH 0/3] irqchip: Add GPIO interrupt support for Amlogic A9 Xianwei Zhao via B4 Relay 2026-05-08 7:36 ` [PATCH 1/3] irqchip/meson-gpio: fix incorrect register address Xianwei Zhao via B4 Relay 2026-05-08 7:36 ` [PATCH 2/3] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs Xianwei Zhao via B4 Relay @ 2026-05-08 7:36 ` Xianwei Zhao via B4 Relay 2026-05-11 13:16 ` [tip: irq/drivers] " tip-bot2 for Xianwei Zhao 2 siblings, 1 reply; 9+ messages in thread From: Xianwei Zhao via B4 Relay @ 2026-05-08 7:36 UTC (permalink / raw) To: Thomas Gleixner, Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiner Kallweit Cc: linux-kernel, linux-arm-kernel, linux-amlogic, devicetree, Xianwei Zhao From: Xianwei Zhao <xianwei.zhao@amlogic.com> The Amlogic A9 SoCs support GPIO interrupt lines: A9 IRQ Number: - 95:86 10 pins on bank Y - 85:84 2 pins on bank CC - 83:64 20 pins on bank A - 63:48 16 pins on bank Z - 47:30 18 pins on bank X - 29:22 8 pins on bank H - 21:14 8 pins on bank M - 13:0 14 pins on bank B A9 AO IRQ Number: - 38 1 pins on bank TESTN - 37:31 7 pins on bank C - 30:13 18 pins on bank D - 12:0 13 pins on bank AO Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> --- drivers/irqchip/irq-meson-gpio.c | 75 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index 74a376ef452e..f68476b2c538 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -27,6 +27,10 @@ /* use for A1 like chips */ #define REG_PIN_A1_SEL 0x04 +/* use for A9 like chips */ +#define REG_A9_AO_POL 0x00 +#define REG_A9_AO_EDGE 0x30 + /* * Note: The S905X3 datasheet reports that BOTH_EDGE is controlled by * bits 24 to 31. Tests on the actual HW show that these bits are @@ -53,6 +57,8 @@ static void meson_a1_gpio_irq_sel_pin(struct meson_gpio_irq_controller *ctl, static void meson_a1_gpio_irq_init(struct meson_gpio_irq_controller *ctl); static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, unsigned int type, u32 *channel_hwirq); +static int meson_a9_ao_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, + unsigned int type, u32 *channel_hwirq); static int meson_s4_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, unsigned int type, u32 *channel_hwirq); @@ -116,6 +122,18 @@ struct meson_gpio_irq_params { .pin_sel_mask = 0xff, \ .nr_channels = 2, \ +#define INIT_MESON_A9_AO_COMMON_DATA(irqs) \ + INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \ + meson_a1_gpio_irq_sel_pin, \ + meson_a9_ao_gpio_irq_set_type) \ + .support_edge_both = true, \ + .edge_both_offset = 0, \ + .edge_single_offset = 0, \ + .edge_pol_reg = 0x2c, \ + .pol_low_offset = 0, \ + .pin_sel_mask = 0xff, \ + .nr_channels = 20, \ + #define INIT_MESON_S4_COMMON_DATA(irqs) \ INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \ meson_a1_gpio_irq_sel_pin, \ @@ -170,6 +188,14 @@ static const struct meson_gpio_irq_params a5_params = { INIT_MESON_S4_COMMON_DATA(99) }; +static const struct meson_gpio_irq_params a9_params = { + INIT_MESON_S4_COMMON_DATA(96) +}; + +static const struct meson_gpio_irq_params a9_ao_params = { + INIT_MESON_A9_AO_COMMON_DATA(39) +}; + static const struct meson_gpio_irq_params s4_params = { INIT_MESON_S4_COMMON_DATA(82) }; @@ -203,6 +229,8 @@ static const struct of_device_id meson_irq_gpio_matches[] __maybe_unused = { { .compatible = "amlogic,a4-gpio-ao-intc", .data = &a4_ao_params }, { .compatible = "amlogic,a4-gpio-intc", .data = &a4_params }, { .compatible = "amlogic,a5-gpio-intc", .data = &a5_params }, + { .compatible = "amlogic,a9-gpio-ao-intc", .data = &a9_ao_params }, + { .compatible = "amlogic,a9-gpio-intc", .data = &a9_params }, { .compatible = "amlogic,s6-gpio-intc", .data = &s6_params }, { .compatible = "amlogic,s7-gpio-intc", .data = &s7_params }, { .compatible = "amlogic,s7d-gpio-intc", .data = &s7_params }, @@ -375,6 +403,53 @@ static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, return 0; } +/* + * gpio irq relative registers for a9_ao + * -PADCTRL_GPIO_IRQ_CTRL0 + * bit[31]: enable/disable all the irq lines + * bit[0-19]: polarity trigger + * + * -PADCTRL_GPIO_IRQ_CTRL[X] + * bit[0-5]: 6 bits to choose gpio source for irq line 2*[X] - 2 + * bit[16-21]:6 bits to choose gpio source for irq line 2*[X] - 1 + * where X = 1-10 + * + * -PADCTRL_GPIO_IRQ_CTRL[11] + * bit[0-19]: both edge trigger + * + * -PADCTRL_GPIO_IRQ_CTRL[12] + * bit[0-19]: single edge trigger + */ +static int meson_a9_ao_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, + unsigned int type, u32 *channel_hwirq) +{ + const struct meson_gpio_irq_params *params = ctl->params; + unsigned int idx; + u32 val = 0; + + idx = meson_gpio_irq_get_channel_idx(ctl, channel_hwirq); + + type &= IRQ_TYPE_SENSE_MASK; + + meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, BIT(idx), 0); + + if (type == IRQ_TYPE_EDGE_BOTH) { + val = BIT(ctl->params->edge_both_offset + idx); + meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, val, val); + return 0; + } + + if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_EDGE_FALLING)) + val = BIT(idx); + meson_gpio_irq_update_bits(ctl, REG_A9_AO_POL, BIT(idx), val); + + val = 0; + if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) + val = BIT(idx); + meson_gpio_irq_update_bits(ctl, REG_A9_AO_EDGE, BIT(idx), val); + + return 0; +}; /* * gpio irq relative registers for s4 * -PADCTRL_GPIO_IRQ_CTRL0 -- 2.52.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [tip: irq/drivers] irqchip/meson-gpio: Add support for Amlogic A9 SoCs 2026-05-08 7:36 ` [PATCH 3/3] irqchip/meson-gpio: " Xianwei Zhao via B4 Relay @ 2026-05-11 13:16 ` tip-bot2 for Xianwei Zhao 0 siblings, 0 replies; 9+ messages in thread From: tip-bot2 for Xianwei Zhao @ 2026-05-11 13:16 UTC (permalink / raw) To: linux-tip-commits; +Cc: Xianwei Zhao, Thomas Gleixner, x86, linux-kernel The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 5b9cb104594f0ea73c2eba83aa93c0cb7ac2238e Gitweb: https://git.kernel.org/tip/5b9cb104594f0ea73c2eba83aa93c0cb7ac2238e Author: Xianwei Zhao <xianwei.zhao@amlogic.com> AuthorDate: Fri, 08 May 2026 07:36:56 Committer: Thomas Gleixner <tglx@kernel.org> CommitterDate: Mon, 11 May 2026 15:11:29 +02:00 irqchip/meson-gpio: Add support for Amlogic A9 SoCs The Amlogic A9 SoCs supports the following GPIO interrupt lines: A9 IRQ Number: - 95:86 10 pins on bank Y - 85:84 2 pins on bank CC - 83:64 20 pins on bank A - 63:48 16 pins on bank Z - 47:30 18 pins on bank X - 29:22 8 pins on bank H - 21:14 8 pins on bank M - 13:0 14 pins on bank B A9 AO IRQ Number: - 38 1 pins on bank TESTN - 37:31 7 pins on bank C - 30:13 18 pins on bank D - 12:0 13 pins on bank AO Update the driver to handle these variants. Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260508-a9-gpio-irqchip-v1-3-9dc5f3e022e0@amlogic.com --- drivers/irqchip/irq-meson-gpio.c | 77 +++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+) diff --git a/drivers/irqchip/irq-meson-gpio.c b/drivers/irqchip/irq-meson-gpio.c index 74a376e..91a9c33 100644 --- a/drivers/irqchip/irq-meson-gpio.c +++ b/drivers/irqchip/irq-meson-gpio.c @@ -27,6 +27,10 @@ /* use for A1 like chips */ #define REG_PIN_A1_SEL 0x04 +/* use for A9 like chips */ +#define REG_A9_AO_POL 0x00 +#define REG_A9_AO_EDGE 0x30 + /* * Note: The S905X3 datasheet reports that BOTH_EDGE is controlled by * bits 24 to 31. Tests on the actual HW show that these bits are @@ -53,6 +57,8 @@ static void meson_a1_gpio_irq_sel_pin(struct meson_gpio_irq_controller *ctl, static void meson_a1_gpio_irq_init(struct meson_gpio_irq_controller *ctl); static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, unsigned int type, u32 *channel_hwirq); +static int meson_a9_ao_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, + unsigned int type, u32 *channel_hwirq); static int meson_s4_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, unsigned int type, u32 *channel_hwirq); @@ -116,6 +122,18 @@ struct meson_gpio_irq_params { .pin_sel_mask = 0xff, \ .nr_channels = 2, \ +#define INIT_MESON_A9_AO_COMMON_DATA(irqs) \ + INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \ + meson_a1_gpio_irq_sel_pin, \ + meson_a9_ao_gpio_irq_set_type) \ + .support_edge_both = true, \ + .edge_both_offset = 0, \ + .edge_single_offset = 0, \ + .edge_pol_reg = 0x2c, \ + .pol_low_offset = 0, \ + .pin_sel_mask = 0xff, \ + .nr_channels = 20, \ + #define INIT_MESON_S4_COMMON_DATA(irqs) \ INIT_MESON_COMMON(irqs, meson_a1_gpio_irq_init, \ meson_a1_gpio_irq_sel_pin, \ @@ -170,6 +188,14 @@ static const struct meson_gpio_irq_params a5_params = { INIT_MESON_S4_COMMON_DATA(99) }; +static const struct meson_gpio_irq_params a9_params = { + INIT_MESON_S4_COMMON_DATA(96) +}; + +static const struct meson_gpio_irq_params a9_ao_params = { + INIT_MESON_A9_AO_COMMON_DATA(39) +}; + static const struct meson_gpio_irq_params s4_params = { INIT_MESON_S4_COMMON_DATA(82) }; @@ -203,6 +229,8 @@ static const struct of_device_id meson_irq_gpio_matches[] __maybe_unused = { { .compatible = "amlogic,a4-gpio-ao-intc", .data = &a4_ao_params }, { .compatible = "amlogic,a4-gpio-intc", .data = &a4_params }, { .compatible = "amlogic,a5-gpio-intc", .data = &a5_params }, + { .compatible = "amlogic,a9-gpio-ao-intc", .data = &a9_ao_params }, + { .compatible = "amlogic,a9-gpio-intc", .data = &a9_params }, { .compatible = "amlogic,s6-gpio-intc", .data = &s6_params }, { .compatible = "amlogic,s7-gpio-intc", .data = &s7_params }, { .compatible = "amlogic,s7d-gpio-intc", .data = &s7_params }, @@ -376,6 +404,55 @@ static int meson8_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, } /* + * gpio irq relative registers for a9_ao + * -PADCTRL_GPIO_IRQ_CTRL0 + * bit[31]: enable/disable all the irq lines + * bit[0-19]: polarity trigger + * + * -PADCTRL_GPIO_IRQ_CTRL[X] + * bit[0-5]: 6 bits to choose gpio source for irq line 2*[X] - 2 + * bit[16-21]:6 bits to choose gpio source for irq line 2*[X] - 1 + * where X = 1-10 + * + * -PADCTRL_GPIO_IRQ_CTRL[11] + * bit[0-19]: both edge trigger + * + * -PADCTRL_GPIO_IRQ_CTRL[12] + * bit[0-19]: single edge trigger + */ +static int meson_a9_ao_gpio_irq_set_type(struct meson_gpio_irq_controller *ctl, + unsigned int type, u32 *channel_hwirq) +{ + const struct meson_gpio_irq_params *params = ctl->params; + unsigned int idx; + u32 val; + + idx = meson_gpio_irq_get_channel_idx(ctl, channel_hwirq); + + type &= IRQ_TYPE_SENSE_MASK; + + meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, BIT(idx), 0); + + if (type == IRQ_TYPE_EDGE_BOTH) { + val = BIT(ctl->params->edge_both_offset + idx); + meson_gpio_irq_update_bits(ctl, params->edge_pol_reg, val, val); + return 0; + } + + val = 0; + if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_EDGE_FALLING)) + val = BIT(idx); + meson_gpio_irq_update_bits(ctl, REG_A9_AO_POL, BIT(idx), val); + + val = 0; + if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) + val = BIT(idx); + meson_gpio_irq_update_bits(ctl, REG_A9_AO_EDGE, BIT(idx), val); + + return 0; +}; + +/* * gpio irq relative registers for s4 * -PADCTRL_GPIO_IRQ_CTRL0 * bit[31]: enable/disable all the irq lines ^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-05-11 13:27 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-05-08 7:36 [PATCH 0/3] irqchip: Add GPIO interrupt support for Amlogic A9 Xianwei Zhao via B4 Relay 2026-05-08 7:36 ` [PATCH 1/3] irqchip/meson-gpio: fix incorrect register address Xianwei Zhao via B4 Relay 2026-05-11 13:10 ` [tip: irq/urgent] irqchip/meson-gpio: Use the correct register in meson_s4_gpio_irq_set_type() tip-bot2 for Xianwei Zhao 2026-05-11 13:27 ` tip-bot2 for Xianwei Zhao 2026-05-08 7:36 ` [PATCH 2/3] dt-bindings: interrupt-controller: Add support for Amlogic A9 SoCs Xianwei Zhao via B4 Relay 2026-05-08 15:03 ` Conor Dooley 2026-05-11 13:16 ` [tip: irq/drivers] " tip-bot2 for Xianwei Zhao 2026-05-08 7:36 ` [PATCH 3/3] irqchip/meson-gpio: " Xianwei Zhao via B4 Relay 2026-05-11 13:16 ` [tip: irq/drivers] " tip-bot2 for Xianwei Zhao
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox