Re: Endianness versus too many byte swaps??
From: Kumar Gala <hidden>
Date: 2007-03-05 15:10:28
On Mar 5, 2007, at 9:02 AM, Charles Krinke wrote:
You do understand that readl is in fact a call to in_le32() on ppc (cf. include/asm-ppc/io.h). The question now is, what endianness you would like in that register? Regards -- Stephane Dear Stephane: Your point is well made. I can see that readl is in fact a call to in_le32. Maybe there is a more basic problem here. If I change the call to readl to a call to in_be32, things make sense again. So, maybe I don't quite understand the endianness setup of this Linux project.
readl/writel are for PCI bus accesses. PCI is inherently little endian.
I am told that we are running this ppc in big endian, so would this mean that readl & writel should actually be resolving to in_be32/out_be32 respectively? Is there some other setup that may be wrong?
Nope, readl/writel are doing the write thing, they will ALWAYS be little endian. You truly want in_be*/out_be* when accessing 85xx CCSR registers since all of them are big endian. - k