From: Roderick Colenbrander <thunderbird2k@gmail.com>
To: Eddie Dawydiuk <eddie@embeddedarm.com>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: PowerPC iotable_init equivalent?
Date: Fri, 17 Apr 2009 23:31:30 +0200 [thread overview]
Message-ID: <c8485d470904171431r274e9974p4aff7ccaa3a3b274@mail.gmail.com> (raw)
In-Reply-To: <49E8F2D7.3050603@embeddedarm.com>
On Fri, Apr 17, 2009 at 11:21 PM, Eddie Dawydiuk <eddie@embeddedarm.com> wr=
ote:
> Hello,
>
> In the past I've worked with ARM architectures where I could setup virtua=
l /
> physical address mappings so I don't have to ioremap then pass around
> pointers. Does PowerPC have an equivalent abstraction? If not whats the
> recommended approach?
>
> That is, is there a better approach to the following...
>
> volatile static unsigned char *my_reg =3D NULL;
>
> static inline void read_func() {
>
> =A0 =A0 =A0 =A0if (!my_reg)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0my_reg =3D (unsigned char *)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ioremap(REG_PHYS_BASE, REG=
_SIZE);
> //do something with the reg
> }
>
>
> static inline void write_func() {
>
> =A0 =A0 =A0 =A0if (!my_reg)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0my_reg =3D (unsigned char *)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ioremap(REG_PHYS_BASE, REG=
_SIZE);
> //do something with the reg
> }
>
> --
> Best Regards,
> ________________________________________________________________
> =A0Eddie Dawydiuk, Technologic Systems | voice: =A0(480) 837-5200
> =A016525 East Laser Drive =A0 =A0 =A0 =A0 =A0 =A0 =A0| fax: =A0 =A0(480) =
837-5300
> =A0Fountain Hills, AZ 85268 =A0 =A0 =A0 =A0 =A0 =A0| web: www.embeddedARM=
.com
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>
In general you set devices up a dts file. You can reach its contents
using openfirmware functions (of_*). In general you use an of_*
function to look up your periperhal in the device tree. Once you have
its node you would able to do e.g. of_iomap (which uses ioremap with
the right offsets behind its back) to map the device. So you don't
hard code physical addresses anymore in the code.
Regards,
Roderick Colenbrander
next prev parent reply other threads:[~2009-04-17 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-17 21:21 PowerPC iotable_init equivalent? Eddie Dawydiuk
2009-04-17 21:31 ` Roderick Colenbrander [this message]
2009-04-17 21:32 ` Kumar Gala
2009-04-18 5:42 ` Grant Likely
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=c8485d470904171431r274e9974p4aff7ccaa3a3b274@mail.gmail.com \
--to=thunderbird2k@gmail.com \
--cc=eddie@embeddedarm.com \
--cc=linuxppc-dev@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).