Yosemite/440EP why are readl()/ioread32() setup to read little-endian?

David Hawkins dwh at ovro.caltech.edu
Sat Jan 28 10:29:14 EST 2006


Hey Stefan,

 >>readl() and ioread32() read the registers in little-endian format!
 >
 > Correct. That's how it is implemented on all platforms. Think for
 > example of an pci device driver. Using these IO functions, the
 > driver will become platform independent, running without
 > modifications on little- and big-endian machines.

I just stumbled across the section in Rubini 3rd Ed that mislead
me into believing that the readl()/writel() were machine endianness
dependent, i.e., LE on x86, BE on PPC.

p453 of his book has a PCI DMA example, where he uses the
cpu_to_le32() macros inside calls writel().

However, since these functions are internally implemented to
perform LE operations, this example appears to be incorrect.

Would you agree?

I just checked the Oreilly web site for errata's and this is not
listed. If you agree that the example is incorrect, then I'll
submit an errata.

Dave




More information about the Linuxppc-embedded mailing list