static int __init vt8500_irq_init(struct device_node *node, struct device_node *parent) { int irq, i; struct device_node *np = node; if (active_cnt == VT8500_INTC_MAX) { pr_err("%s: Interrupt controllers > VT8500_INTC_MAX\n", __func__); goto out; } intc[active_cnt].base = of_iomap(np, 0); intc[active_cnt].domain = irq_domain_add_linear(node, 64, &vt8500_irq_domain_ops, &intc[active_cnt]); if (!intc[active_cnt].base) { pr_err("%s: Unable to map IO memory\n", __func__); goto out; } if (!intc[active_cnt].domain) { pr_err("%s: Unable to add irq domain!\n", __func__); goto out; } set_handle_irq(vt8500_handle_irq); vt8500_init_irq_hw(intc[active_cnt].base); pr_info("vt8500-irq: Added interrupt controller\n"); active_cnt++; /* check if this is a slaved controller */ if (of_irq_count(np) != 0) { /* check that we have the correct number of interrupts */ if (of_irq_count(np) != 8) { pr_err("%s: Incorrect IRQ map for slaved controller\n", __func__); return -EINVAL; } for (i = 0; i < 8; i++) { irq = irq_of_parse_and_map(np, i); enable_irq(irq); } pr_info("vt8500-irq: Enabled slave->parent interrupts\n"); } out: return 0; }
int __init vt8500_irq_init(struct device_node *node, struct device_node *parent) { struct irq_domain *vt8500_irq_domain; struct vt8500_irq_priv *priv; int irq, i; struct device_node *np = node; priv = kzalloc(sizeof(struct vt8500_irq_priv), GFP_KERNEL); priv->base = of_iomap(np, 0); vt8500_irq_domain = irq_domain_add_legacy(node, 64, irq_cnt, 0, &vt8500_irq_domain_ops, priv); if (!vt8500_irq_domain) pr_err("%s: Unable to add wmt irq domain!\n", __func__); irq_set_default_host(vt8500_irq_domain); vt8500_init_irq_hw(priv->base); pr_info("Added IRQ Controller @ %x [virq_base = %d]\n", (u32)(priv->base), irq_cnt); /* check if this is a slaved controller */ if (of_irq_count(np) != 0) { /* check that we have the correct number of interrupts */ if (of_irq_count(np) != 8) { pr_err("%s: Incorrect IRQ map for slave controller\n", __func__); return -EINVAL; } for (i = 0; i < 8; i++) { irq = irq_of_parse_and_map(np, i); enable_irq(irq); } pr_info("vt8500-irq: Enabled slave->parent interrupts\n"); } irq_cnt += 64; return 0; }