From ea00e59be08989dae905076f4acf3eb297fce552 Mon Sep 17 00:00:00 2001
From: Stefano Babic <sbabic@denx.de>
Date: Wed, 5 Sep 2012 20:16:36 +0000
Subject: [PATCH] MX: set a common place to share code for Freescale i.MX

Up now only MX5 and MX6 can share code, because they have
a common source directory in cpu/armv7. Other not armv7
i.MX can profit of the same shared code. Move these files
into a directory accessible for all, similar to plat-mxc
in linux.

Signed-off-by: Stefano Babic <sbabic@denx.de>
---
 Makefile                                                   | 7 ++-----
 arch/arm/{cpu/armv7 => }/imx-common/Makefile               | 4 +++-
 arch/arm/{cpu/armv7 => }/imx-common/cmd_bmode.c            | 0
 arch/arm/{cpu/armv7 => }/imx-common/cpu.c                  | 0
 .../{cpu/armv7/imx-common/i2c.c => imx-common/i2c-mxv7.c}  | 0
 arch/arm/{cpu/armv7 => }/imx-common/iomux-v3.c             | 0
 arch/arm/{cpu/armv7 => }/imx-common/speed.c                | 0
 arch/arm/{cpu/armv7 => }/imx-common/timer.c                | 0
 8 files changed, 5 insertions(+), 6 deletions(-)
 rename arch/arm/{cpu/armv7 => }/imx-common/Makefile (94%)
 rename arch/arm/{cpu/armv7 => }/imx-common/cmd_bmode.c (100%)
 rename arch/arm/{cpu/armv7 => }/imx-common/cpu.c (100%)
 rename arch/arm/{cpu/armv7/imx-common/i2c.c => imx-common/i2c-mxv7.c} (100%)
 rename arch/arm/{cpu/armv7 => }/imx-common/iomux-v3.c (100%)
 rename arch/arm/{cpu/armv7 => }/imx-common/speed.c (100%)
 rename arch/arm/{cpu/armv7 => }/imx-common/timer.c (100%)

diff --git a/Makefile b/Makefile
index e5f8d059a5..fe2f98c58b 100644
--- a/Makefile
+++ b/Makefile
@@ -306,11 +306,8 @@ ifneq ($(CONFIG_AM33XX)$(CONFIG_OMAP34XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX),)
 LIBS-y += $(CPUDIR)/omap-common/libomap-common.o
 endif
 
-ifeq ($(SOC),mx5)
-LIBS-y += $(CPUDIR)/imx-common/libimx-common.o
-endif
-ifeq ($(SOC),mx6)
-LIBS-y += $(CPUDIR)/imx-common/libimx-common.o
+ifneq (,$(filter $(SOC), mx25 mx27 mx5 mx6 mx31 mx35))
+LIBS-y += arch/$(ARCH)/imx-common/libimx-common.o
 endif
 
 ifeq ($(SOC),s5pc1xx)
diff --git a/arch/arm/cpu/armv7/imx-common/Makefile b/arch/arm/imx-common/Makefile
similarity index 94%
rename from arch/arm/cpu/armv7/imx-common/Makefile
rename to arch/arm/imx-common/Makefile
index 16fba8da93..b3e608e9db 100644
--- a/arch/arm/cpu/armv7/imx-common/Makefile
+++ b/arch/arm/imx-common/Makefile
@@ -27,8 +27,10 @@ include $(TOPDIR)/config.mk
 
 LIB     = $(obj)libimx-common.o
 
+ifeq ($(SOC),$(filter $(SOC),mx5 mx6))
 COBJS-y	= iomux-v3.o timer.o cpu.o speed.o
-COBJS-$(CONFIG_I2C_MXC) += i2c.o
+COBJS-$(CONFIG_I2C_MXC) += i2c-mxv7.o
+endif
 COBJS-$(CONFIG_CMD_BMODE) += cmd_bmode.o
 COBJS	:= $(sort $(COBJS-y))
 
diff --git a/arch/arm/cpu/armv7/imx-common/cmd_bmode.c b/arch/arm/imx-common/cmd_bmode.c
similarity index 100%
rename from arch/arm/cpu/armv7/imx-common/cmd_bmode.c
rename to arch/arm/imx-common/cmd_bmode.c
diff --git a/arch/arm/cpu/armv7/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
similarity index 100%
rename from arch/arm/cpu/armv7/imx-common/cpu.c
rename to arch/arm/imx-common/cpu.c
diff --git a/arch/arm/cpu/armv7/imx-common/i2c.c b/arch/arm/imx-common/i2c-mxv7.c
similarity index 100%
rename from arch/arm/cpu/armv7/imx-common/i2c.c
rename to arch/arm/imx-common/i2c-mxv7.c
diff --git a/arch/arm/cpu/armv7/imx-common/iomux-v3.c b/arch/arm/imx-common/iomux-v3.c
similarity index 100%
rename from arch/arm/cpu/armv7/imx-common/iomux-v3.c
rename to arch/arm/imx-common/iomux-v3.c
diff --git a/arch/arm/cpu/armv7/imx-common/speed.c b/arch/arm/imx-common/speed.c
similarity index 100%
rename from arch/arm/cpu/armv7/imx-common/speed.c
rename to arch/arm/imx-common/speed.c
diff --git a/arch/arm/cpu/armv7/imx-common/timer.c b/arch/arm/imx-common/timer.c
similarity index 100%
rename from arch/arm/cpu/armv7/imx-common/timer.c
rename to arch/arm/imx-common/timer.c
-- 
2.39.5