From: Sylvain Munaut <tnt@246tNt.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: linuxppc-embedded@ozlabs.org, sl@bplan-gmbh.de, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH/RFC] powerpc: Add MPC5200 Interrupt Controller support.
Date: Mon, 06 Nov 2006 09:39:59 +0100 [thread overview]
Message-ID: <454EF4DF.7000808@246tNt.com> (raw)
In-Reply-To: <528646bc0611052228j20a4c197x94da47467dce8d67@mail.gmail.com>
Grant Likely wrote:
> On 11/4/06, Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>> On Sun, 2006-11-05 at 01:27 +0100, Sylvain Munaut wrote:
>> > with a helper that would do
>> > - The find_node
>> > - get_address / translate / get_size
>> > - ioremap
>> >
>> > Something like :
>> >
>> > intr = mpc52xx_find_and_map("mpc52xx-intr");
>> > sdma = mpc52xx_find_and_map("mpc52xx-sdma");
>>
>> Hrm... I don't care that much but I also don't think we need that
>> helper. It's not saving much.
>
> While on this topic... if a helper is added, what about it is 52xx
> specific? Wouldn't the same code apply to all platforms?
>
> g.
>
The code would look like what I included at the end (untested). Not that
I used
of_find_by_name and not find_compatible. We can fix a naming convention
for those units ...
I think it does save quite a few lines and variable. It also simplifies the
error path ... granted it's not an exceptionnal reduction but still
worth it.
If it's not included now it's not that bad, I'll probably submitt a
patch later
when it's used in more places than mpc52xx_pic.c ...
About the use on other platform, maybe but do other platform need that a
lot ?
Here we have several unit that need to be mapped at different places ...
Sylvain
---
void __iomem *mpc52xx_find_and_map(const char *name)
{
struct device_node *ofn;
const u32 *regaddr_p;
u64 regaddr64, size64;
ofn = of_find_by_name(NULL, name);
if (!ofn)
return NULL;
regaddr_p = of_get_address(ofn, 0, &size64, NULL);
if (!regaddr_p) {
of_node_put(ofn);
return NULL;
}
regaddr64 = of_translate_address(ofn, regaddr_p);
of_node_put(ofn);
return ioremap((u32)regaddr64, (u32)size64);
}
next prev parent reply other threads:[~2006-11-06 8:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-01 20:27 [PATCH/RFC] powerpc: Add MPC5200 Interrupt Controller support Nicolas DET
2006-11-01 22:05 ` Dale Farnsworth
2006-11-01 22:07 ` Sven Luther
2006-11-01 22:21 ` Dale Farnsworth
2006-11-01 22:12 ` Benjamin Herrenschmidt
2006-11-02 16:27 ` Nicolas DET
2006-11-02 20:47 ` Nicolas DET
2006-11-04 23:35 ` Benjamin Herrenschmidt
2006-11-05 0:27 ` Sylvain Munaut
2006-11-05 1:13 ` Benjamin Herrenschmidt
2006-11-06 6:28 ` Grant Likely
2006-11-06 8:39 ` Sylvain Munaut [this message]
2006-11-05 10:17 ` Nicolas DET
2006-11-05 10:37 ` Benjamin Herrenschmidt
2006-11-05 11:30 ` Nicolas DET
2006-11-05 13:02 ` Benjamin Herrenschmidt
2006-11-05 13:16 ` Nicolas DET
2006-11-05 14:32 ` Sylvain Munaut
2006-11-06 6:55 ` Grant Likely
-- strict thread matches above, loose matches on Subject: below --
2006-11-06 10:26 Nicolas DET
2006-11-06 11:03 Nicolas DET
2006-11-06 23:35 ` Sylvain Munaut
2006-11-07 9:22 ` Nicolas DET
2006-11-07 10:40 Nicolas DET
2006-11-07 10:45 ` Sylvain Munaut
2006-11-07 16:30 ` Grant Likely
2006-11-07 20:52 ` Sylvain Munaut
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=454EF4DF.7000808@246tNt.com \
--to=tnt@246tnt.com \
--cc=grant.likely@secretlab.ca \
--cc=linuxppc-dev@ozlabs.org \
--cc=linuxppc-embedded@ozlabs.org \
--cc=sl@bplan-gmbh.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).