Commit 208caadc authored by Paul Cercueil's avatar Paul Cercueil Committed by Marc Zyngier

irqchip: ingenic: Get virq number from IRQ domain

Get the virq number from the IRQ domain instead of calculating it from
the hardcoded irq base.
Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/1570015525-27018-4-git-send-email-zhouyanjie@zoho.com
parent 52ecc876
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
struct ingenic_intc_data { struct ingenic_intc_data {
void __iomem *base; void __iomem *base;
struct irq_domain *domain;
unsigned num_chips; unsigned num_chips;
}; };
...@@ -34,6 +35,7 @@ struct ingenic_intc_data { ...@@ -34,6 +35,7 @@ struct ingenic_intc_data {
static irqreturn_t intc_cascade(int irq, void *data) static irqreturn_t intc_cascade(int irq, void *data)
{ {
struct ingenic_intc_data *intc = irq_get_handler_data(irq); struct ingenic_intc_data *intc = irq_get_handler_data(irq);
struct irq_domain *domain = intc->domain;
uint32_t irq_reg; uint32_t irq_reg;
unsigned i; unsigned i;
...@@ -43,7 +45,8 @@ static irqreturn_t intc_cascade(int irq, void *data) ...@@ -43,7 +45,8 @@ static irqreturn_t intc_cascade(int irq, void *data)
if (!irq_reg) if (!irq_reg)
continue; continue;
generic_handle_irq(__fls(irq_reg) + (i * 32) + JZ4740_IRQ_BASE); irq = irq_find_mapping(domain, __fls(irq_reg) + (i * 32));
generic_handle_irq(irq);
} }
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -95,6 +98,8 @@ static int __init ingenic_intc_of_init(struct device_node *node, ...@@ -95,6 +98,8 @@ static int __init ingenic_intc_of_init(struct device_node *node,
goto out_unmap_base; goto out_unmap_base;
} }
intc->domain = domain;
for (i = 0; i < num_chips; i++) { for (i = 0; i < num_chips; i++) {
/* Mask all irqs */ /* Mask all irqs */
writel(0xffffffff, intc->base + (i * CHIP_SIZE) + writel(0xffffffff, intc->base + (i * CHIP_SIZE) +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment