Skip to content

Commit c2616c5

Browse files
unicornxKAGA-KOKO
authored andcommitted
irqchip/sg2042-msi: Set irq type according to DT configuration
Read the device tree configuration and use it to set the interrupt type. Signed-off-by: Chen Wang <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Inochi Amaoto <[email protected]> # Sophgo SRD3-10 Link: https://lore.kernel.org/all/b22d2b0a00a96161253435d17b3c66538f3ba1c2.1756953919.git.unicorn_wang@outlook.com
1 parent 8aefd27 commit c2616c5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/irqchip/irq-sg2042-msi.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ struct sg204x_msi_chip_info {
3030
* @doorbell_addr: see TRM, 10.1.32, GP_INTR0_SET
3131
* @irq_first: First vectors number that MSIs starts
3232
* @num_irqs: Number of vectors for MSIs
33+
* @irq_type: IRQ type for MSIs
3334
* @msi_map: mapping for allocated MSI vectors.
3435
* @msi_map_lock: Lock for msi_map
3536
* @chip_info: chip specific infomations
@@ -41,6 +42,7 @@ struct sg204x_msi_chipdata {
4142

4243
u32 irq_first;
4344
u32 num_irqs;
45+
unsigned int irq_type;
4446

4547
unsigned long *msi_map;
4648
struct mutex msi_map_lock;
@@ -137,14 +139,14 @@ static int sg204x_msi_parent_domain_alloc(struct irq_domain *domain, unsigned in
137139
fwspec.fwnode = domain->parent->fwnode;
138140
fwspec.param_count = 2;
139141
fwspec.param[0] = data->irq_first + hwirq;
140-
fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
142+
fwspec.param[1] = data->irq_type;
141143

142144
ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
143145
if (ret)
144146
return ret;
145147

146148
d = irq_domain_get_irq_data(domain->parent, virq);
147-
return d->chip->irq_set_type(d, IRQ_TYPE_EDGE_RISING);
149+
return d->chip->irq_set_type(d, data->irq_type);
148150
}
149151

150152
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)
298300
}
299301

300302
data->irq_first = (u32)args.args[0];
303+
data->irq_type = (unsigned int)args.args[1];
301304
data->num_irqs = (u32)args.args[args.nargs - 1];
302305

303306
mutex_init(&data->msi_map_lock);

0 commit comments

Comments
 (0)