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

Stefan Roese sr at denx.de
Wed Jan 25 20:57:47 EST 2006


Hi David,

On Tuesday 24 January 2006 19:08, David Hawkins wrote:
> 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.

> If the processor was reading from the PCI bus, then sure, I
> could understand why this might be used, but even then, that
> should be up to the user, eg. by using cpu_to_le32 etc.

No. Please see above.

> Should I just be using pointers for remapped processor
> registers, and only use readl(), ioread32(), etc, on external
> memory?

That's how I do it. Only use readl() and friends for pci spaces (or other 
little endian memory mapped areas).

Best regards,
Stefan



More information about the Linuxppc-embedded mailing list