From: Lubomir Rintel <lkundrak@v3.sk>
To: Marc Zyngier <maz@kernel.org>, Olof Johansson <olof@lixom.net>
Cc: Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org, Jason Cooper <jason@lakedaemon.net>,
Stephen Boyd <sboyd@kernel.org>,
linux-kernel@vger.kernel.org,
Michael Turquette <mturquette@baylibre.com>,
Russell King <linux@armlinux.org.uk>,
Kishon Vijay Abraham I <kishon@ti.com>,
Rob Herring <robh+dt@kernel.org>, Pavel Machek <pavel@ucw.cz>,
Thomas Gleixner <tglx@linutronix.de>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 05/19] irqchip/mmp: do not use of_address_to_resource() to get mux regs
Date: Fri, 16 Aug 2019 20:41:22 +0200 [thread overview]
Message-ID: <e0c0cf62a1f087fd6c1d7307e5e2a65603148341.camel@v3.sk> (raw)
In-Reply-To: <16d77ca3-7ad1-3af2-650e-722cf6a931ed@kernel.org>
On Fri, 2019-08-09 at 13:12 +0100, Marc Zyngier wrote:
> On 09/08/2019 10:31, Lubomir Rintel wrote:
> > 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 <lkundrak@v3.sk>
> > Acked-by: Pavel Machek <pavel@ucw.cz>
> >
> > ---
> > drivers/irqchip/irq-mmp.c | 20 +++++++++++---------
> > 1 file changed, 11 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c
> > index 14618dc0bd396..af9cba4a51c2e 100644
> > --- a/drivers/irqchip/irq-mmp.c
> > +++ b/drivers/irqchip/irq-mmp.c
> > @@ -424,9 +424,9 @@ IRQCHIP_DECLARE(mmp2_intc, "mrvl,mmp2-intc", mmp2_of_init);
> > static int __init mmp2_mux_of_init(struct device_node *node,
> > struct device_node *parent)
> > {
> > - struct resource res;
> > int i, ret, irq, j = 0;
> > u32 nr_irqs, mfp_irq;
> > + u32 reg[4];
> >
> > if (!parent)
> > return -ENODEV;
> > @@ -438,18 +438,20 @@ static int __init mmp2_mux_of_init(struct device_node *node,
> > pr_err("Not found mrvl,intc-nr-irqs property\n");
> > return -EINVAL;
> > }
> > - ret = of_address_to_resource(node, 0, &res);
> > +
> > + /*
> > + * For historical reasonsm, the "regs" property of the
> > + * mrvl,mmp2-mux-intc is not a regular * "regs" property containing
> > + * addresses on the parent bus, but offsets from the intc's base.
> > + * That is why we can't use of_address_to_resource() here.
> > + */
> > + ret = of_property_read_u32_array(node, "reg", reg, ARRAY_SIZE(reg));
>
> This will return 0 even if you've read less than your expected 4 u32s.
> You may want to try of_property_read_variable_u32_array instead.
Will it? Unless I'm reading the of_property_read_u32_array()
documentation wrong, it suggests that would return -EOVERFLOW in that
case.
It ignores the extra values it the property is larger. I guess that is
not a good thing and we still want to use
of_property_read_variable_u32_array() though.
> > if (ret < 0) {
> > pr_err("Not found reg property\n");
> > return -EINVAL;
> > }
> > - icu_data[i].reg_status = mmp_icu_base + res.start;
> > - ret = of_address_to_resource(node, 1, &res);
> > - if (ret < 0) {
> > - pr_err("Not found reg property\n");
> > - return -EINVAL;
> > - }
> > - icu_data[i].reg_mask = mmp_icu_base + res.start;
> > + icu_data[i].reg_status = mmp_icu_base + reg[0];
> > + icu_data[i].reg_mask = mmp_icu_base + reg[2];
> > icu_data[i].cascade_irq = irq_of_parse_and_map(node, 0);
> > if (!icu_data[i].cascade_irq)
> > return -EINVAL;
> >
>
> Thanks,
>
> M.
Thanks
Lubo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-08-16 18:41 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-09 9:31 [PATCH 00/19] Initial support for Marvell MMP3 SoC Lubomir Rintel
2019-08-09 9:31 ` [PATCH 01/19] dt-bindings: arm: cpu: Add Marvell MMP3 SMP enable method Lubomir Rintel
2019-08-12 18:57 ` Rob Herring
2019-08-09 9:31 ` [PATCH 02/19] dt-bindings: arm: mrvl: Document MMP3 compatible string Lubomir Rintel
2019-08-21 21:03 ` Rob Herring
2019-08-22 8:12 ` Lubomir Rintel
2019-08-22 12:42 ` Rob Herring
2019-08-09 9:31 ` [PATCH 03/19] dt-bindings: mrvl, intc: Add a MMP3 interrupt controller Lubomir Rintel
2019-08-21 21:11 ` [PATCH 03/19] dt-bindings: mrvl,intc: " Rob Herring
2019-08-09 9:31 ` [PATCH 04/19] dt-bindings: phy-mmp3-usb: Add bindings Lubomir Rintel
2019-08-21 21:13 ` Rob Herring
2019-08-09 9:31 ` [PATCH 05/19] irqchip/mmp: do not use of_address_to_resource() to get mux regs Lubomir Rintel
2019-08-09 12:12 ` Marc Zyngier
2019-08-16 18:41 ` Lubomir Rintel [this message]
2019-08-17 18:17 ` Marc Zyngier
2019-08-09 9:31 ` [PATCH 06/19] irqchip/mmp: add missing chained_irq_{enter,exit}() Lubomir Rintel
2019-08-09 10:56 ` [PATCH 06/19] irqchip/mmp: add missing chained_irq_{enter, exit}() Marc Zyngier
2019-08-09 9:31 ` [PATCH 07/19] irqchip/mmp: mask off interrupts from other cores Lubomir Rintel
2019-08-09 12:18 ` Marc Zyngier
2019-08-16 18:15 ` Lubomir Rintel
2019-08-09 9:31 ` [PATCH 08/19] irqchip/mmp: coexist with GIC root IRQ controller Lubomir Rintel
2019-08-09 9:31 ` [PATCH 09/19] ARM: l2c: add definition for FWA in PL310 aux register Lubomir Rintel
2019-08-09 9:31 ` [PATCH 10/19] ARM: mmp: don't select CACHE_TAUROS2 on all ARCH_MMP Lubomir Rintel
2019-08-09 9:31 ` [PATCH 11/19] ARM: mmp: map the PGU as well Lubomir Rintel
2019-08-09 9:31 ` [PATCH 12/19] ARM: mmp: DT: convert timer driver to use TIMER_OF_DECLARE Lubomir Rintel
2019-08-09 9:31 ` [PATCH 13/19] ARM: mmp: define MMP_CHIPID by the means of CIU_REG() Lubomir Rintel
2019-08-09 9:31 ` [PATCH 14/19] ARM: mmp: add support for MMP3 SoC Lubomir Rintel
2019-08-16 18:06 ` Stephen Boyd
2019-08-09 9:31 ` [PATCH 15/19] ARM: mmp: add SMP support Lubomir Rintel
2019-08-16 18:11 ` Florian Fainelli
2019-08-09 9:31 ` [PATCH 16/19] ARM: mmp: move cputype.h to include/linux/soc/ Lubomir Rintel
2019-08-09 9:31 ` [PATCH 17/19] ARM: mmp: remove MMP3 USB PHY registers from regs-usb.h Lubomir Rintel
2019-08-09 9:31 ` [PATCH 18/19] phy: phy-mmp3-usb: add a new driver Lubomir Rintel
2019-08-09 9:31 ` [PATCH 19/19] ARM: dts: mmp3: Add MMP3 SoC dts file Lubomir Rintel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e0c0cf62a1f087fd6c1d7307e5e2a65603148341.camel@v3.sk \
--to=lkundrak@v3.sk \
--cc=devicetree@vger.kernel.org \
--cc=jason@lakedaemon.net \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=mturquette@baylibre.com \
--cc=olof@lixom.net \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).