devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] irqchip/sg2042-msi: Set irq type according to DT configuration
@ 2025-09-04  3:00 Chen Wang
  2025-09-04  3:00 ` [PATCH v3 1/3] riscv: sophgo: dts: sg2042: change msi irq type to IRQ_TYPE_EDGE_RISING Chen Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chen Wang @ 2025-09-04  3:00 UTC (permalink / raw)
  To: u.kleine-koenig, aou, unicorn_wang, conor+dt, inochiama, krzk+dt,
	looong.bin, palmer, paul.walmsley, robh, tglx, sycamoremoon376,
	devicetree, linux-kernel, linux-riscv, sophgo

From: Chen Wang <unicorn_wang@outlook.com>

Read the device tree configuration and then use it to set the
interrupt type.

This patchset is based on irq/drivers branch of tip.

---

Changes in v3:
  Thers is no major change in this version. Just adjust the order of the patches
  to change the DTs first. Thanks to Thomas for the suggestion.

Changes in v2:
  The patch series is based on irq/drivers branch of tip. You can simply review
  or test the patches at the link [2].

  Reverted the change to obtain params of "msi-ranges"; it's better not to
  assume the value of "#interrupt-cells" is 2, even though it's known to be
  the case. Thanks to Inochi for the comments.

Changes in v1:
  The patch series is based on irq/drivers branch of tip. You can simply review
  or test the patches at the link [1].

Link: https://lore.kernel.org/linux-riscv/cover.1756103516.git.unicorn_wang@outlook.com/ [1]
Link: https://lore.kernel.org/linux-riscv/cover.1756169460.git.unicorn_wang@outlook.com/ [2]
---

Chen Wang (3):
  riscv: sophgo: dts: sg2042: change msi irq type to
    IRQ_TYPE_EDGE_RISING
  riscv: sophgo: dts: sg2044: change msi irq type to
    IRQ_TYPE_EDGE_RISING
  irqchip/sg2042-msi: Set irq type according to DT configuration

 arch/riscv/boot/dts/sophgo/sg2042.dtsi | 2 +-
 arch/riscv/boot/dts/sophgo/sg2044.dtsi | 2 +-
 drivers/irqchip/irq-sg2042-msi.c       | 7 +++++--
 3 files changed, 7 insertions(+), 4 deletions(-)


base-commit: d36bf356068cdb5499b9bc458db9149c0fd938a2
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/3] riscv: sophgo: dts: sg2042: change msi irq type to IRQ_TYPE_EDGE_RISING
  2025-09-04  3:00 [PATCH v3 0/3] irqchip/sg2042-msi: Set irq type according to DT configuration Chen Wang
@ 2025-09-04  3:00 ` Chen Wang
  2025-09-04  3:00 ` [PATCH v3 2/3] riscv: sophgo: dts: sg2044: " Chen Wang
  2025-09-04  3:01 ` [PATCH v3 3/3] irqchip/sg2042-msi: Set irq type according to DT configuration Chen Wang
  2 siblings, 0 replies; 4+ messages in thread
From: Chen Wang @ 2025-09-04  3:00 UTC (permalink / raw)
  To: u.kleine-koenig, aou, unicorn_wang, conor+dt, inochiama, krzk+dt,
	looong.bin, palmer, paul.walmsley, robh, tglx, sycamoremoon376,
	devicetree, linux-kernel, linux-riscv, sophgo

From: Chen Wang <unicorn_wang@outlook.com>

Fixed msi irq type to be the correct type, although this
field is not used.

Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
---
 arch/riscv/boot/dts/sophgo/sg2042.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/boot/dts/sophgo/sg2042.dtsi b/arch/riscv/boot/dts/sophgo/sg2042.dtsi
