linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* PPC beginner questions
@ 2006-08-21 13:51 Wade Maxfield
  2006-08-21 14:14 ` Grant Likely
  2006-08-22  8:53 ` David H. Lynch Jr.
  0 siblings, 2 replies; 6+ messages in thread
From: Wade Maxfield @ 2006-08-21 13:51 UTC (permalink / raw)
  To: ppc

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

  I'm new to the PPC and I have a few questions.  I have written a  driver
in the past for the X86 family, using i/o ports, but it was kernel 2.0 and
i/o ports are not mmu handled.
  I've been looking through the archive and I am slowly growing more
confused.

  We are using Xilinx with PPC built in.

   The PPC has a memory management unit.  All of the IP we've added is
mapped to physical addresses.

   1. Can I access the memory the peripherasl are mapped to directly within
the driver without going through functions?
       if NOT, then Do I use
          1. ioremap(),
          2. request_mem_region(),
          3. request_region()
          4. something else?

   2.  Are there any gotcha's with the ppc 405 that Xilinx uses that I
should know about?


thanks,
wade

[-- Attachment #2: Type: text/html, Size: 1101 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PPC beginner questions
  2006-08-21 13:51 PPC beginner questions Wade Maxfield
@ 2006-08-21 14:14 ` Grant Likely
       [not found]   ` <45a1b53e0608210759p270c2f8dy694e91f409d57729@mail.gmail.com>
  2006-08-22  8:53 ` David H. Lynch Jr.
  1 sibling, 1 reply; 6+ messages in thread
From: Grant Likely @ 2006-08-21 14:14 UTC (permalink / raw)
  To: Wade Maxfield; +Cc: ppc

On 8/21/06, Wade Maxfield <wmaxfield@gmail.com> wrote:
>
>   We are using Xilinx with PPC built in.
>
>    The PPC has a memory management unit.  All of the IP we've added is
> mapped to physical addresses.
>
>    1. Can I access the memory the peripherasl are mapped to directly within
> the driver without going through functions?

No, you need to map them into virtual memory, then you can use the in*
out* functions to read/write.  (You can also directly use the virtual
addresses as pointers, but in*/out* is more portable)

>        if NOT, then Do I use
>           1. ioremap(),
>           2. request_mem_region(),
>           3. request_region()
>           4. something else?

ioremap

>
>    2.  Are there any gotcha's with the ppc 405 that Xilinx uses that I
> should know about?

Yes, lots.  :)

Actually it's pretty straight forward.  Mainline Linux 2.6 contains
support for both the Virtex-II Pro and the Virtex 4, but not a lot of
device drivers.  The MontaVista 2.4 tree is supported by Xilinx with
drivers, but then you have to use linux 2.4.  :p

Also, it's a good idea to read the Xilinx errata.

have fun.
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PPC beginner questions
       [not found]   ` <45a1b53e0608210759p270c2f8dy694e91f409d57729@mail.gmail.com>
@ 2006-08-21 15:38     ` Grant Likely
  2006-08-21 16:07       ` Wade Maxfield
  0 siblings, 1 reply; 6+ messages in thread
From: Grant Likely @ 2006-08-21 15:38 UTC (permalink / raw)
  To: Wade Maxfield; +Cc: linuxppc-embedded list

On 8/21/06, Wade Maxfield <wmaxfield@gmail.com> wrote:
> Hi Grant,
>
>   Thanks!
>
>   in*
>   out*
>
>   I'm assuming inb() outb(), inw() outw()??  I've been googling and have
> come up short with info that makes sense. It is almost all x86 centric.

in_8, in_be16, in_be32, out_8, out_be16, out_be32 for big-endian
device registers
in_8, in_le16, in_le32, out_8, out_le16, out_le32 for little endian
device registers

>
>   We will not be porting these drivers, this is a captive box internal use
> only, limited run (200 units or so), 10 to 20 year lifespan once it hits the
> field.
>
>   So, the virtual address I get back can be used directly.  Can I cast to
> short * and long * and char *?

heh, yes you can; but if your writing new code why not use good
practice from the start?  :)

