how the bytes ordered in mpc8313

3 messages, 2 authors, 2007-08-08 · open the first message on its own page

how the bytes ordered in mpc8313

From: Yoni Levin <hidden>
Date: 2007-08-08 15:27:21

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? 

Re: how the bytes ordered in mpc8313

From: Scott Wood <hidden>
Date: 2007-08-08 16:49:35

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

Re: how the bytes ordered in mpc8313

From: Scott Wood <hidden>
Date: 2007-08-08 16:55:28

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help