From nobody Sat Feb 7 08:23:21 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19E4038945C; Wed, 14 Jan 2026 09:40:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383647; cv=none; b=kBqBMnlB7vP1MflgLKTpHy6lArT1b5tuWOzhAXhmYvnKJGbJ7qsA/9hFF3v7feMqAH+8ZteEfpcYLr6b1XmnboGqSLXHRo9DsPxUcIZObGeX0dCQAGW3XYrP0OsoyrPcsVtzyPcgVn7leAqAWbZaXz+j20Q2DootQjAE4Lgp38M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383647; c=relaxed/simple; bh=vVZgxFYLzHLo6Je5qo4VsC2G21fb8AVTz3FULpwqbI8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y3tntR9pYORDrN4Zj4uhtJtqgXQADQiK7ib4+z2L260Lur/bJ9IGDhZaLVGh/WfILWtPab3ZJQug7W3EQxZYZBAo6Gd5kDCSrCLc6k1gRaBInmCGlJzu4Be7IjXMkQxODt9tDZ0YGx250JDPcf+kIW3saBsaG//jic/SHfL/dNQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=vwm5pAWg; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="vwm5pAWg" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id B780F1A2865; Wed, 14 Jan 2026 09:40:41 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 8DC476074A; Wed, 14 Jan 2026 09:40:41 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 841D5103C8177; Wed, 14 Jan 2026 10:40:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768383640; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=jozCCQDErEkxTe2vzEruUqB8SMT6ApftoG0i4EMWZJY=; b=vwm5pAWg4cC+o6nC+XiWcJOFPvMVN7c61IkMm0lF77s3SX13JA+KuTmKZWhP7yAqcSlA7m kT/hxanYnqYiC/r86Dd2DGNlf3p5WpQRJNwAySKAxLOkjJJFIjS0KWUYGWLRai/iZ0Wch3 OrQpEJimslAbcX6EaFI8xgYIzNIlE5lGmlNYTPLokryyOAY5grfY6gsdAw3GxTwfKVITPE 0NHHTLU2cxv0X++qYG6xahjRF7N+NdkKT309kH50IhpT++SRXCyavCytSKHmcljjPAmCSB rUmJVb6jsWzjStu3Je56Wj7hELxXTPIQmZqnu8xeuR7J1MMpbYLHsnBSHWIfZA== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Herve Codina Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni Subject: [PATCH v8 1/8] of/irq: Introduce for_each_of_imap_item Date: Wed, 14 Jan 2026 10:39:30 +0100 Message-ID: <20260114093938.1089936-2-herve.codina@bootlin.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114093938.1089936-1-herve.codina@bootlin.com> References: <20260114093938.1089936-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" for_each_of_imap_item is an iterator designed to help a driver to parse an interrupt-map property. Indeed some drivers need to know details about the interrupt mapping described in the device-tree in order to set internal registers accordingly. Signed-off-by: Herve Codina (Schneider Electric) Tested-by: Wolfram Sang Reviewed-by: Rob Herring (Arm) Reviewed-by: Linus Walleij Reviewed-by > Acked-by Tested-by tag? That sends you to the back of the queue in my normal --- drivers/of/irq.c | 70 ++++++++++++++++++++++++++++++++++++++++++ include/linux/of_irq.h | 41 ++++++++++++++++++++++++- 2 files changed, 110 insertions(+), 1 deletion(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index e3816819dbfe..f374d8b212b8 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -157,6 +157,76 @@ const __be32 *of_irq_parse_imap_parent(const __be32 *i= map, int len, struct of_ph return imap; } =20 +int of_imap_parser_init(struct of_imap_parser *parser, struct device_node = *node, + struct of_imap_item *item) +{ + int imaplen; + u32 tmp; + int ret; + + /* + * parent_offset is the offset where the parent part is starting. + * In other words, the offset where the parent interrupt controller + * phandle is present. + * + * Compute this offset (child #interrupt-cells + child #address-cells) + */ + parser->parent_offset =3D of_bus_n_addr_cells(node); + + ret =3D of_property_read_u32(node, "#interrupt-cells", &tmp); + if (ret) + return ret; + + parser->parent_offset +=3D tmp; + + if (WARN(parser->parent_offset > ARRAY_SIZE(item->child_imap), + "child part size =3D %u, cannot fit in array of %zu items", + parser->parent_offset, ARRAY_SIZE(item->child_imap))) + return -EINVAL; + + parser->imap =3D of_get_property(node, "interrupt-map", &imaplen); + if (!parser->imap) + return -ENOENT; + + imaplen /=3D sizeof(*parser->imap); + parser->imap_end =3D parser->imap + imaplen; + + memset(item, 0, sizeof(*item)); + item->child_imap_count =3D parser->parent_offset; + + return 0; +} +EXPORT_SYMBOL_GPL(of_imap_parser_init); + +struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser, + struct of_imap_item *item) +{ + const __be32 *imap_parent, *imap_next; + int i; + + /* Release previously get parent node */ + of_node_put(item->parent_args.np); + + if (parser->imap + parser->parent_offset + 1 >=3D parser->imap_end) + return NULL; + + imap_parent =3D parser->imap + parser->parent_offset; + + imap_next =3D of_irq_parse_imap_parent(imap_parent, + parser->imap_end - imap_parent, + &item->parent_args); + if (!imap_next) + return NULL; + + for (i =3D 0; i < parser->parent_offset; i++) + item->child_imap[i] =3D be32_to_cpu(*(parser->imap + i)); + + parser->imap =3D imap_next; + + return item; +} +EXPORT_SYMBOL_GPL(of_imap_parser_one); + /** * of_irq_parse_raw - Low level interrupt tree parsing * @addr: address specifier (start of "reg" property of the device) in be3= 2 format diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index 1c2bc0281807..2a64d8cecaae 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -11,6 +11,30 @@ =20 typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *= ); =20 +struct of_imap_parser { + struct device_node *node; + const __be32 *imap; + const __be32 *imap_end; + u32 parent_offset; +}; + +struct of_imap_item { + struct of_phandle_args parent_args; + u32 child_imap_count; + u32 child_imap[16]; /* Arbitrary size. + * Should be #address-cells + #interrupt-cells but + * avoid using allocation and so, expect that 16 + * should be enough + */ +}; + +/* + * If the iterator is exited prematurely (break, goto, return) of_node_put= () has + * to be called on item.parent_args.np + */ +#define for_each_of_imap_item(parser, item) \ + for (; of_imap_parser_one(parser, item);) + /* * Workarounds only applied to 32bit powermac machines */ @@ -49,6 +73,11 @@ extern int of_irq_get_byname(struct device_node *dev, co= nst char *name); extern int of_irq_to_resource_table(struct device_node *dev, struct resource *res, int nr_irqs); extern struct device_node *of_irq_find_parent(struct device_node *child); +extern int of_imap_parser_init(struct of_imap_parser *parser, + struct device_node *node, + struct of_imap_item *item); +extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *pars= er, + struct of_imap_item *item); extern struct irq_domain *of_msi_get_domain(struct device *dev, const struct device_node *np, enum irq_domain_bus_token token); @@ -92,7 +121,17 @@ static inline void *of_irq_find_parent(struct device_no= de *child) { return NULL; } - +static inline int of_imap_parser_init(struct of_imap_parser *parser, + struct device_node *node, + struct of_imap_item *item) +{ + return -ENOSYS; +} +static inline struct of_imap_item *of_imap_parser_one(struct of_imap_parse= r *parser, + struct of_imap_item *item) +{ + return NULL; +} static inline struct irq_domain *of_msi_get_domain(struct device *dev, struct device_node *np, enum irq_domain_bus_token token) --=20 2.52.0 From nobody Sat Feb 7 08:23:21 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD6C138946D; Wed, 14 Jan 2026 09:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383649; cv=none; b=q0yhNTLn4NpM4wmewVX2LDhp1RVGJguCEZfAMXjeHsGbloayra2XB9sM/lrWEF2KJM5phfcWc/LDDPSVYyEujGHjEwhm7NADgf2PevDRJFqkE/GxCsJCA8+gMOo2W5L+zEtJ+0QEJmTpKYKcQeUH9jVS/Yhpewty0yZxFkHISKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383649; c=relaxed/simple; bh=0Xlyw1PR4o+6+vS2gGoZ78tBAwiolEXSxjFvlBUZ5HE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bdYT9KOipzJuJWcYm6fV53DmbD/y6on0Ltrmlwt0KIa3Pl11wQsI3BaDWZk9BUvqVZnCSmo6fVrPjXBZ+d6dJ9cqXzbEjWM0fu7NI9eyRI+OU3L83jU3mPZ43M//o9fy2jHe7s8ifi4JMYRlbEJ1OETlOmKvKsls3Lb2aGRrNUw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=1bAWNE8S; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="1bAWNE8S" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id E186B1A2863; Wed, 14 Jan 2026 09:40:43 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id B7C526074A; Wed, 14 Jan 2026 09:40:43 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 2DAB6103C80C0; Wed, 14 Jan 2026 10:40:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768383642; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=T+NWUCrzZZE7w9WZkyVej7pOY9XsMvaBl3vuZX0qFVM=; b=1bAWNE8SIg5vzHKx2jCq3mO2Feqk2wgahgfaYwa9S2eA+ySM7g0iY/aNld0eQ1WGbyQ18h gY1dqReP+hq8vnh4ngjWqUE3WhYsRGPNT5QIzo8ux9LWxrM2eghHXPEV6ckv/cOnSt9kS/ lkbR2o3g2P122loLV48wW1PyqB2vNeJVEct7G4sD4pMH6bAeXOoeqNaYf2PfdNZvW26eJz RmZfbvyqtlf4FvjBY2EI3y3SiivqauF1e75Y+siYSPLxq2e4yd4l8oFb2WJvLzuDKugF7I R0f7EvbI/EXEZ1F6w50Nn6A3i+ieBiuMatKuMgEb0H0mNifsDqUyZnc1QMwuCg== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Herve Codina Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni Subject: [PATCH v8 2/8] of: unittest: Add a test case for for_each_of_imap_item iterator Date: Wed, 14 Jan 2026 10:39:31 +0100 Message-ID: <20260114093938.1089936-3-herve.codina@bootlin.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114093938.1089936-1-herve.codina@bootlin.com> References: <20260114093938.1089936-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Recently for_each_of_imap_item iterator has been introduce to help drivers in parsing the interrupt-map property. Add a test case for this iterator. Signed-off-by: Herve Codina (Schneider Electric) Reviewed-by: Rob Herring (Arm) Reviewed-by: Linus Walleij Reviewed-by > Acked-by Tested-by tag? That sends you to the back of the queue in my normal --- .../of/unittest-data/tests-interrupts.dtsi | 9 ++ drivers/of/unittest.c | 116 ++++++++++++++++++ 2 files changed, 125 insertions(+) diff --git a/drivers/of/unittest-data/tests-interrupts.dtsi b/drivers/of/un= ittest-data/tests-interrupts.dtsi index 4ccb54f91c30..974f888c9b15 100644 --- a/drivers/of/unittest-data/tests-interrupts.dtsi +++ b/drivers/of/unittest-data/tests-interrupts.dtsi @@ -50,6 +50,15 @@ test_intmap1: intmap1 { interrupt-map =3D <0x5000 1 2 &test_intc0 15>; }; =20 + intmap2 { + #interrupt-cells =3D <2>; + #address-cells =3D <0>; + interrupt-map =3D <1 11 &test_intc0 100>, + <2 22 &test_intc1 200 201 202>, + <3 33 &test_intc2 300 301>, + <4 44 &test_intc2 400 401>; + }; + test_intc_intmap0: intc-intmap0 { #interrupt-cells =3D <1>; #address-cells =3D <1>; diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index 388e9ec2cccf..d88a12f23ad5 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -1654,6 +1654,121 @@ static void __init of_unittest_parse_interrupts_ext= ended(void) of_node_put(np); } =20 +struct of_unittest_expected_imap_item { + u32 child_imap_count; + u32 child_imap[2]; + const char *parent_path; + int parent_args_count; + u32 parent_args[3]; +}; + +static const struct of_unittest_expected_imap_item of_unittest_expected_im= ap_items[] =3D { + { + .child_imap_count =3D 2, + .child_imap =3D {1, 11}, + .parent_path =3D "/testcase-data/interrupts/intc0", + .parent_args_count =3D 1, + .parent_args =3D {100}, + }, { + .child_imap_count =3D 2, + .child_imap =3D {2, 22}, + .parent_path =3D "/testcase-data/interrupts/intc1", + .parent_args_count =3D 3, + .parent_args =3D {200, 201, 202}, + }, { + .child_imap_count =3D 2, + .child_imap =3D {3, 33}, + .parent_path =3D "/testcase-data/interrupts/intc2", + .parent_args_count =3D 2, + .parent_args =3D {300, 301}, + }, { + .child_imap_count =3D 2, + .child_imap =3D {4, 44}, + .parent_path =3D "/testcase-data/interrupts/intc2", + .parent_args_count =3D 2, + .parent_args =3D {400, 401}, + } +}; + +static void __init of_unittest_parse_interrupt_map(void) +{ + const struct of_unittest_expected_imap_item *expected_item; + struct device_node *imap_np, *expected_parent_np; + struct of_imap_parser imap_parser; + struct of_imap_item imap_item; + int count, ret, i; + + if (of_irq_workarounds & (OF_IMAP_NO_PHANDLE | OF_IMAP_OLDWORLD_MAC)) + return; + + imap_np =3D of_find_node_by_path("/testcase-data/interrupts/intmap2"); + if (!imap_np) { + pr_err("missing testcase data\n"); + return; + } + + ret =3D of_imap_parser_init(&imap_parser, imap_np, &imap_item); + if (unittest(!ret, "of_imap_parser_init(%pOF) returned error %d\n", + imap_np, ret)) + goto end; + + expected_item =3D of_unittest_expected_imap_items; + count =3D 0; + + for_each_of_imap_item(&imap_parser, &imap_item) { + if (unittest(count < ARRAY_SIZE(of_unittest_expected_imap_items), + "imap item number %d not expected. Max number %zu\n", + count, ARRAY_SIZE(of_unittest_expected_imap_items) - 1)) { + of_node_put(imap_item.parent_args.np); + goto end; + } + + expected_parent_np =3D of_find_node_by_path(expected_item->parent_path); + if (unittest(expected_parent_np, + "missing dependent testcase data (%s)\n", + expected_item->parent_path)) { + of_node_put(imap_item.parent_args.np); + goto end; + } + + unittest(imap_item.child_imap_count =3D=3D expected_item->child_imap_cou= nt, + "imap[%d] child_imap_count =3D %u, expected %u\n", + count, imap_item.child_imap_count, + expected_item->child_imap_count); + + for (i =3D 0; i < expected_item->child_imap_count; i++) + unittest(imap_item.child_imap[i] =3D=3D expected_item->child_imap[i], + "imap[%d] child_imap[%d] =3D %u, expected %u\n", + count, i, imap_item.child_imap[i], + expected_item->child_imap[i]); + + unittest(imap_item.parent_args.np =3D=3D expected_parent_np, + "imap[%d] parent np =3D %pOF, expected %pOF\n", + count, imap_item.parent_args.np, expected_parent_np); + + unittest(imap_item.parent_args.args_count =3D=3D expected_item->parent_a= rgs_count, + "imap[%d] parent param_count =3D %d, expected %d\n", + count, imap_item.parent_args.args_count, + expected_item->parent_args_count); + + for (i =3D 0; i < expected_item->parent_args_count; i++) + unittest(imap_item.parent_args.args[i] =3D=3D expected_item->parent_arg= s[i], + "imap[%d] parent param[%d] =3D %u, expected %u\n", + count, i, imap_item.parent_args.args[i], + expected_item->parent_args[i]); + + of_node_put(expected_parent_np); + count++; + expected_item++; + } + + unittest(count =3D=3D ARRAY_SIZE(of_unittest_expected_imap_items), + "Missing items. %d parsed, expected %zu\n", + count, ARRAY_SIZE(of_unittest_expected_imap_items)); +end: + of_node_put(imap_np); +} + #if IS_ENABLED(CONFIG_OF_DYNAMIC) static void __init of_unittest_irq_refcount(void) { @@ -4395,6 +4510,7 @@ static int __init of_unittest(void) of_unittest_changeset_prop(); of_unittest_parse_interrupts(); of_unittest_parse_interrupts_extended(); + of_unittest_parse_interrupt_map(); of_unittest_irq_refcount(); of_unittest_dma_get_max_cpu_address(); of_unittest_parse_dma_ranges(); --=20 2.52.0 From nobody Sat Feb 7 08:23:21 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0259D389462 for ; Wed, 14 Jan 2026 09:40:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383649; cv=none; b=tzdaPvXcm8EFNZxjX/9XrwYRWx7vr0uU1Q2zQErXKn5Mb9jqr7fwW6fJkqCWkORvjlPIIv3LW0ReBxKoJ8eMKe8CGzF2T6LBJgImfWA2JkSP0VOhuAxXJLal9ze2oxUCyr/PTUcesPP0itt61OKFMXQFNhiJU/S5x4TRVvBfabY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383649; c=relaxed/simple; bh=pkHYFhneP/QcwzSSuUU2RRndmpCI+0dWRXesaXlZDg8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A+fz2VdXpVcUDZf3oJXwg9dCgs2MigE4VSQF6tDPJjOo5YPEV6oeYB4v8uNIEC14YYelCOnkpM+w6mpc7j2F7Ug1vJmHXAyR/cmvuulKxp0p7h9GVt4w3Xs+7xcT2cCjf026tQ7a5Rut1T2p8c5M/VQdqjmHQOSadbRSCzUb5Qc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=MFdRkedO; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="MFdRkedO" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id C25A21A2867; Wed, 14 Jan 2026 09:40:46 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 96AB66074A; Wed, 14 Jan 2026 09:40:46 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 6B124103C8951; Wed, 14 Jan 2026 10:40:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768383645; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=uvqB8EXIwm8yUwJOSkCvzDM0SmaeJRSPO5ef2FNPe1I=; b=MFdRkedOB2w72yhsGZqtMY5GGBZP3u3WajWGIFEcoF2zd0Gze8BuJZKUIVVaVkRCTdmuIc P9DXSvAhdWzmblBrdyjZZouMxYdYNJ9S/4Xx7wWLBlGpK3TpckjBHfflcBtc/1dX2c4gQ9 728oUyViHf3eC9VUiQS0jFaX6NyoCx8DqmWecBAvyE7g0KuX/r4+oZ4GNFXojdRNMqx9fT bPlnT7OCTDKNkUCwLfSyXFpkikN2sW5tPhSLf5ZuWYll5sRvoUw6IBW/8JGc7bI35HHDKB C7F9kJQc4ovmYCT+V9mMLBKFK8BPNDdh2fo4pjw+UEAhaxyKpZ+MRpRYPMe43w== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Herve Codina Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni Subject: [PATCH v8 3/8] irqchip/ls-extirq: Use for_each_of_imap_item iterator Date: Wed, 14 Jan 2026 10:39:32 +0100 Message-ID: <20260114093938.1089936-4-herve.codina@bootlin.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114093938.1089936-1-herve.codina@bootlin.com> References: <20260114093938.1089936-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The ls-extirq driver parses the interrupt-map property. It does it using open code. Recently for_each_of_imap_item iterator has been introduce to help drivers in this parsing. Convert the ls-extirq driver to use the for_each_of_imap_item iterator instead of open code. Signed-off-by: Herve Codina (Schneider Electric) Reviewed-by: Linus Walleij Reviewed-by > Acked-by Reviewed-by: Thomas Gleixner Tested-by tag? That sends you to the back of the queue in my normal --- drivers/irqchip/irq-ls-extirq.c | 47 ++++++++++++--------------------- 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/drivers/irqchip/irq-ls-extirq.c b/drivers/irqchip/irq-ls-extir= q.c index 50a7b38381b9..ed8755777349 100644 --- a/drivers/irqchip/irq-ls-extirq.c +++ b/drivers/irqchip/irq-ls-extirq.c @@ -125,45 +125,32 @@ static const struct irq_domain_ops extirq_domain_ops = =3D { static int ls_extirq_parse_map(struct ls_extirq_data *priv, struct device_node *node) { - const __be32 *map; - u32 mapsize; + struct of_imap_parser imap_parser; + struct of_imap_item imap_item; int ret; =20 - map =3D of_get_property(node, "interrupt-map", &mapsize); - if (!map) - return -ENOENT; - if (mapsize % sizeof(*map)) - return -EINVAL; - mapsize /=3D sizeof(*map); + ret =3D of_imap_parser_init(&imap_parser, node, &imap_item); + if (ret) + return ret; =20 - while (mapsize) { + for_each_of_imap_item(&imap_parser, &imap_item) { struct device_node *ipar; - u32 hwirq, intsize, j; + u32 hwirq; + int i; =20 - if (mapsize < 3) - return -EINVAL; - hwirq =3D be32_to_cpup(map); - if (hwirq >=3D MAXIRQ) + hwirq =3D imap_item.child_imap[0]; + if (hwirq >=3D MAXIRQ) { + of_node_put(imap_item.parent_args.np); return -EINVAL; + } priv->nirq =3D max(priv->nirq, hwirq + 1); =20 - ipar =3D of_find_node_by_phandle(be32_to_cpup(map + 2)); - map +=3D 3; - mapsize -=3D 3; - if (!ipar) - return -EINVAL; - priv->map[hwirq].fwnode =3D &ipar->fwnode; - ret =3D of_property_read_u32(ipar, "#interrupt-cells", &intsize); - if (ret) - return ret; - - if (intsize > mapsize) - return -EINVAL; + ipar =3D of_node_get(imap_item.parent_args.np); + priv->map[hwirq].fwnode =3D of_fwnode_handle(ipar); =20 - priv->map[hwirq].param_count =3D intsize; - for (j =3D 0; j < intsize; ++j) - priv->map[hwirq].param[j] =3D be32_to_cpup(map++); - mapsize -=3D intsize; + priv->map[hwirq].param_count =3D imap_item.parent_args.args_count; + for (i =3D 0; i < priv->map[hwirq].param_count; i++) + priv->map[hwirq].param[i] =3D imap_item.parent_args.args[i]; } return 0; } --=20 2.52.0 From nobody Sat Feb 7 08:23:21 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96176389E0C; Wed, 14 Jan 2026 09:40:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383652; cv=none; b=kzXj7WmDBjoiL6nu2M+kQGTIFYhrvzhWiI3V6M4ccFkZuAxt4dpjsrrSK1b1tOurBu2lSZSx2UYcnBizeH8YpoRmOeWitnEu1ucv1YDb+UDpQuqpUgcPYCprX1FglLp4o4r4JcLH+f63rqqTpbOWpw6Rd9ux/287ZxD6z46f+/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383652; c=relaxed/simple; bh=3fifJH6jPhjpUsOkz3ncUoHMaDbVCkbvrHplYvH2Uyg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=syRyjpE3IJHnpG3+M71MipNN6+iGIA4gJexZQWkHWMzFp9udh0+PTvjsuUTncnIsxOQXbavbijimTeunF3I8LJl8M07JJKnBVOzUqaOr4z6e86gqd1OizaYnd4glZHGGuT4UfOqkbSKxJko5bug3s5+zAxe1Y9/9iYSbnouAG6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=jgxA5TGo; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="jgxA5TGo" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 674D6C1F1D3; Wed, 14 Jan 2026 09:40:22 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0BEC26074A; Wed, 14 Jan 2026 09:40:49 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 338CC103C89EC; Wed, 14 Jan 2026 10:40:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768383648; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=fQCpmqi0I/63GrT0ubc5oAKlmvHMRk4TMDR9BqlL+NY=; b=jgxA5TGoVwWjBqutwlc+I6gW+2cmXyjgEuiXXlZFLGEtVzOd7IUM5baXiUR32XFNi+NqRP ZVGT5dMuUFPmawCHThbBKk4p06v5BZjgkSJVPulIkLJ9XTORH433U+yT8Ht0WO6q2g4EmD 4Nsjjf2VBqH2KPyaKkkKhhvZ1Rs4SCpJecHzCpYbzRWDq3hLk38uR9VBubLj4K07siw2j0 JpUNV0NcRhyFGavaIotUcif61VqQ9G55RNkNAfwc+ttV7NZdy3Ze/yp67bK+Ei5MD3L/W7 fcX2/2GP/VetPTk2H5n7r8C1kwbLVJSBkvyOgsfElkwT/BnexrbvBMOud36inQ== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Herve Codina Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni Subject: [PATCH v8 4/8] irqchip/renesas-rza1: Use for_each_of_imap_item iterator Date: Wed, 14 Jan 2026 10:39:33 +0100 Message-ID: <20260114093938.1089936-5-herve.codina@bootlin.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114093938.1089936-1-herve.codina@bootlin.com> References: <20260114093938.1089936-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" The renesas-rza1 driver parses the interrupt-map property. It does it using open code. Recently for_each_of_imap_item iterator has been introduce to help drivers in this parsing. Convert the renesas-rza1 driver to use the for_each_of_imap_item iterator instead of open code. Signed-off-by: Herve Codina (Schneider Electric) Tested-by: Wolfram Sang Reviewed-by: Linus Walleij Reviewed-by > Acked-by Reviewed-by: Thomas Gleixner Tested-by tag? That sends you to the back of the queue in my normal --- drivers/irqchip/irq-renesas-rza1.c | 43 +++++++++++------------------- 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/drivers/irqchip/irq-renesas-rza1.c b/drivers/irqchip/irq-renes= as-rza1.c index 6047a524ac77..370d968b2398 100644 --- a/drivers/irqchip/irq-renesas-rza1.c +++ b/drivers/irqchip/irq-renesas-rza1.c @@ -142,47 +142,36 @@ static const struct irq_domain_ops rza1_irqc_domain_o= ps =3D { static int rza1_irqc_parse_map(struct rza1_irqc_priv *priv, struct device_node *gic_node) { + struct of_imap_parser imap_parser; struct device *dev =3D priv->dev; - unsigned int imaplen, i, j; + struct of_imap_item imap_item; struct device_node *ipar; - const __be32 *imap; - u32 intsize; + unsigned int j; + u32 i =3D 0; int ret; =20 - imap =3D of_get_property(dev->of_node, "interrupt-map", &imaplen); - if (!imap) - return -EINVAL; - - for (i =3D 0; i < IRQC_NUM_IRQ; i++) { - if (imaplen < 3) - return -EINVAL; + ret =3D of_imap_parser_init(&imap_parser, dev->of_node, &imap_item); + if (ret) + return ret; =20 + for_each_of_imap_item(&imap_parser, &imap_item) { /* Check interrupt number, ignore sense */ - if (be32_to_cpup(imap) !=3D i) + if (imap_item.child_imap[0] !=3D i) { + of_node_put(imap_item.parent_args.np); return -EINVAL; + } =20 - ipar =3D of_find_node_by_phandle(be32_to_cpup(imap + 2)); + ipar =3D imap_item.parent_args.np; if (ipar !=3D gic_node) { of_node_put(ipar); return -EINVAL; } =20 - imap +=3D 3; - imaplen -=3D 3; - - ret =3D of_property_read_u32(ipar, "#interrupt-cells", &intsize); - of_node_put(ipar); - if (ret) - return ret; - - if (imaplen < intsize) - return -EINVAL; - - priv->map[i].args_count =3D intsize; - for (j =3D 0; j < intsize; j++) - priv->map[i].args[j] =3D be32_to_cpup(imap++); + priv->map[i].args_count =3D imap_item.parent_args.args_count; + for (j =3D 0; j < priv->map[i].args_count; j++) + priv->map[i].args[j] =3D imap_item.parent_args.args[j]; =20 - imaplen -=3D intsize; + i++; } =20 return 0; --=20 2.52.0 From nobody Sat Feb 7 08:23:21 2026 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83DAF38A9A9; Wed, 14 Jan 2026 09:40:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.171.202.116 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383655; cv=none; b=AE0SSLkkShgpjQZx6rWMUDf9ESL48nLEOAYDshoTSSJ/ZmeiFbptn1ZXfscpXEkYe7mU9IM7Mw43PlL6w/6iTjtSJX0thbHryrzj1aM68JRkvQusImUI2RmluhDlTJZg+f+wod4A+J+Tl34kb5sgHeWJnz/3S4ZWF0ugTUds7B4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383655; c=relaxed/simple; bh=3qZMN6RqFSkMZbjjHoXPFV3t/T0/XqJcG5tYrD4IzyQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ttuooO/luADapcQPbbQD3Ef4fdbenrJw3kCYYE1cUhyF8tClqM0zwqdguVPir3jgfzrKTN+DWpWu3GCIGiYDL3wJ6dbOsNLptxewmHlbSAfNX8CaPKoWOyIXBsnkgRMCdWblEjdMKH8a1trYRIh58iDJZsz7C8HSmHkjxuUt8dc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=i7C+j53N; arc=none smtp.client-ip=185.171.202.116 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="i7C+j53N" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 68E4FC2087B; Wed, 14 Jan 2026 09:40:25 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 0C0A56074A; Wed, 14 Jan 2026 09:40:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 8DD58103C89D0; Wed, 14 Jan 2026 10:40:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768383650; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=9uIq4HEaC4OUxNjP3TUa7jndQAMD2PvbQyB6H7Zp4Qw=; b=i7C+j53No4M3GOD+skeYbqbldp0lLQwyzM5wlsIcvWogeP0dMuJI58DGCZBar2aS7UBJ4B 5Gz10o+ydbgONiBhyf+n7Z7s09aViHTEk4U+S21znmfwX/6rMiIonYUGODm6dGDnSH882E qTNHPYdnaRcDKUZb8b2sbre5TjraNNEV15yp5ouEu2yEzZHB3/Sy/xG+qwIeqHqHRhvGpm RDenZGa4ou6eVQ3YFYJkrFm+C8k/ZO0+Tq1xTW/nYN4IjB9tClfOezGO/ETsytv9dHU9iJ ZOujwaJRHCFiAfpCd11Ug/bp8pYf5IeEO6K9nz4KcUeNPVFa8WLVVFfUHtvoig== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Herve Codina Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni , Bartosz Golaszewski Subject: [PATCH v8 5/8] ARM: dts: r9a06g032: Add GPIO controllers Date: Wed, 14 Jan 2026 10:39:34 +0100 Message-ID: <20260114093938.1089936-6-herve.codina@bootlin.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114093938.1089936-1-herve.codina@bootlin.com> References: <20260114093938.1089936-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" Add GPIO controllers (Synopsys DesignWare IPs) available in the r9a06g032 (RZ/N1D) SoC. Signed-off-by: Herve Codina (Schneider Electric) Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Reviewed-by: Bartosz Golaszewski Reviewed-by: Geert Uytterhoeven Reviewed-by: Linus Walleij Reviewed-by > Acked-by Tested-by tag? That sends you to the back of the queue in my normal --- arch/arm/boot/dts/renesas/r9a06g032.dtsi | 118 +++++++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/arch/arm/boot/dts/renesas/r9a06g032.dtsi b/arch/arm/boot/dts/r= enesas/r9a06g032.dtsi index 8debb77803bb..06d35a83f6e1 100644 --- a/arch/arm/boot/dts/renesas/r9a06g032.dtsi +++ b/arch/arm/boot/dts/renesas/r9a06g032.dtsi @@ -509,6 +509,124 @@ gic: interrupt-controller@44101000 { ; }; =20 + /* + * The GPIO mapping to the corresponding pins is not obvious. + * See the hardware documentation for details. + */ + gpio0: gpio@5000b000 { + compatible =3D "snps,dw-apb-gpio"; + reg =3D <0x5000b000 0x80>; + #address-cells =3D <1>; + #size-cells =3D <0>; + clocks =3D <&sysctrl R9A06G032_HCLK_GPIO0>; + clock-names =3D "bus"; + + /* GPIO0a[0] connected to pin GPIO0 */ + /* GPIO0a[1..2] connected to pins GPIO3..4 */ + /* GPIO0a[3..4] connected to pins GPIO9..10 */ + /* GPIO0a[5] connected to pin GPIO12 */ + /* GPIO0a[6..7] connected to pins GPIO15..16 */ + /* GPIO0a[8..9] connected to pins GPIO21..22 */ + /* GPIO0a[10] connected to pin GPIO24 */ + /* GPIO0a[11..12] connected to pins GPIO27..28 */ + /* GPIO0a[13..14] connected to pins GPIO33..34 */ + /* GPIO0a[15] connected to pin GPIO36 */ + /* GPIO0a[16..17] connected to pins GPIO39..40 */ + /* GPIO0a[18..19] connected to pins GPIO45..46 */ + /* GPIO0a[20] connected to pin GPIO48 */ + /* GPIO0a[21..22] connected to pins GPIO51..52 */ + /* GPIO0a[23..24] connected to pins GPIO57..58 */ + /* GPIO0a[25..31] connected to pins GPIO62..68 */ + gpio0a: gpio-port@0 { + compatible =3D "snps,dw-apb-gpio-port"; + reg =3D <0>; + gpio-controller; + #gpio-cells =3D <2>; + snps,nr-gpios =3D <32>; + }; + + /* GPIO0b[0..1] connected to pins GPIO1..2 */ + /* GPIO0b[2..5] connected to pins GPIO5..8 */ + /* GPIO0b[6] connected to pin GPIO11 */ + /* GPIO0b[7..8] connected to pins GPIO13..14 */ + /* GPIO0b[9..12] connected to pins GPIO17..20 */ + /* GPIO0b[13] connected to pin GPIO23 */ + /* GPIO0b[14..15] connected to pins GPIO25..26 */ + /* GPIO0b[16..19] connected to pins GPIO29..32 */ + /* GPIO0b[20] connected to pin GPIO35 */ + /* GPIO0b[21..22] connected to pins GPIO37..38 */ + /* GPIO0b[23..26] connected to pins GPIO41..44 */ + /* GPIO0b[27] connected to pin GPIO47 */ + /* GPIO0b[28..29] connected to pins GPIO49..50 */ + /* GPIO0b[30..31] connected to pins GPIO53..54 */ + gpio0b: gpio-port@1 { + compatible =3D "snps,dw-apb-gpio-port"; + reg =3D <1>; + gpio-controller; + #gpio-cells =3D <2>; + snps,nr-gpios =3D <32>; + }; + }; + + gpio1: gpio@5000c000 { + compatible =3D "snps,dw-apb-gpio"; + reg =3D <0x5000c000 0x80>; + #address-cells =3D <1>; + #size-cells =3D <0>; + clocks =3D <&sysctrl R9A06G032_HCLK_GPIO1>; + clock-names =3D "bus"; + + /* GPIO1a[0..4] connected to pins GPIO69..73 */ + /* GPIO1a[5..31] connected to pins GPIO95..121 */ + gpio1a: gpio-port@0 { + compatible =3D "snps,dw-apb-gpio-port"; + reg =3D <0>; + gpio-controller; + #gpio-cells =3D <2>; + snps,nr-gpios =3D <32>; + }; + + /* GPIO1b[0..1] connected to pins GPIO55..56 */ + /* GPIO1b[2..4] connected to pins GPIO59..61 */ + /* GPIO1b[5..25] connected to pins GPIO74..94 */ + /* GPIO1b[26..31] connected to pins GPIO150..155 */ + gpio1b: gpio-port@1 { + compatible =3D "snps,dw-apb-gpio-port"; + reg =3D <1>; + gpio-controller; + #gpio-cells =3D <2>; + snps,nr-gpios =3D <32>; + }; + }; + + gpio2: gpio@5000d000 { + compatible =3D "snps,dw-apb-gpio"; + reg =3D <0x5000d000 0x80>; + #address-cells =3D <1>; + #size-cells =3D <0>; + clocks =3D <&sysctrl R9A06G032_HCLK_GPIO2>; + clock-names =3D "bus"; + + /* GPIO2a[0..27] connected to pins GPIO122..149 */ + /* GPIO2a[28..31] connected to pins GPIO156..159 */ + gpio2a: gpio-port@0 { + compatible =3D "snps,dw-apb-gpio-port"; + reg =3D <0>; + gpio-controller; + #gpio-cells =3D <2>; + snps,nr-gpios =3D <32>; + }; + + /* GPIO2b[0..9] connected to pins GPIO160..169 */ + gpio2b: gpio-port@1 { + compatible =3D "snps,dw-apb-gpio-port"; + reg =3D <1>; + gpio-controller; + #gpio-cells =3D <2>; + snps,nr-gpios =3D <10>; + }; + }; + can0: can@52104000 { compatible =3D "renesas,r9a06g032-sja1000", "renesas,rzn1-sja1000"; reg =3D <0x52104000 0x800>; --=20 2.52.0 From nobody Sat Feb 7 08:23:21 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 347DB38A9D7 for ; Wed, 14 Jan 2026 09:40:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383661; cv=none; b=ip/bavQufnBDpbEMiBWTdPsHkNPG5jUXRh6c3TOVYmsdIZsFKKTlWlDq2KcU1vg9OUaeTJfSN77Ls3G1wCmuDbsu7uDADmVR1hblHlvwW+g+4gBTLqYyJd7QEGG8BU1OKuF+XzUbn0se1n7d02NKIMVXueh/DBXQR9vmlEW4ZjM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383661; c=relaxed/simple; bh=cPYz7Rl3IGZjYUip8LQYzhHjmVpG6HFaUtmNGOzanJw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qu1KY5Ho2dN7ssOJUt27NYAZ9FebShz6cVey+iSLjVAigPZXLD7MhGTSOu6hH7p2ogGVcwYRU/P24lEJxCp0c5GHanb2mtt5slZbU3SRTJZqgUCEfO3SH0s0Kh3NGWF5qI1Q8UJMGAPsPavwX6++UIeX3HbVRJkXIzQ50+DjtR0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=no++D12R; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="no++D12R" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id D4B674E420CA; Wed, 14 Jan 2026 09:40:54 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id AA3696074A; Wed, 14 Jan 2026 09:40:54 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9A24F103C89C2; Wed, 14 Jan 2026 10:40:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768383653; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=C57NZV6yvzIJfDxz/lCn6sc57mHd2EX6xsrZ1yoZq3Q=; b=no++D12RLBZElI2ock8k58U+gKN+Jyo9gHzyphq5mabRvTI848geptzauUFQ2hTvrfwIQC iJNa9/yGtjtAqe0amvAY2lxmjrbhtw5gFVauRLkavG2KHRNzb3lxS17Z/dSm79PHBdIFN5 awDh/+rEzVFP1hc3CEq+ngOFGe0Oq6/WkvhjsXMx7qw3YGF00kGPLa4tGox9UwWfUr1n36 pJUgtH4vxAnlePOOWkG6jFax8QFmkwGnZVCGHHL+4tt4hB8P/oe683P2oWftpsZLSqhFvD ByYwZAqhThDa5bfFAOJEepzSqTU4/q0F1D8E6p4otv60AYPDh8S34PuMf8mINw== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Herve Codina Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni Subject: [PATCH v8 6/8] dt-bindings: soc: renesas: Add the Renesas RZ/N1 GPIO Interrupt Multiplexer Date: Wed, 14 Jan 2026 10:39:35 +0100 Message-ID: <20260114093938.1089936-7-herve.codina@bootlin.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114093938.1089936-1-herve.codina@bootlin.com> References: <20260114093938.1089936-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" On the Renesas RZ/N1 SoC, GPIOs can generate interruptions. Those interruption lines are multiplexed by the GPIO Interrupt Multiplexer in order to map 32 * 3 GPIO interrupt lines to 8 GIC interrupt lines. The GPIO interrupt multiplexer IP does nothing but select 8 GPIO IRQ lines out of the 96 available to wire them to the GIC input lines. Signed-off-by: Herve Codina (Schneider Electric) Reviewed-by: Wolfram Sang Reviewed-by: Rob Herring (Arm) Reviewed-by: Linus Walleij Reviewed-by: Geert Uytterhoeven Reviewed-by > Acked-by Tested-by tag? That sends you to the back of the queue in my normal --- .../soc/renesas/renesas,rzn1-gpioirqmux.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/renesas/renesas,r= zn1-gpioirqmux.yaml diff --git a/Documentation/devicetree/bindings/soc/renesas/renesas,rzn1-gpi= oirqmux.yaml b/Documentation/devicetree/bindings/soc/renesas/renesas,rzn1-g= pioirqmux.yaml new file mode 100644 index 000000000000..1a31c11bc3b4 --- /dev/null +++ b/Documentation/devicetree/bindings/soc/renesas/renesas,rzn1-gpioirqmux= .yaml @@ -0,0 +1,87 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/soc/renesas/renesas,rzn1-gpioirqmux.yam= l# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas RZ/N1 SoCs GPIO Interrupt Multiplexer + +description: | + The Renesas RZ/N1 GPIO Interrupt Multiplexer multiplexes GPIO interrupt + lines to the interrupt controller available in the SoC. + + It selects up to 8 of the 96 GPIO interrupt lines available and connect= them + to 8 output interrupt lines. + +maintainers: + - Herve Codina + +properties: + compatible: + items: + - enum: + - renesas,r9a06g032-gpioirqmux + - const: renesas,rzn1-gpioirqmux + + reg: + maxItems: 1 + + "#address-cells": + const: 0 + + "#interrupt-cells": + const: 1 + + interrupt-map-mask: + items: + - const: 0x7f + + interrupt-map: + description: | + Specifies the mapping from external GPIO interrupt lines to the outp= ut + interrupts. The array has up to 8 items defining the mapping related= to + the output line 0 (GIC 103) up to the output line 7 (GIC 110). + + The child interrupt number set in arrays items is computed using the + following formula: + gpio_bank * 32 + gpio_number + with: + - gpio_bank: The GPIO bank number + - 0 for GPIO0A, + - 1 for GPIO1A, + - 2 for GPIO2A + - gpio_number: Number of the gpio in the bank (0..31) + minItems: 1 + maxItems: 8 + +required: + - compatible + - reg + - "#address-cells" + - "#interrupt-cells" + - interrupt-map-mask + - interrupt-map + +additionalProperties: false + +examples: + - | + #include + + gic: interrupt-controller { + interrupt-controller; + #address-cells =3D <0>; + #interrupt-cells =3D <3>; + }; + + interrupt-controller@51000480 { + compatible =3D "renesas,r9a06g032-gpioirqmux", "renesas,rzn1-gpioi= rqmux"; + reg =3D <0x51000480 0x20>; + #address-cells =3D <0>; + #interrupt-cells =3D <1>; + interrupt-map-mask =3D <0x7f>; + interrupt-map =3D + <32 &gic GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>, /* line 0, GPIO1A.0= */ + <89 &gic GIC_SPI 104 IRQ_TYPE_LEVEL_HIGH>, /* line 1, GPIO2A.2= 5 */ + <9 &gic GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; /* line 3, GPIO0A.9 = */ + }; --=20 2.52.0 From nobody Sat Feb 7 08:23:21 2026 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F33B38A9BA; Wed, 14 Jan 2026 09:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383665; cv=none; b=A4U9dyuu8lailZ5YNFMXtCqlRAFgQPx6bRg/hYhtSQB2M/9A5htQdIbj3iELW7Tcf+q7h7z6KahnzsTiiEPUHvb98WAchEQA9ynemZH6/jC+fppkzH32sBXmF8/YFyDzsbeXD5XS9DJVNWcEKnRmO7qq4PUcmIlNl6KxrDOJSYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383665; c=relaxed/simple; bh=1+hhTLRRJG+Cyziw8HidX1b6AZuTf8DRlXdZT5dxvmM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j+/gd404h8Se7/6I7Q0fYCIepHUooNV8ZyoFtDnk8e6stpH3NtxVJOmNT8N4HctBKGqKtLFWJtrrhunZilm+iYScdyO8aCrXB0/A0Co1NJBjf9xfNo4apDc2bC0HBlOUVWTSkWwn9Dnu3UA/g4CBT5GugRyGwAmnGCzIGEV9jns= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=B/uegnm+; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="B/uegnm+" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 128C04E420D0; Wed, 14 Jan 2026 09:40:58 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id DAEC26074A; Wed, 14 Jan 2026 09:40:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 51F53103C89E4; Wed, 14 Jan 2026 10:40:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768383657; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=AfgtNuhQLvHHpWBwaaOqWAYPpKWvaoKh0A4ISWCHImo=; b=B/uegnm+SqPmP0OjYkdZ5ISX+buDx4u/XJiQ148vxU5qWysXt+kBzG51q5dxxIP2Auo1oV EitVHlK80dBx/aipeTQNIvKnvpXFfn2FY29sw9ZkfFR5TOWUIko/f9v/1Kf6JFoIOw029W TS4EB5w2RBEyoGLlQEbUIN67D+7OFxuwgr5q28H+57lk/Dv6etjqsMqag8GRwCrkDMgdWa yeyUS29+jn/G38h9iyKaDSHx8sDEd7rJ42f8qk6gKIbYSaGlQhgGB9W4Vc2ILWn26c+R51 92YoqfSnMWYbifTacAARAnpOzOWzcsspshOz3kAQNBWcOXK7Chpc0vJ4gMvn7w== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Herve Codina Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni Subject: [PATCH v8 7/8] soc: renesas: Add support for Renesas RZ/N1 GPIO Interrupt Multiplexer Date: Wed, 14 Jan 2026 10:39:36 +0100 Message-ID: <20260114093938.1089936-8-herve.codina@bootlin.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114093938.1089936-1-herve.codina@bootlin.com> References: <20260114093938.1089936-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" On the Renesas RZ/N1 SoC, GPIOs can generate interruptions. Those interruption lines are multiplexed by the GPIO Interrupt Multiplexer in order to map 32 * 3 GPIO interrupt lines to 8 GIC interrupt lines. The GPIO interrupt multiplexer IP does nothing but select 8 GPIO IRQ lines out of the 96 available to wire them to the GIC input lines. Signed-off-by: Herve Codina (Schneider Electric) Reviewed-by: Linus Walleij Tested-by: Wolfram Sang Reviewed-by: Wolfram Sang Reviewed-by: Geert Uytterhoeven Reviewed-by > Acked-by Tested-by tag? That sends you to the back of the queue in my normal --- drivers/soc/renesas/Kconfig | 4 + drivers/soc/renesas/Makefile | 1 + drivers/soc/renesas/rzn1_irqmux.c | 127 ++++++++++++++++++++++++++++++ 3 files changed, 132 insertions(+) create mode 100644 drivers/soc/renesas/rzn1_irqmux.c diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig index 340a1ff7e92b..2dc51873480a 100644 --- a/drivers/soc/renesas/Kconfig +++ b/drivers/soc/renesas/Kconfig @@ -62,6 +62,7 @@ config ARCH_RZN1 select PM select PM_GENERIC_DOMAINS select ARM_AMBA + select RZN1_IRQMUX if GPIO_DWAPB =20 if ARM && ARCH_RENESAS =20 @@ -459,6 +460,9 @@ config PWC_RZV2M config RST_RCAR bool "Reset Controller support for R-Car" if COMPILE_TEST =20 +config RZN1_IRQMUX + bool "Renesas RZ/N1 GPIO IRQ multiplexer support" if COMPILE_TEST + config SYSC_RZ bool "System controller for RZ SoCs" if COMPILE_TEST select MFD_SYSCON diff --git a/drivers/soc/renesas/Makefile b/drivers/soc/renesas/Makefile index 3bdcc6a395d5..33d44d964d61 100644 --- a/drivers/soc/renesas/Makefile +++ b/drivers/soc/renesas/Makefile @@ -14,4 +14,5 @@ obj-$(CONFIG_SYS_R9A09G057) +=3D r9a09g057-sys.o # Family obj-$(CONFIG_PWC_RZV2M) +=3D pwc-rzv2m.o obj-$(CONFIG_RST_RCAR) +=3D rcar-rst.o +obj-$(CONFIG_RZN1_IRQMUX) +=3D rzn1_irqmux.o obj-$(CONFIG_SYSC_RZ) +=3D rz-sysc.o diff --git a/drivers/soc/renesas/rzn1_irqmux.c b/drivers/soc/renesas/rzn1_i= rqmux.c new file mode 100644 index 000000000000..b50b295f83d7 --- /dev/null +++ b/drivers/soc/renesas/rzn1_irqmux.c @@ -0,0 +1,127 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * RZ/N1 GPIO Interrupt Multiplexer + * + * Copyright 2025 Schneider Electric + * Author: Herve Codina + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Up to 8 output lines are connected to GIC SPI interrupt controller + * starting at IRQ 103. + */ +#define RZN1_IRQMUX_GIC_SPI_BASE 103 +#define RZN1_IRQMUX_NUM_OUTPUTS 8 + +static int rzn1_irqmux_parent_args_to_line_index(struct device *dev, + const struct of_phandle_args *parent_args) +{ + /* + * The parent interrupt should be one of the GIC controller. + * Three arguments must be provided. + * - args[0]: GIC_SPI + * - args[1]: The GIC interrupt number + * - args[2]: The interrupt flags + * + * We retrieve the line index based on the GIC interrupt number + * provided. + */ + + if (parent_args->args_count !=3D 3 || parent_args->args[0] !=3D GIC_SPI) { + dev_err(dev, "Invalid interrupt-map item\n"); + return -EINVAL; + } + + if (parent_args->args[1] < RZN1_IRQMUX_GIC_SPI_BASE || + parent_args->args[1] >=3D RZN1_IRQMUX_GIC_SPI_BASE + RZN1_IRQMUX_NUM_= OUTPUTS) { + dev_err(dev, "Invalid GIC interrupt %u\n", parent_args->args[1]); + return -EINVAL; + } + + return parent_args->args[1] - RZN1_IRQMUX_GIC_SPI_BASE; +} + +static int rzn1_irqmux_probe(struct platform_device *pdev) +{ + DECLARE_BITMAP(index_done, RZN1_IRQMUX_NUM_OUTPUTS) =3D {}; + struct device *dev =3D &pdev->dev; + struct device_node *np =3D dev->of_node; + struct of_imap_parser imap_parser; + struct of_imap_item imap_item; + u32 __iomem *regs; + int index; + int ret; + u32 tmp; + + regs =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + /* We support only #interrupt-cells =3D <1> and #address-cells =3D <0> */ + ret =3D of_property_read_u32(np, "#interrupt-cells", &tmp); + if (ret) + return ret; + if (tmp !=3D 1) + return -EINVAL; + + ret =3D of_property_read_u32(np, "#address-cells", &tmp); + if (ret) + return ret; + if (tmp !=3D 0) + return -EINVAL; + + ret =3D of_imap_parser_init(&imap_parser, np, &imap_item); + if (ret) + return ret; + + for_each_of_imap_item(&imap_parser, &imap_item) { + index =3D rzn1_irqmux_parent_args_to_line_index(dev, &imap_item.parent_a= rgs); + if (index < 0) { + of_node_put(imap_item.parent_args.np); + return index; + } + + if (test_and_set_bit(index, index_done)) { + of_node_put(imap_item.parent_args.np); + dev_err(dev, "Mux output line %d already defined in interrupt-map\n", + index); + return -EINVAL; + } + + /* + * The child #address-cells is 0 (already checked). The first + * value in imap item is the src hwirq. + */ + writel(imap_item.child_imap[0], regs + index); + } + + return 0; +} + +static const struct of_device_id rzn1_irqmux_of_match[] =3D { + { .compatible =3D "renesas,rzn1-gpioirqmux", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, rzn1_irqmux_of_match); + +static struct platform_driver rzn1_irqmux_driver =3D { + .probe =3D rzn1_irqmux_probe, + .driver =3D { + .name =3D "rzn1_irqmux", + .of_match_table =3D rzn1_irqmux_of_match, + }, +}; +module_platform_driver(rzn1_irqmux_driver); + +MODULE_AUTHOR("Herve Codina "); +MODULE_DESCRIPTION("Renesas RZ/N1 GPIO IRQ Multiplexer Driver"); +MODULE_LICENSE("GPL"); --=20 2.52.0 From nobody Sat Feb 7 08:23:21 2026 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16F0E389E0E; Wed, 14 Jan 2026 09:41:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383674; cv=none; b=QnRhHWz1tqv3j7onivEZWq+3A3evb1+JmfiLNn84hm+UxLcC6jRZ/s9vM/yYppBGZJ4PusuWx6hMOy+GKKaO4p8d/VjYxMirj9hQhh3/DbyMI/5M0OI1VDAZ8iNsizpKtgah8m6m+NMDOaJL+JMul7hF2I9Io41q7dGedNCAjbk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768383674; c=relaxed/simple; bh=F1xTHCI1Ed7nYG/rtTMfvA6CqjcOQAgGmvhyIuFP8qM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gGFVDmeVemWPgkT4dRTxNlK3Vh1rmUhppbxL87WscXQBoJjTU4eASnEkfgPYWzhn4kThk1tmrJ4FM8lHddeBkWDFZJLuR9a68ZA1aVqJLWjADeBoxWzB7fHaUbMMxpKc3mNm0e4Vw2i9U3bMAOAU/W+WvqbScqWo0Zqo1u4iO7U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=dL9Srvus; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="dL9Srvus" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id AAB231A2867; Wed, 14 Jan 2026 09:41:01 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 7E3736074A; Wed, 14 Jan 2026 09:41:01 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 05EF7103C89BA; Wed, 14 Jan 2026 10:40:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1768383660; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=2VCn7I4gCTMmmQjjA78kjMlv2YeMBURM51/gLVjOYg4=; b=dL9SrvusuP1j1RF/8KYISJpoNxBUgLzS3o5IRBY9AFFXsu3DkHQVbAJ6faBxfEAXKGO//w l34PCEDHF4qyluUvyJhgsD2oYnuyixj4gVxCg/Lmjoax5nTqf74XPEYLIUfV/zl9Mz1fbp 76C4IGqBK9N8vMNlWwXpAlVBCQIcAtveU0Rm97l+7mt5wVU+h4rI5iF0UIwlhAcQRQsJ7Q 5XmZRZAaQxxBQuL919DJS09BIeBgsqUhEhrqhQDCLZgcjyegr0664ymnW2+zK+3TR0UIbW nIimBTIbQC7uzB5x/RJ2rWg2SI2jgq22bn0UTO7LuYFzBtlgk5zOC3mzR6/blQ== From: "Herve Codina (Schneider Electric)" To: Thomas Gleixner , Wolfram Sang , Linus Walleij , Bartosz Golaszewski , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Magnus Damm , Saravana Kannan , Herve Codina Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Pascal Eberhard , Miquel Raynal , Thomas Petazzoni , Bartosz Golaszewski Subject: [PATCH v8 8/8] ARM: dts: r9a06g032: Add support for GPIO interrupts Date: Wed, 14 Jan 2026 10:39:37 +0100 Message-ID: <20260114093938.1089936-9-herve.codina@bootlin.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260114093938.1089936-1-herve.codina@bootlin.com> References: <20260114093938.1089936-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" In the RZ/N1 SoC, the GPIO interrupts are multiplexed using the GPIO Interrupt Multiplexer. Add the multiplexer node and connect GPIO interrupt lines to the multiplexer. The interrupt-map available in the multiplexer node has to be updated in dts files depending on the GPIO usage. Indeed, the usage of an interrupt for a GPIO is board dependent. Up to 8 GPIOs can be used as an interrupt line (one per multiplexer output interrupt). Signed-off-by: Herve Codina (Schneider Electric) Reviewed-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang Reviewed-by > Acked-by Tested-by tag? That sends you to the back of the queue in my normal --- arch/arm/boot/dts/renesas/r9a06g032.dtsi | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/arch/arm/boot/dts/renesas/r9a06g032.dtsi b/arch/arm/boot/dts/r= enesas/r9a06g032.dtsi index 06d35a83f6e1..b8e03c529007 100644 --- a/arch/arm/boot/dts/renesas/r9a06g032.dtsi +++ b/arch/arm/boot/dts/renesas/r9a06g032.dtsi @@ -543,6 +543,14 @@ gpio0a: gpio-port@0 { gpio-controller; #gpio-cells =3D <2>; snps,nr-gpios =3D <32>; + + interrupt-controller; + interrupt-parent =3D <&gpioirqmux>; + interrupts =3D <0 1 2 3 4 5 6 7 + 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 + 24 25 26 27 28 29 30 31>; + #interrupt-cells =3D <2>; }; =20 /* GPIO0b[0..1] connected to pins GPIO1..2 */ @@ -584,6 +592,14 @@ gpio1a: gpio-port@0 { gpio-controller; #gpio-cells =3D <2>; snps,nr-gpios =3D <32>; + + interrupt-controller; + interrupt-parent =3D <&gpioirqmux>; + interrupts =3D <32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 + 48 49 50 51 52 53 54 55 + 56 57 58 59 60 61 62 63>; + #interrupt-cells =3D <2>; }; =20 /* GPIO1b[0..1] connected to pins GPIO55..56 */ @@ -615,6 +631,14 @@ gpio2a: gpio-port@0 { gpio-controller; #gpio-cells =3D <2>; snps,nr-gpios =3D <32>; + + interrupt-controller; + interrupt-parent =3D <&gpioirqmux>; + interrupts =3D <64 65 66 67 68 69 70 71 + 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 + 88 89 90 91 92 93 94 95>; + #interrupt-cells =3D <2>; }; =20 /* GPIO2b[0..9] connected to pins GPIO160..169 */ @@ -627,6 +651,23 @@ gpio2b: gpio-port@1 { }; }; =20 + gpioirqmux: interrupt-controller@51000480 { + compatible =3D "renesas,r9a06g032-gpioirqmux", "renesas,rzn1-gpioirqmux= "; + reg =3D <0x51000480 0x20>; + #interrupt-cells =3D <1>; + #address-cells =3D <0>; + interrupt-map-mask =3D <0x7f>; + + /* + * Example mapping entry. Board DTs need to overwrite + * 'interrupt-map' with their specific mapping. Check + * the irqmux binding documentation for details. + */ + interrupt-map =3D <0 &gic GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; + + status =3D "disabled"; + }; + can0: can@52104000 { compatible =3D "renesas,r9a06g032-sja1000", "renesas,rzn1-sja1000"; reg =3D <0x52104000 0x800>; --=20 2.52.0