[U-Boot-Users] Configuring U-Boot for MPC8349E in little endian mode

Timur Tabi timur at freescale.com
Fri May 2 21:47:48 CEST 2008


David Hawkins wrote:

> When you are dealing with a driver, register accesses need to be
> in a specific format. The MPC8349EA has some of its registers
> in big-endian format, and others in little-endian format.
> Regardless of the mode you operate your processor, you will
> *have* to use the correct byte-swap functions.

That's why we use cpu_to_be32() to write to big-endian registers.  On a
big-endian processor, this macro doesn't modify the parameter.  So,

	*p = be32_to_cpu(12);

will be compiled to

	*p = 12;

On a little-endian process, the macro will do a byte-swap.

This macro, and others like it, eliminates the need to have two different
versions of the code.

> DMA would be used to move a block of data, not to manipulate
> a register.

I can see you've never written an audio driver before.  The data itself has
endianness, and the register may require the data to appear in one endian or
another.  If

-- 
Timur Tabi
Linux kernel developer at Freescale




More information about the U-Boot mailing list