[PATCH 0/3] ARM: Enable IXP4xx to use little endian mode

From: Linus Walleij

Date: Wed Jul 08 2026 - 18:25:11 EST


This modifies the boot path for the IXP4xx, the remaining big
endian ARM system, to enable it to be booted into little
endian mode.

Motivation: big endian is less and less supported by the kernel
and for the ARM architecture, IXP4xx is carrying the entire load
since it is booting into big endian by default. After this there
is no currently supported ARM system that cannot be booted in
little endian mode, and the big endian support may be retired,
if so desired.

How this is done:

- Enable the XScale to switch to little endian mode from a big
endian boot loader just as it can today switch into big endian
mode from a little endian boot loader.

- This works fine because when we switch endianness all bus
accesses are also endianness-switched (swap32) and everything
will keep running as before from memory.

- The object file will boot in big endian mode. This is done
by padding the file to an even number of bytes and then
endianness-swap (swap32) the entire binary before it is loaded
into memory. This means the file will "look as if it is
big endian" when it starts executing, and the first few
instrucions up until the endianness switch snippet are
executed as big endian.

- Workarounds for addressing the last byte in 32bit address of
the serial port at 0xc8000000 by pointing at 0xc8000003 were
uniformly dropped. If the system shall actually boot in
big endian mode again, we need to fix the serial driver
instead of using this hack.

I did not add the logic to pad and byteswap the image to get a
bootable "big endian" object to the kernel build: just the bare
minimum. The missing pieces are:

$(Q)size=$$(stat -c%s $(output_dir)/zImage); \
pad=$$(( (4 - size % 4) % 4 )); \
if [ $$pad -ne 0 ]; then \
dd if=/dev/zero bs=1 count=$$pad >> $(output_dir)/zImage 2>/dev/null; \
fi
$(OBJCOPY) --reverse-bytes=4 -I binary -O binary zImage zImage-swap32

The resulting zImage-swap32 will boot on a big endian system
and switch itself into little endian mode.

Tested on the IXP4xx Avila platform with a little endian
OpenWrt root filesystem on flash.

Surprisingly all drivers on the IXP4xx appear to work just fine
in little endian mode, due to care taken when authoring them.

Signed-off-by: Linus Walleij <linusw@xxxxxxxxxx>
---
Arnd Bergmann (1):
ARM: decompressor: always set endianess on xscale

Linus Walleij (2):
ARM: ixp4xx: Relax endianness
ARM: dts: ixp4xx: Drop the reg-offset hack

arch/arm/boot/compressed/Makefile | 8 --------
arch/arm/boot/compressed/big-endian.S | 14 --------------
arch/arm/boot/compressed/head-xscale.S | 12 ++++++++++++
arch/arm/boot/dts/intel/ixp/intel-ixp4xx.dtsi | 10 ----------
arch/arm/mach-ixp4xx/Kconfig | 5 ++---
5 files changed, 14 insertions(+), 35 deletions(-)
---
base-commit: aa4ffae4701cc6edf6303bf35c42e24f335d6899
change-id: 20260707-ixp4xx-little-endian-9930bd2f0325

Best regards,
--
Linus Walleij <linusw@xxxxxxxxxx>