linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* how the bytes ordered in mpc8313
@ 2007-08-08 15:26 Yoni Levin
  2007-08-08 16:49 ` Scott Wood
  2007-08-08 16:55 ` Scott Wood
  0 siblings, 2 replies; 3+ messages in thread
From: Yoni Levin @ 2007-08-08 15:26 UTC (permalink / raw)
  To: linuxppc-embedded

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

I have mpc83xx,

I saw that I need to use swab32 to any read\write operation from registers,

I don't understand why I need it?

Do I need it for all registers?

Why in the mpc8313 reference in registers description some bits look like
31,30,29,.,3,2,1,0

And some: 0,1,2,3.,30,31

Is it just mistake? Or some registers are different then other? 


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

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

* Re: how the bytes ordered in mpc8313
  2007-08-08 15:26 how the bytes ordered in mpc8313 Yoni Levin
@ 2007-08-08 16:49 ` Scott Wood
  2007-08-08 16:55 ` Scott Wood
  1 sibling, 0 replies; 3+ messages in thread
From: Scott Wood @ 2007-08-08 16:49 UTC (permalink / raw)
  To: Yoni Levin; +Cc: linuxppc-embedded

Yoni Levin wrote:
> I have mpc83xx,
> 
> I saw that I need to use swab32 to any read\write operation from registers,

Only little endian registers (such as PCI).

> Why in the mpc8313 reference in registers description some bits look like
> 31,30,29,.,3,2,1,0
> 
> And some: 0,1,2,3.,30,31

Most PowerPC documentation numbers bits in the same endianness as the 
bytes in the register.

> Is it just mistake? Or some registers are different then other? 

I consider big-endian bit numbering to be a mistake, but good luck 
getting them to fix it. :-)

-Scott

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

* Re: how the bytes ordered in mpc8313
  2007-08-08 15:26 how the bytes ordered in mpc8313 Yoni Levin
  2007-08-08 16:49 ` Scott Wood
@ 2007-08-08 16:55 ` Scott Wood
  1 sibling, 0 replies; 3+ messages in thread
From: Scott Wood @ 2007-08-08 16:55 UTC (permalink / raw)
  To: Yoni Levin; +Cc: linuxppc-embedded

Yoni Levin wrote:
> I have mpc83xx,
> 
> I saw that I need to use swab32 to any read\write operation from registers,

BTW, you should be using in/out_le32() (or for PCI MMIO, readl/writel) 
rather than swab32().  This will be more efficient since it can use the 
lwbrx/stwbrx instructions, and it will keep working even if the code is 
run little-endian.

-Scott

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

end of thread, other threads:[~2007-08-08 16:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08 15:26 how the bytes ordered in mpc8313 Yoni Levin
2007-08-08 16:49 ` Scott Wood
2007-08-08 16:55 ` Scott Wood

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