index b3e4d3c18fdc..6430c6e25c00 100644
--- a/arch/riscv/boot/dts/sophgo/sg2042.dtsi
+++ b/arch/riscv/boot/dts/sophgo/sg2042.dtsi
@@ -190,7 +190,7 @@ msi: msi-controller@7030010304 {
 			reg-names = "clr", "doorbell";
 			msi-controller;
 			#msi-cells = <0>;
-			msi-ranges = <&intc 64 IRQ_TYPE_LEVEL_HIGH 32>;
+			msi-ranges = <&intc 64 IRQ_TYPE_EDGE_RISING 32>;
 		};
 
 		rpgate: clock-controller@7030010368 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/3] riscv: sophgo: dts: sg2044: change msi irq type to IRQ_TYPE_EDGE_RISING
  2025-09-04  3:00 [PATCH v3 0/3] irqchip/sg2042-msi: Set irq type according to DT configuration Chen Wang
  2025-09-04  3:00 ` [PATCH v3 1/3] riscv: sophgo: dts: sg2042: change msi irq type to IRQ_TYPE_EDGE_RISING Chen Wang
@ 2025-09-04  3:00 ` Chen Wang
  2025-09-04  3:01 ` [PATCH v3 3/3] irqchip/sg2042-msi: Set irq type according to DT configuration Chen Wang
  2 siblings, 0 replies; 4+ messages in thread
From: Chen Wang @ 2025-09-04  3:00 UTC (permalink / raw)
  To: u.kleine-koenig, aou, unicorn_wang, conor+dt, inochiama, krzk+dt,
	looong.bin, palmer, paul.walmsley, robh, tglx, sycamoremoon376,
	devicetree, linux-kernel, linux-riscv, sophgo

From: Chen Wang <unicorn_wang@outlook.com>

Fixed msi irq type to be the correct type, although this
field is not used.

Tested-by: Inochi Amaoto <inochiama@gmail.com> # Sophgo SRD3-10
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
---
 arch/riscv/boot/dts/sophgo/sg2044.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/boot/dts/sophgo/sg2044.dtsi b/arch/riscv/boot/dts/sophgo/sg2044.dtsi
index 6ec955744b0c..320c4d1d08e6 100644
--- a/arch/riscv/boot/dts/sophgo/sg2044.dtsi
+++ b/arch/riscv/boot/dts/sophgo/sg2044.dtsi
@@ -214,7 +214,7 @@ msi: msi-controller@6d50000000 {
 			reg-names = "clr", "doorbell";
 			#msi-cells = <0>;
 			msi-controller;
-			msi-ranges = <&intc 352 IRQ_TYPE_LEVEL_HIGH 512>;
+			msi-ranges = <&intc 352 IRQ_TYPE_EDGE_RISING 512>;
 			status = "disabled";
 		};
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 3/3] irqchip/sg2042-msi: Set irq type according to DT configuration
  2025-09-04  3:00 [PATCH v3 0/3] irqchip/sg2042-msi: Set irq type according to DT configuration Chen Wang
  2025-09-04  3:00 ` [PATCH v3 1/3] riscv: sophgo: dts: sg2042: change msi irq type to IRQ_TYPE_EDGE_RISING Chen Wang
  2025-09-04  3:00 ` [PATCH v3 2/3] riscv: sophgo: dts: sg2044: " Chen Wang
@ 2025-09-04  3:01 ` Chen Wang
  2 siblings, 0 replies; 4+ messages in thread
From: Chen Wang @ 2025-09-04  3:01 UTC (permalink / raw)
  To: u.kleine-koenig, aou, unicorn_wang, conor+dt, inochiama, krzk+dt,
	looong.bin, palmer, paul.walmsley, robh, tglx, sycamoremoon376,
	devicetree, linux-kernel, linux-riscv, sophgo

From: Chen Wang <unicorn_wang@outlook.com>

Read the device tree configuration and use it to set the
interrupt type.

Tested-by: Inochi Amaoto <inochiama@gmail.com> # Sophgo SRD3-10
Signed-off-by: Chen Wang <unicorn_wang@outlook.com>
---
 drivers/irqchip/irq-sg2042-msi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sg2042-msi.c b/drivers/irqchip/irq-sg2042-msi.c
index 3b13dbbfdb51..f7cf0dc72eab 100644
--- a/drivers/irqchip/irq-sg2042-msi.c
+++ b/drivers/irqchip/irq-sg2042-msi.c
@@ -30,6 +30,7 @@ struct sg204x_msi_chip_info {
  * @doorbell_addr:	see TRM, 10.1.32, GP_INTR0_SET
  * @irq_first:		First vectors number that MSIs starts
  * @num_irqs:		Number of vectors for MSIs
+ * @irq_type:		IRQ type for MSIs
  * @msi_map:		mapping for allocated MSI vectors.
  * @msi_map_lock:	Lock for msi_map
  * @chip_info:		chip specific infomations
@@ -41,6 +42,7 @@ struct sg204x_msi_chipdata {
 
 	u32					irq_first;
 	u32					num_irqs;
+	unsigned int				irq_type;
 
 	unsigned long				*msi_map;
 	struct mutex				msi_map_lock;
@@ -137,14 +139,14 @@ static int sg204x_msi_parent_domain_alloc(struct irq_domain *domain, unsigned in
 	fwspec.fwnode = domain->parent->fwnode;
 	fwspec.param_count = 2;
 	fwspec.param[0] = data->irq_first + hwirq;
-	fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
+	fwspec.param[1] = data->irq_type;
 
 	ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
 	if (ret)
 		return ret;
 
 	d = irq_domain_get_irq_data(domain->parent, virq);
-	return d->chip->irq_set_type(d, IRQ_TYPE_EDGE_RISING);
+	return d->chip->irq_set_type(d, data->irq_type);
 }
 
 static int sg204x_msi_middle_domain_alloc(struct irq_domain *domain, unsigned int virq,
@@ -298,6 +300,7 @@ static int sg2042_msi_probe(struct platform_device *pdev)
 	}
 
 	data->irq_first = (u32)args.args[0];
+	data->irq_type = (unsigned int)args.args[1];
 	data->num_irqs = (u32)args.args[args.nargs - 1];
 
 	mutex_init(&data->msi_map_lock);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-04  3:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04  3:00 [PATCH v3 0/3] irqchip/sg2042-msi: Set irq type according to DT configuration Chen Wang
2025-09-04  3:00 ` [PATCH v3 1/3] riscv: sophgo: dts: sg2042: change msi irq type to IRQ_TYPE_EDGE_RISING Chen Wang
2025-09-04  3:00 ` [PATCH v3 2/3] riscv: sophgo: dts: sg2044: " Chen Wang
2025-09-04  3:01 ` [PATCH v3 3/3] irqchip/sg2042-msi: Set irq type according to DT configuration Chen Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).