diff mbox

[U-Boot,RFC,6/6] Mips: Update setting of endianess and CPU optimization flags

Message ID 1299676619-7963-7-git-send-email-daniel.schwierzeck@googlemail.com
State Superseded, archived
Headers show

Commit Message

Daniel Schwierzeck March 9, 2011, 1:16 p.m. UTC
The current Mips CPU config.mk code always expects a Mips 4kc
core and toolchain. This is not appropiate for other toolchains
and CPUs/SoCs.

Replace the current MIPSFLAGS code by cc-option macro and use
-march=mips32r2 as default optimization level for all Mips32 CPUs.
Replace the endianess determination code from toolchain prefix by
a more generic one inspired by the Linux arch/mips/Makefile.
Move the -mtune setting to the SoC specific config.mk makefiles.

Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
Cc: Shinya Kuribayashi <skuribay@pobox.com>
---
 arch/mips/cpu/mips32/au1x00/config.mk |    2 ++
 arch/mips/cpu/mips32/config.mk        |   21 +++++++--------------
 arch/mips/cpu/mips32/incaip/config.mk |    2 ++
 arch/mips/cpu/mips32/purple/config.mk |    2 ++
 4 files changed, 13 insertions(+), 14 deletions(-)

--
1.7.4.1
diff mbox

Patch

diff --git a/arch/mips/cpu/mips32/au1x00/config.mk b/arch/mips/cpu/mips32/au1x00/config.mk
index 3516213..ecfcb9c 100644
--- a/arch/mips/cpu/mips32/au1x00/config.mk
+++ b/arch/mips/cpu/mips32/au1x00/config.mk
@@ -20,3 +20,5 @@ 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
+
+PLATFORM_CPPFLAGS += $(call cc-option,-mtune=4kc)
diff --git a/arch/mips/cpu/mips32/config.mk b/arch/mips/cpu/mips32/config.mk
index a173c54..a91dcb4 100644
--- a/arch/mips/cpu/mips32/config.mk
+++ b/arch/mips/cpu/mips32/config.mk
@@ -20,20 +20,13 @@ 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | cut -d. -f2)
-MIPSFLAGS:=$(shell \
-if [ "$v" -lt "14" ]; then \
-	echo "-mcpu=4kc"; \
-else \
-	echo "-march=4kc -mtune=4kc"; \
-fi)

-ifneq (,$(findstring 4KCle,$(CROSS_COMPILE)))
-ENDIANNESS = -EL
-else
-ENDIANNESS = -EB
-endif
+# Optimization flags for all Mips32 CPUs
+MIPSFLAGS = $(call cc-option,-march=mips32r2,-mips32r2 -Wa,-mips32r2)

-MIPSFLAGS += $(ENDIANNESS)
+# Determine endianess from toolchain prefix
+ENDIANESS = $(shell $(CC) -dumpmachine | \
+		grep -q 'mips.*el-.*' && echo -EL || echo -EB)
+
+PLATFORM_CPPFLAGS += $(MIPSFLAGS) $(ENDIANESS)

-PLATFORM_CPPFLAGS += $(MIPSFLAGS)
diff --git a/arch/mips/cpu/mips32/incaip/config.mk b/arch/mips/cpu/mips32/incaip/config.mk
index 3516213..ecfcb9c 100644
--- a/arch/mips/cpu/mips32/incaip/config.mk
+++ b/arch/mips/cpu/mips32/incaip/config.mk
@@ -20,3 +20,5 @@ 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
+
+PLATFORM_CPPFLAGS += $(call cc-option,-mtune=4kc)
diff --git a/arch/mips/cpu/mips32/purple/config.mk b/arch/mips/cpu/mips32/purple/config.mk
index 3516213..ecfcb9c 100644
--- a/arch/mips/cpu/mips32/purple/config.mk
+++ b/arch/mips/cpu/mips32/purple/config.mk
@@ -20,3 +20,5 @@ 
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
+
+PLATFORM_CPPFLAGS += $(call cc-option,-mtune=4kc)