Devicetree
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM: Enable IXP4xx to use little endian mode
@ 2026-07-08 22:24 Linus Walleij
  2026-07-08 22:24 ` [PATCH 1/3] ARM: decompressor: always set endianess on xscale Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Linus Walleij @ 2026-07-08 22:24 UTC (permalink / raw)
  To: Russell King, Imre Kaloz, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Arnd Bergmann
  Cc: linux-arm-kernel, linux-kernel, devicetree, Linus Walleij

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@kernel.org>
---
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@kernel.org>


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-07-09 19:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 22:24 [PATCH 0/3] ARM: Enable IXP4xx to use little endian mode Linus Walleij
2026-07-08 22:24 ` [PATCH 1/3] ARM: decompressor: always set endianess on xscale Linus Walleij
2026-07-08 22:48   ` sashiko-bot
2026-07-09 19:32     ` Linus Walleij
2026-07-08 22:24 ` [PATCH 2/3] ARM: ixp4xx: Relax endianness Linus Walleij
2026-07-08 22:37   ` sashiko-bot
2026-07-08 23:04     ` Linus Walleij
2026-07-08 22:24 ` [PATCH 3/3] ARM: dts: ixp4xx: Drop the reg-offset hack Linus Walleij
2026-07-08 22:33   ` sashiko-bot
2026-07-08 23:05     ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox