From mboxrd@z Thu Jan 1 00:00:00 1970 From: Timur Tabi Date: Fri, 02 May 2008 14:47:48 -0500 Subject: [U-Boot-Users] Configuring U-Boot for MPC8349E in little endian mode In-Reply-To: <481B46D5.6050605@ovro.caltech.edu> References: <47230CE166B64744B0120173E4C2161E04D531CF@BLR-EC-MBX01.wipro.com> <47230CE166B64744B0120173E4C2161E04D5352E@BLR-EC-MBX01.wipro.com> <481B265B.8060601@freescale.com> <481B46D5.6050605@ovro.caltech.edu> Message-ID: <481B6FE4.3090904@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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