[U-Boot] ARM: set up endianess

Hello
my platform is ARM926EJS-based big-endian, therefore I have to configure endianess via co-processor C15 registers as quickly as possible. The best place I can see is in $(uboot)/cpu/arm926ejs/start.s, as it is where co-processor is being configured; here is what I came up with:
cpu_init_crit: /* * flush v4 I/D caches */ .... /* * disable MMU stuff and caches */ mrc p15, 0, r0, c1, c0, 0 bic r0, r0, #0x00002300 /* clear bits 13, 9:8 (--V- --RS) */ bic r0, r0, #0x00000087 /* clear bits 7, 2:0 (B--- -CAM) */ orr r0, r0, #0x00000002 /* set bit 2 (A) Align */ orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */ #ifdef CONFIG_ARCH_BIGENDIAN orr r0, r0, #0x00000080 /* set bit 7 (B) Endianism */ #endif mcr p15, 0, r0, c1, c0, 0 ....
where 'CONFIG_ARCH_BIGENDIAN' is defined in my platform's configuration.
I know that modifying platform's startup code is not encouraged. Is there more correct approach? Thanks.
participants (1)
-
Roman Mashak