Re: what is the purpose of the following LE->BE patch to arch/mips/include/asm/io.h?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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);  \
>>               }                                                                       \
>>               else                                                            \
>>                       *__mem = __val;                                         \
>>       }                                                                                       \
> 356a364
>>       {                                                                               \
> 357a366,368
>>               if (sizeof(type) == sizeof(u32))        \
>>                       __val = __cpu_to_le32(__val);   \
>>       }                                                                                       \
>
>   without that patch, the initial conclusion was that the board was
> just hanging at boot, but i was told, no, it was booting, there was
> just no output at the console port. applied the patch and, voila.

If it's using the serial8250 driver with a standard 16550A-ish UART,
MMIO accesses via readl()/writel() may be byteswapped on a BE system.

Historically I've dealt with this problem by locally modifying the
serial8250 driver to use the __raw_* variants, but here is a patch
that lets you instruct the driver to use either LE or BE accessors:

http://patchwork.linux-mips.org/patch/8572/





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux