Subject: mx27: add pcm970 evaluation board
From: Juergen Beisert <j.beisert@pengutronix.de>

The Phytec phyCORE-i.MX27 CPU module is delivered with the PCM970
baseboard by default. This patch adds support for the hardware.

This code is only an empty stub; it is filled up with functionality
in a later patch series.

Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>

---

 arch/arm/mach-mx2/Kconfig               |   14 +++++++++++++
 arch/arm/mach-mx2/Makefile              |    1 
 arch/arm/mach-mx2/pcm038.c              |   18 ++++++++++++++++-
 arch/arm/mach-mx2/pcm970-baseboard.c    |   33 ++++++++++++++++++++++++++++++++
 include/asm-arm/arch-mxc/board-pcm038.h |   18 +++++++++++------
 5 files changed, 77 insertions(+), 7 deletions(-)

Index: linux-2.6.26-rc6/arch/arm/mach-mx2/pcm970-baseboard.c
===================================================================
--- /dev/null
+++ linux-2.6.26-rc6/arch/arm/mach-mx2/pcm970-baseboard.c
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include <linux/platform_device.h>
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include "devices.h"
+
+/*
+ * system init for baseboard usage. Will be called by pcm038 init.
+ *
+ * Add platform devices present on this baseboard and init
+ * them from CPU side as far as required to use them later on
+ */
+void __init pcm970_baseboard_init(void)
+{
+}
Index: linux-2.6.26-rc6/arch/arm/mach-mx2/Kconfig
===================================================================
--- linux-2.6.26-rc6.orig/arch/arm/mach-mx2/Kconfig
+++ linux-2.6.26-rc6/arch/arm/mach-mx2/Kconfig
@@ -23,3 +23,17 @@ config MACH_PCM038
 	help
 	  Include support for phyCORE-i.MX27 (aka pcm038) platform. This
 	  includes specific configurations for the module and its peripherals.
+
+choice
+	prompt "Baseboard"
+	depends on MACH_PCM038
+	default MACH_PCM970_BASEBOARD
+
+config MACH_PCM970_BASEBOARD
+	prompt "PHYTEC PCM970 development board"
+	bool
+	help
+	  This adds board specific devices that can be found on Phytec's
+	  PCM970 evaluation board.
+
+endchoice
Index: linux-2.6.26-rc6/arch/arm/mach-mx2/Makefile
===================================================================
--- linux-2.6.26-rc6.orig/arch/arm/mach-mx2/Makefile
+++ linux-2.6.26-rc6/arch/arm/mach-mx2/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_MACH_MX27) += clock_imx27.o
 
 obj-$(CONFIG_MACH_MX27ADS) += mx27ads.o
 obj-$(CONFIG_MACH_PCM038) += pcm038.o
+obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o
Index: linux-2.6.26-rc6/include/asm-arm/arch-mxc/board-pcm038.h
===================================================================
--- linux-2.6.26-rc6.orig/include/asm-arm/arch-mxc/board-pcm038.h
+++ linux-2.6.26-rc6/include/asm-arm/arch-mxc/board-pcm038.h
@@ -19,12 +19,6 @@
 #ifndef __ASM_ARCH_MXC_BOARD_PCM038_H__
 #define __ASM_ARCH_MXC_BOARD_PCM038_H__
 
-/* Start of physical RAM */
-#define PHYS_OFFSET             UL(0xA0000000)
-
-/* Size of contiguous memory for DMA and other h/w blocks */
-#define CONSISTENT_DMA_SIZE	SZ_8M
-
 /* this CPU supports two I2C channel. Define the one, that controls the
    on board devices EEPROM, RTC and temparature sensor */
 #define PCM038_I2C_BUS		1
@@ -42,4 +36,16 @@
  */
 #define SDRAM_MEM_SIZE          SZ_128M
 
+#ifndef __ASSEMBLY__
+/*
+ * This CPU module needs a baseboard to work. After basic initializing
+ * its own devices, it calls baseboard's init function.
+ * TODO: Add your own basebaord init function and call it from
+ * inside pcm038_init(). This example here is for the development board.
+ * Refer pcm970-baseboard.c
+ */
+extern void pcm970_baseboard_init(void);
+
+#endif
+
 #endif /* __ASM_ARCH_MXC_BOARD_PCM038_H__ */
Index: linux-2.6.26-rc6/arch/arm/mach-mx2/pcm038.c
===================================================================
--- linux-2.6.26-rc6.orig/arch/arm/mach-mx2/pcm038.c
+++ linux-2.6.26-rc6/arch/arm/mach-mx2/pcm038.c
@@ -31,9 +31,11 @@
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
+#include <asm/mach/time.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/imx-uart.h>
+#include <asm/arch/board-pcm038.h>
 
 #include "devices.h"
 
@@ -188,8 +190,22 @@ static void __init pcm038_init(void)
 		imx_init_uart(i, &uart_pdata[i]);
 
 	platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+
+#ifdef CONFIG_MACH_PCM970_BASEBOARD
+	pcm970_baseboard_init();
+#endif
+}
+
+static void __init pcm038_timer_init(void)
+{
+	mxc_clocks_init(26000000);
+	mxc_timer_init("gpt_clk.0");
 }
 
+struct sys_timer pcm038_timer = {
+	.init = pcm038_timer_init,
+};
+
 MACHINE_START(PCM038, "phyCORE-i.MX27")
 	.phys_io        = AIPI_BASE_ADDR,
 	.io_pg_offst    = ((AIPI_BASE_ADDR_VIRT) >> 18) & 0xfffc,
@@ -197,5 +213,5 @@ MACHINE_START(PCM038, "phyCORE-i.MX27")
 	.map_io         = mxc_map_io,
 	.init_irq       = mxc_init_irq,
 	.init_machine   = pcm038_init,
-	.timer          = &mxc_timer,
+	.timer          = &pcm038_timer,
 MACHINE_END
