Kconfig: Unify endian support option
Move SUPPORT_BIG_ENDIAN, SUPPORT_LITTLE_ENDIAN to top-level
arch Kconfig and let architectures select them as necessary.
Remove if guard for Endianness selection choice so we can
have one of SYS_BIG_ENDIAN, SYS_LITTLE_ENDIAN config symbol
defined even on single endian system.
Default endian to SYS_BIG_ENDIAN for MIPS || MICROBLAZE
and LITTLE_ENDIAN for the rest to retain old config
behaviour.
Note: PPC, SH, Xtensa are technically bi-endian, but I
checked compiled u-boot image with readelf, U-Boot currently
only support little endian for SH and Xtensa, Big Endian for
PPC.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
diff --git a/arch/Kconfig b/arch/Kconfig
index abd406d..8f1f466 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -8,6 +8,13 @@
config HAVE_ARCH_IOREMAP
bool
+config SUPPORT_BIG_ENDIAN
+ bool
+
+config SUPPORT_LITTLE_ENDIAN
+ bool
+ default y if !SUPPORT_BIG_ENDIAN
+
config SYS_CACHE_SHIFT_4
bool
@@ -59,6 +66,8 @@
select SUPPORT_OF_CONTROL
select SYS_CACHE_SHIFT_7
select TIMER
+ select SUPPORT_BIG_ENDIAN
+ select SUPPORT_LITTLE_ENDIAN
select SYS_BIG_ENDIAN if CPU_BIG_ENDIAN
select SYS_LITTLE_ENDIAN if !CPU_BIG_ENDIAN
@@ -68,6 +77,7 @@
select CREATE_ARCH_SYMLINK
select HAVE_PRIVATE_LIBGCC if !ARM64
select SUPPORT_ACPI
+ select SUPPORT_LITTLE_ENDIAN
select SUPPORT_OF_CONTROL
config M68K
@@ -77,10 +87,13 @@
select SYS_BOOT_GET_CMDLINE
select SYS_BOOT_GET_KBD
select SYS_CACHE_SHIFT_4
+ select SUPPORT_BIG_ENDIAN
select SUPPORT_OF_CONTROL
config MICROBLAZE
bool "MicroBlaze architecture"
+ select SUPPORT_BIG_ENDIAN
+ select SUPPORT_LITTLE_ENDIAN
select SUPPORT_OF_CONTROL
imply CMD_TIMER
imply SPL_REGMAP if SPL
@@ -101,12 +114,14 @@
select DM
select DM_EVENT
select OF_CONTROL
+ select SUPPORT_LITTLE_ENDIAN
select SUPPORT_OF_CONTROL
imply CMD_DM
config PPC
bool "PowerPC architecture"
select HAVE_PRIVATE_LIBGCC
+ select SUPPORT_BIG_ENDIAN
select SUPPORT_OF_CONTROL
select SYS_BOOT_GET_CMDLINE
select SYS_BOOT_GET_KBD
@@ -115,6 +130,7 @@
bool "RISC-V architecture"
select CREATE_ARCH_SYMLINK
select SUPPORT_ACPI
+ select SUPPORT_LITTLE_ENDIAN
select SUPPORT_OF_CONTROL
select OF_CONTROL
select DM
@@ -160,6 +176,8 @@
select PCI_ENDPOINT
select SPI
select SUPPORT_OF_CONTROL
+ select SUPPORT_BIG_ENDIAN
+ select SUPPORT_LITTLE_ENDIAN
select SYSRESET_CMD_POWEROFF if CMD_POWEROFF
select SYS_CACHE_SHIFT_4
select IRQ
@@ -224,6 +242,7 @@
config SH
bool "SuperH architecture"
+ select SUPPORT_LITTLE_ENDIAN
select HAVE_PRIVATE_LIBGCC
select SUPPORT_OF_CONTROL
@@ -231,6 +250,7 @@
bool "x86 architecture"
select SUPPORT_SPL
select SUPPORT_TPL
+ select SUPPORT_LITTLE_ENDIAN
select CREATE_ARCH_SYMLINK
select DM
select HAVE_ARCH_IOMAP
@@ -312,6 +332,7 @@
config XTENSA
bool "Xtensa architecture"
select CREATE_ARCH_SYMLINK
+ select SUPPORT_LITTLE_ENDIAN
select SUPPORT_OF_CONTROL
endchoice
@@ -515,24 +536,21 @@
source "board/keymile/Kconfig"
-if MIPS || MICROBLAZE
-
choice
prompt "Endianness selection"
+ default SYS_BIG_ENDIAN if MIPS || MICROBLAZE
+ default SYS_LITTLE_ENDIAN
help
- Some MIPS boards can be configured for either little or big endian
+ Some boards can be configured for either little or big endian
byte order. These modes require different U-Boot images. In general there
is one preferred byteorder for a particular system but some systems are
just as commonly used in the one or the other endianness.
config SYS_BIG_ENDIAN
bool "Big endian"
- depends on (SUPPORTS_BIG_ENDIAN && MIPS) || MICROBLAZE
+ depends on SUPPORT_BIG_ENDIAN
config SYS_LITTLE_ENDIAN
bool "Little endian"
- depends on (SUPPORTS_LITTLE_ENDIAN && MIPS) || MICROBLAZE
-
+ depends on SUPPORT_LITTLE_ENDIAN
endchoice
-
-endif