From f47fb6b4a0082d1a9da03cec86150a5af4131eb3 Mon Sep 17 00:00:00 2001
From: Masahiro Yamada <yamada.masahiro@socionext.com>
Date: Fri, 27 Mar 2015 17:01:11 +0900
Subject: [PATCH] m68k: mcf523x: move CPU type to Kconfig and refactor
 config.mk

Move the CPU type config options from include/configs/M5235EVB.h
to arch/m68k/Kconfig and refactor the CPU flags select in
arch/m68k/cpu/mcf523x/config.mk.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Alison Wang <alison.wang@freescale.com>
Cc: Angelo Dureghello <angelo@sysam.it>
---
 arch/m68k/Kconfig               | 8 ++++++++
 arch/m68k/cpu/mcf523x/config.mk | 4 +++-
 include/configs/M5235EVB.h      | 2 --
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index a645d95da0..a3f0cbc2a4 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -11,6 +11,9 @@ config MCF520x
 config MCF52x2
 	bool
 
+config MCF523x
+	bool
+
 config MCF530x
 	bool
 
@@ -37,6 +40,10 @@ config M5208
 	bool
 	select MCF520x
 
+config M5235
+	bool
+	select MCF523x
+
 config M5249
 	bool
 	select MCF52x2
@@ -103,6 +110,7 @@ config TARGET_M52277EVB
 
 config TARGET_M5235EVB
 	bool "Support M5235EVB"
+	select M5235
 
 config TARGET_COBRA5272
 	bool "Support cobra5272"
diff --git a/arch/m68k/cpu/mcf523x/config.mk b/arch/m68k/cpu/mcf523x/config.mk
index c9435ab99b..4795f6ab8a 100644
--- a/arch/m68k/cpu/mcf523x/config.mk
+++ b/arch/m68k/cpu/mcf523x/config.mk
@@ -7,4 +7,6 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-PLATFORM_CPPFLAGS += -mcpu=5235 -fPIC
+cpuflags-$(CONFIG_M5235) := -mcpu=5235 -fPIC
+
+PLATFORM_CPPFLAGS += $(cpuflags-y)
diff --git a/include/configs/M5235EVB.h b/include/configs/M5235EVB.h
index 0f6e2f72cf..883347b0fd 100644
--- a/include/configs/M5235EVB.h
+++ b/include/configs/M5235EVB.h
@@ -18,8 +18,6 @@
  * High Level Configuration Options
  * (easy to change)
  */
-#define CONFIG_MCF523x		/* define processor family */
-#define CONFIG_M5235		/* define processor type */
 
 #define CONFIG_MCFUART
 #define CONFIG_SYS_UART_PORT		(0)
-- 
2.39.5