>
>    I apologize for the basic questions, but I expect this will be a final
> question for quite some time.

No worries; ask away!

Cheers,
g.


BTW, when on the mailing list, please use "reply to all" and put your
comments below what you're commenting on.  This keeps the thread on
the mailing list for others to see, and it makes it blatentely obvious
what you're commenting on.  (just general list-etiquette)

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PPC beginner questions
  2006-08-21 15:38     ` Grant Likely
@ 2006-08-21 16:07       ` Wade Maxfield
  2006-08-21 16:24         ` Grant Likely
  0 siblings, 1 reply; 6+ messages in thread
From: Wade Maxfield @ 2006-08-21 16:07 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-embedded list

[-- Attachment #1: Type: text/plain, Size: 2008 bytes --]

 OK.  I'm breaking my promise. :)  A couple more questions.

On 8/21/06, Grant Likely <grant.likely@secretlab.ca> wrote:
>
> On 8/21/06, Wade Maxfield <wmaxfield@gmail.com> wrote:
> > Hi Grant,
> >
> >   Thanks!
> >
> >   in*
> >   out*
> >
> >   I'm assuming inb() outb(), inw() outw()??  I've been googling and have
> > come up short with info that makes sense. It is almost all x86 centric.
>
> in_8, in_be16, in_be32, out_8, out_be16, out_be32 for big-endian
> device registers
> in_8, in_le16, in_le32, out_8, out_le16, out_le32 for little endian
> device registers


-->Interesting.  Do these functions do 'eieio'  (Email, Internet, Electronic
Information Officer functions (southpark cartoon), err, or  Enforce In-Order
Execution of Input/Output) for me, or do I have to do that?  I'm still
confused as to that Old MacDonald function.


>
> >   We will not be porting these drivers, this is a captive box internal
> use
> > only, limited run (200 units or so), 10 to 20 year lifespan once it hits
> the
> > field.
> >
> >   So, the virtual address I get back can be used directly.  Can I cast
> to
> > short * and long * and char *?
>
> heh, yes you can; but if your writing new code why not use good
> practice from the start?  :)


--> Ok, you win.  How about ioread8() or inb() also?  Are they not coded in
PPC correctly? Or is the in_8() more modern?


>
> >    I apologize for the basic questions, but I expect this will be a
> final
> > question for quite some time.
>
> No worries; ask away!



--> is ioremap() equivalent to ioremap_nocache() on the PPC 405?


THANKS AGAIN!!!!
wade :)

Cheers,
> g.
>
>
> BTW, when on the mailing list, please use "reply to all" and put your
> comments below what you're commenting on.  This keeps the thread on
> the mailing list for others to see, and it makes it blatentely obvious
> what you're commenting on.  (just general list-etiquette)
>
> --
> Grant Likely, B.Sc. P.Eng.
> Secret Lab Technologies Ltd.
> grant.likely@secretlab.ca
> (403) 399-0195
>

[-- Attachment #2: Type: text/html, Size: 3184 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PPC beginner questions
  2006-08-21 16:07       ` Wade Maxfield
@ 2006-08-21 16:24         ` Grant Likely
  0 siblings, 0 replies; 6+ messages in thread
From: Grant Likely @ 2006-08-21 16:24 UTC (permalink / raw)
  To: Wade Maxfield; +Cc: linuxppc-embedded list

On 8/21/06, Wade Maxfield <wmaxfield@gmail.com> wrote:
> On 8/21/06, Grant Likely <grant.likely@secretlab.ca > wrote:
> > On 8/21/06, Wade Maxfield <wmaxfield@gmail.com > wrote:

> > >   I'm assuming inb() outb(), inw() outw()??  I've been googling and have
> > > come up short with info that makes sense. It is almost all x86 centric.
> >
> > in_8, in_be16, in_be32, out_8, out_be16, out_be32 for big-endian
> > device registers
> > in_8, in_le16, in_le32, out_8, out_le16, out_le32 for little endian
> > device registers
>
>
> -->Interesting.  Do these functions do 'eieio'  (Email, Internet, Electronic
> Information Officer functions (southpark cartoon), err, or  Enforce In-Order
> Execution of Input/Output) for me, or do I have to do that?  I'm still
> confused as to that Old MacDonald function.

The in functions do isync
The out functions do eieio

> >
> > heh, yes you can; but if your writing new code why not use good
> > practice from the start?  :)
>
>
> --> Ok, you win.  How about ioread8() or inb() also?  Are they not coded in
> PPC correctly? Or is the in_8() more modern?

read include/asm/io.h.  All the IO routines are defined there.
read[bwl] and write[bwl] are just macros to in_* out_*, as are inb,
outb, etc.

Cheers,
g.

-- 
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PPC beginner questions
  2006-08-21 13:51 PPC beginner questions Wade Maxfield
  2006-08-21 14:14 ` Grant Likely
