parent_irq = irq_of_parse_and_map(dn, irq); if (!parent_irq) {
pr_err("failed to map interrupt %d\n", irq); return -EINVAL;
}
/* For multiple parent IRQs with multiple words, this looks like: * <irq0_w0 irq0_w1 irq1_w0 irq1_w1 ...> * * We need to associate a given parent interrupt with its corresponding * map_mask in order to mask the status register with it because we * have the same handler being called for multiple parent interrupts. * * This is typically something needed on BCM7xxx (STB chips).
*/ for (idx = 0; idx < data->n_words; idx++) { if (data->map_mask_prop) {
l1_data->irq_map_mask[idx] |=
be32_to_cpup(data->map_mask_prop +
irq * data->n_words + idx);
} else {
l1_data->irq_map_mask[idx] = 0xffffffff;
}
valid_mask[idx] |= l1_data->irq_map_mask[idx];
}
l1_data->b = data;
irq_set_chained_handler_and_data(parent_irq,
bcm7120_l2_intc_irq_handle, l1_data); if (data->can_wake)
enable_irq_wake(parent_irq);
ret = of_property_read_u32_array(dn, "brcm,int-fwd-mask",
data->irq_fwd_mask, data->n_words); if (ret != 0 && ret != -EINVAL) { /* property exists but has the wrong number of words */
pr_err("invalid brcm,int-fwd-mask property\n"); return -EINVAL;
}
data = kzalloc(sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM;
pdev = of_find_device_by_node(dn); if (!pdev) {
ret = -ENODEV; goto out_free_data;
}
data->num_parent_irqs = platform_irq_count(pdev);
put_device(&pdev->dev); if (data->num_parent_irqs <= 0) {
pr_err("invalid number of parent interrupts\n");
ret = -ENOMEM; goto out_unmap;
}
data->l1_data = kcalloc(data->num_parent_irqs, sizeof(*data->l1_data),
GFP_KERNEL); if (!data->l1_data) {
ret = -ENOMEM; goto out_free_l1_data;
}
ret = iomap_regs_fn(dn, data); if (ret < 0) goto out_free_l1_data;
for (irq = 0; irq < data->num_parent_irqs; irq++) {
ret = bcm7120_l2_intc_init_one(dn, data, irq, valid_mask); if (ret) goto out_free_l1_data;
}
data->domain = irq_domain_create_linear(of_fwnode_handle(dn), IRQS_PER_WORD * data->n_words,
&irq_generic_chip_ops, NULL); if (!data->domain) {
ret = -ENOMEM; goto out_free_l1_data;
}
/* MIPS chips strapped for BE will automagically configure the * peripheral registers for CPU-native byte order.
*/
flags = IRQ_GC_INIT_MASK_CACHE; if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
flags |= IRQ_GC_BE_IO;
ret = irq_alloc_domain_generic_chips(data->domain, IRQS_PER_WORD, 1,
dn->full_name, handle_level_irq, clr,
IRQ_LEVEL, flags); if (ret) {
pr_err("failed to allocate generic irq chip\n"); goto out_free_domain;
}
/* * Initialize mask-cache, in case we need it for * saving/restoring fwd mask even w/o any child interrupts * installed
*/
gc->mask_cache = irq_reg_readl(gc, ct->regs.mask);
if (data->can_wake) { /* This IRQ chip can wake the system, set all * relevant child interrupts in wake_enabled mask
*/
gc->wake_enabled = 0xffffffff;
gc->wake_enabled &= ~gc->unused;
ct->chip.irq_set_wake = irq_gc_set_wake;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.