On Fri, Feb 20, 2015 at 8:00 PM, Matt Turner <mattst88@xxxxxxxxx> wrote: > On Fri, Feb 20, 2015 at 1:53 AM, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote: >> >> was recently handed a MIPS-based dev board (can't name the vendor, >> NDA) that *typically* runs in LE mode but, because of a proprietary >> binary that must be run on the board and was compiled as BE, has to be >> run in BE mode. >> >> the vendor supplied a yoctoproject layer that seems to work fine >> but, in changing the DEFAULTTUNE to big-endian, the following patch >> had to be applied to the 3.14 kernel tree to the file >> arch/mips/include/asm/io.h in order to get output from the console >> port as the system was booting: >> >> 326c326,333 >> < *__mem = __val; \ >> --- >>> { \ >>> if (sizeof(type) == sizeof(u32)) \ >>> { \ >>> *__mem = __cpu_to_le32(__val); \ > > They're byte swapping a value if they're in big endian mode. > >>> } \ >>> else \ >>> *__mem = __val; \ > > And they don't seem to really understand the __cpu_to_le32 macro... Sorry, I should be more precise. They're byte swapping 32-bit values if they're in big endian mode, and copying everything else without conversion.