@ 2006-08-22  8:53 ` David H. Lynch Jr.
  1 sibling, 0 replies; 6+ messages in thread
From: David H. Lynch Jr. @ 2006-08-22  8:53 UTC (permalink / raw)
  To: Wade Maxfield; +Cc: ppc

[-- Attachment #1: Type: text/plain, Size: 2994 bytes --]

Wade Maxfield wrote:
>
>   I'm new to the PPC and I have a few questions.  I have written a 
> driver in the past for the X86 family, using i/o ports, but it was
> kernel 2.0 and i/o ports are not mmu handled.
>   I've been looking through the archive and I am slowly growing more
> confused.
    The PPC MMU is pretty simple compared to the x86.
    Basically the MMU unit is a peice of hardware that maps "virtual"
addresses to "physical" addresses.
    Its use is enabled/disabled by two bits in the PPC Machine Status
register - 1 for instructions, 1 for data.
    The MMU itself is basically a 64 entry lookup table. Virtual address
X corresponds to physical address Y.
    When a request is made for an address that is not in the 64 entry
MMU table things become more complex
     - an exception is generated and code inside Linux searches its
tables to find the correct entry to stuff into the MMU.
    NORMALLY there is no correspondence between physical addresses and
virtual ones. But it is possible (and might be useful for debugging) to
stuff an entry
    where physical=virtual. If you look inside head_4xx.S for
CONFIG_SERIAL_TEXT_DEBUG or something like that you should see how to do it.
    However manually stuffed entries in the MMU will eventually get
blown away. I spent a week trying to trace a problem caused by that down.


>
>   We are using Xilinx with PPC built in.
>
>    The PPC has a memory management unit.  All of the IP we've added is
> mapped to physical addresses.
>
>    1. Can I access the memory the peripherasl are mapped to directly
> within the driver without going through functions?
>        if NOT, then Do I use
>           1. ioremap(),
    Once you have done the ioremap(), you can use the address returned
exactly the way you would have used the physical address previously.


>           2. request_mem_region(),
>           3. request_region()
>           4. something else?
>
>    2.  Are there any gotcha's with the ppc 405 that Xilinx uses that I
> should know about?
    Are you doing board bringup ?
    If you are not bringing up a new board - then the big gotcha's
should already be covered.
    If you are doing board bringup - I would recommend following the
existing xilinx packages closely.
>
>
> thanks,
> wade
>
>  
> ------------------------------------------------------------------------
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded


-- 
Dave Lynch 					  	    DLA Systems
Software Development:  				         Embedded Linux
717.627.3770 	       dhlii@dlasys.net 	  http://www.dlasys.net
fax: 1.253.369.9244 			           Cell: 1.717.587.7774
Over 25 years' experience in platforms, languages, and technologies too numerous to list.

"Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction."
Albert Einstein


[-- Attachment #2: Type: text/html, Size: 4574 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-08-22  8:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-21 13:51 PPC beginner questions Wade Maxfield
2006-08-21 14:14 ` Grant Likely
     [not found]   ` <45a1b53e0608210759p270c2f8dy694e91f409d57729@mail.gmail.com>
2006-08-21 15:38     ` Grant Likely
2006-08-21 16:07       ` Wade Maxfield
2006-08-21 16:24         ` Grant Likely
2006-08-22  8:53 ` David H. Lynch Jr.

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).