Skip to content

Commit d6a9528

Browse files
lkundrakMarc Zyngier
authored andcommitted
irqchip/mmp: Do not use of_address_to_resource() to get mux regs
The "regs" property of the "mrvl,mmp2-mux-intc" devices are silly. They are offsets from intc's base, not addresses on the parent bus. At this point it probably can't be fixed. On an OLPC XO-1.75 machine, the muxes are children of the intc, not the axi bus, and thus of_address_to_resource() won't work. We should treat the values as mere integers as opposed to bus addresses. Signed-off-by: Lubomir Rintel <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Acked-by: Pavel Machek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent b2fb4b7 commit d6a9528

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

drivers/irqchip/irq-mmp.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,9 @@ IRQCHIP_DECLARE(mmp2_intc, "mrvl,mmp2-intc", mmp2_of_init);
422422
static int __init mmp2_mux_of_init(struct device_node *node,
423423
struct device_node *parent)
424424
{
425-
struct resource res;
426425
int i, ret, irq, j = 0;
427426
u32 nr_irqs, mfp_irq;
427+
u32 reg[4];
428428

429429
if (!parent)
430430
return -ENODEV;
@@ -436,18 +436,22 @@ static int __init mmp2_mux_of_init(struct device_node *node,
436436
pr_err("Not found mrvl,intc-nr-irqs property\n");
437437
return -EINVAL;
438438
}
439-
ret = of_address_to_resource(node, 0, &res);
440-
if (ret < 0) {
441-
pr_err("Not found reg property\n");
442-
return -EINVAL;
443-
}
444-
icu_data[i].reg_status = mmp_icu_base + res.start;
445-
ret = of_address_to_resource(node, 1, &res);
439+
440+
/*
441+
* For historical reasons, the "regs" property of the
442+
* mrvl,mmp2-mux-intc is not a regular "regs" property containing
443+
* addresses on the parent bus, but offsets from the intc's base.
444+
* That is why we can't use of_address_to_resource() here.
445+
*/
446+
ret = of_property_read_variable_u32_array(node, "reg", reg,
447+
ARRAY_SIZE(reg),
448+
ARRAY_SIZE(reg));
446449
if (ret < 0) {
447450
pr_err("Not found reg property\n");
448451
return -EINVAL;
449452
}
450-
icu_data[i].reg_mask = mmp_icu_base + res.start;
453+
icu_data[i].reg_status = mmp_icu_base + reg[0];
454+
icu_data[i].reg_mask = mmp_icu_base + reg[2];
451455
icu_data[i].cascade_irq = irq_of_parse_and_map(node, 0);
452456
if (!icu_data[i].cascade_irq)
453457
return -EINVAL;

0 commit comments

Comments
 (0)