From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: "Moffett, Kyle D" <Kyle.D.Moffett@boeing.com>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: mpic_alloc: Differences between of_address_to_resource() and of_get_property()+of_translate_address()
Date: Fri, 25 Feb 2011 07:43:47 +1100 [thread overview]
Message-ID: <1298580227.8833.419.camel@pasglop> (raw)
In-Reply-To: <031BE41A-C26B-419E-A515-F88C0BF4CA5D@boeing.com>
On Thu, 2011-02-24 at 11:43 -0600, Moffett, Kyle D wrote:
> Hello everyone,
>
> I'm currently cleaning up a new P2020 (mpc85xx) board port for submission and I was noticing a lot of commonalities between the various ports.
>
> In particular, at least 80% of the mpic_alloc() callers seem to do something like this (with more error-checking):
>
> struct resource r;
> of_address_to_resource(np, 0, &r);
> mpic_alloc(np, r.start, [...]);
>
> But mpic_alloc() itself seems to have some logic for digging the base address out of OpenFirmware already:
>
> if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) {
> const u32 *reg = of_get_property(node, "reg", NULL);
> BUG_ON(reg == NULL);
> paddr = of_translate_address(node, reg);
> BUG_ON(paddr == OF_BAD_ADDR);
> }
>
> As far as I can tell, the code in mpic_alloc() is a very limited form of of_address_to_resource() without a
> lot of the special cases, but I can't tell what the effect of those special cases would be on the boards
> relying on mpic_alloc(np, 0, [...]);
Probably none, ie, it's probably historical and could probably be
converted.
> I'd like to just convert mpic_alloc() to do the of_address_to_resource() internally (instead of the existing logic),
> but I'd be afraid of breaking other systems.
>
> Any comments/advice?
I think it can be tried :-) The risk should be reasonably low.
Cheers,
Ben.
> Cheers,
> Kyle Moffett
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
prev parent reply other threads:[~2011-02-24 20:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-24 17:43 mpic_alloc: Differences between of_address_to_resource() and of_get_property()+of_translate_address() Moffett, Kyle D
2011-02-24 20:43 ` Benjamin Herrenschmidt [this message]
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=1298580227.8833.419.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=Kyle.D.Moffett@boeing.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/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).