mirror of https://github.com/torvalds/linux.git
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 <unicorn_wang@outlook.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Inochi Amaoto <inochiama@gmail.com> # Sophgo SRD3-10 Link: https://lore.kernel.org/all/b22d2b0a00a96161253435d17b3c66538f3ba1c2.1756953919.git.unicorn_wang@outlook.com
This commit is contained in:
parent
8aefd27244
commit
c2616c5696
|
|
@ -30,6 +30,7 @@ struct sg204x_msi_chip_info {
|
||||||
* @doorbell_addr: see TRM, 10.1.32, GP_INTR0_SET
|
* @doorbell_addr: see TRM, 10.1.32, GP_INTR0_SET
|
||||||
* @irq_first: First vectors number that MSIs starts
|
* @irq_first: First vectors number that MSIs starts
|
||||||
* @num_irqs: Number of vectors for MSIs
|
* @num_irqs: Number of vectors for MSIs
|
||||||
|
* @irq_type: IRQ type for MSIs
|
||||||
* @msi_map: mapping for allocated MSI vectors.
|
* @msi_map: mapping for allocated MSI vectors.
|
||||||
* @msi_map_lock: Lock for msi_map
|
* @msi_map_lock: Lock for msi_map
|
||||||
* @chip_info: chip specific infomations
|
* @chip_info: chip specific infomations
|
||||||
|
|
@ -41,6 +42,7 @@ struct sg204x_msi_chipdata {
|
||||||
|
|
||||||
u32 irq_first;
|
u32 irq_first;
|
||||||
u32 num_irqs;
|
u32 num_irqs;
|
||||||
|
unsigned int irq_type;
|
||||||
|
|
||||||
unsigned long *msi_map;
|
unsigned long *msi_map;
|
||||||
struct mutex msi_map_lock;
|
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.fwnode = domain->parent->fwnode;
|
||||||
fwspec.param_count = 2;
|
fwspec.param_count = 2;
|
||||||
fwspec.param[0] = data->irq_first + hwirq;
|
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);
|
ret = irq_domain_alloc_irqs_parent(domain, virq, 1, &fwspec);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
d = irq_domain_get_irq_data(domain->parent, virq);
|
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,
|
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_first = (u32)args.args[0];
|
||||||
|
data->irq_type = (unsigned int)args.args[1];
|
||||||
data->num_irqs = (u32)args.args[args.nargs - 1];
|
data->num_irqs = (u32)args.args[args.nargs - 1];
|
||||||
|
|
||||||
mutex_init(&data->msi_map_lock);
|
mutex_init(&data->msi_map_lock);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue