Add support for the Phytec phyCARD-L (PCA-102) to barebox.

From: Juergen Kilb <J.Kilb@phytec.de>

Signed-off-by: Juergen Kilb <J.Kilb@phytec.de>
---

 arch/arm/Makefile                               |    1 
 arch/arm/boards/omap/Kconfig                    |    9 +
 arch/arm/boards/phyCARD-L/Makefile              |   26 ++
 arch/arm/boards/phyCARD-L/board.h               |   35 ++
 arch/arm/boards/phyCARD-L/config.h              |   38 ++
 arch/arm/boards/phyCARD-L/devices-gpmc-nand.c   |  101 ++++++
 arch/arm/boards/phyCARD-L/env/bin/_update       |   39 ++
 arch/arm/boards/phyCARD-L/env/bin/boot          |   38 ++
 arch/arm/boards/phyCARD-L/env/bin/hush_hack     |    1 
 arch/arm/boards/phyCARD-L/env/bin/init          |   33 ++
 arch/arm/boards/phyCARD-L/env/bin/update_kernel |    8 
 arch/arm/boards/phyCARD-L/env/bin/update_rootfs |    8 
 arch/arm/boards/phyCARD-L/env/config            |   33 ++
 arch/arm/boards/phyCARD-L/pca102.c              |  390 +++++++++++++++++++++++
 arch/arm/boards/phyCARD-L/pca102.dox            |   16 +
 arch/arm/boards/phyCARD-L/platform.S            |   65 ++++
 arch/arm/configs/pca102_defconfig               |  255 +++++++++++++++
 board/omap/Kconfig                              |  171 ++++++++++
 18 files changed, 1267 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boards/phyCARD-L/Makefile
 create mode 100644 arch/arm/boards/phyCARD-L/board.h
 create mode 100644 arch/arm/boards/phyCARD-L/config.h
 create mode 100644 arch/arm/boards/phyCARD-L/devices-gpmc-nand.c
 create mode 100644 arch/arm/boards/phyCARD-L/env/bin/_update
 create mode 100644 arch/arm/boards/phyCARD-L/env/bin/boot
 create mode 100644 arch/arm/boards/phyCARD-L/env/bin/hush_hack
 create mode 100644 arch/arm/boards/phyCARD-L/env/bin/init
 create mode 100644 arch/arm/boards/phyCARD-L/env/bin/update_kernel
 create mode 100644 arch/arm/boards/phyCARD-L/env/bin/update_rootfs
 create mode 100644 arch/arm/boards/phyCARD-L/env/config
 create mode 100644 arch/arm/boards/phyCARD-L/pca102.c
 create mode 100644 arch/arm/boards/phyCARD-L/pca102.dox
 create mode 100644 arch/arm/boards/phyCARD-L/platform.S
 create mode 100644 arch/arm/configs/pca102_defconfig
 create mode 100644 board/omap/Kconfig


Index: barebox-2010.10.0/arch/arm/Makefile
===================================================================
--- barebox-2010.10.0.orig/arch/arm/Makefile	2010-10-02 13:00:45.000000000 +0200
+++ barebox-2010.10.0/arch/arm/Makefile	2010-11-04 10:16:48.781305876 +0100
@@ -73,6 +73,7 @@
 board-$(CONFIG_MACH_NXDB500)			:= netx
 board-$(CONFIG_ARCH_OMAP)			:= omap
 board-$(CONFIG_MACH_PCA100)			:= phycard-i.MX27
+board-$(CONFIG_MACH_PCA102)			:= phyCARD-L
 board-$(CONFIG_MACH_PCM037)			:= pcm037
 board-$(CONFIG_MACH_PCM038)			:= pcm038
 board-$(CONFIG_MACH_PCM043)			:= pcm043
Index: barebox-2010.10.0/arch/arm/boards/omap/Kconfig
===================================================================
--- barebox-2010.10.0.orig/arch/arm/boards/omap/Kconfig	2010-10-02 13:00:45.000000000 +0200
+++ barebox-2010.10.0/arch/arm/boards/omap/Kconfig	2010-11-04 10:16:48.791232249 +0100
@@ -31,6 +31,7 @@
 	default "Texas Instrument's SDP343x" if MACH_OMAP343xSDP
 	default "Texas Instrument's Beagle" if MACH_BEAGLE
 	default "Texas Instrument's OMAP3EVM" if MACH_OMAP3EVM
+        default "Phytec phyCARD-L" if MACH_PCA102
 
 choice
 	prompt "Select OMAP platform"
@@ -59,6 +60,14 @@
 	  help
 	  Say Y here if you are using OMAP3EVM
 
+config MACH_PCA102
+        bool "Phytec phyCARD-L"
+        select MACH_HAS_LOWLEVEL_INIT
+        select OMAP_CLOCK_ALL
+        select HAS_OMAP_NAND
+          help
+          Say Y here if you are using a phyCARD-L PCA-102
+
 endchoice
 
 if MACH_OMAP3EVM
Index: barebox-2010.10.0/arch/arm/boards/phyCARD-L/Makefile
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/boards/phyCARD-L/Makefile	2010-11-04 10:16:48.791232249 +0100
@@ -0,0 +1,26 @@
+# OMAP Board Specific Makefile
+#
+# (C) Copyright 2008
+# OMAP Architecture specific features
+# Texas Instruments, <www.ti.com>
+# Nishanth Menon <x0nishan@ti.com>
+#
+# 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., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+
+obj-$(CONFIG_MACH_DO_LOWLEVEL_INIT) += platform.o
+obj-y += pca102.o
+obj-y += devices-gpmc-nand.o
+
Index: barebox-2010.10.0/arch/arm/boards/phyCARD-L/board.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/boards/phyCARD-L/board.h	2010-11-04 10:16:48.791232249 +0100
@@ -0,0 +1,35 @@
+/**
+ * @file
+ * @brief exported generic APIs which various board files implement
+ *
+ * FileName: board/phyCARD-L/board.h
+ *
+ * This file will not contain any board specific implementations.
+ */
+/*
+ * (C) Copyright 2008
+ * Texas Instruments, <www.ti.com>
+ * Raghavendra KH <r-khandenahally@ti.com>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef __BOARD_OMAP_H_
+#define __BOARD_OMAP_H_
+
+/** Generic Board initialization called from platform.S */
+void board_init(void);
+
+#endif         /* __BOARD_OMAP_H_ */
Index: barebox-2010.10.0/arch/arm/boards/phyCARD-L/config.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/boards/phyCARD-L/config.h	2010-11-04 10:16:48.791232249 +0100
@@ -0,0 +1,38 @@
+/**
+ * @file
+ * @brief provide a wrapper for standard malloc and stack size defines
+ *
+ * FileName: board/omap/config.h
+ *
+ * Standard defines should be configurable for us to move Stack and malloc
+ * areas around this defines some basics for that
+ */
+/*
+ * (C) Copyright 2006-2008
+ * Texas Instruments, <www.ti.com>
+ * Nishanth Menon <x0nishan@ti.com>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#ifndef __MACH_OMAP_CONFIG_H
+#define __MACH_OMAP_CONFIG_H
+
+/** define CFG_MALLOC_LEN from Kconfig define */
+#define CFG_MALLOC_LEN     CONFIG_OMAP_MALLOC_LEN
+/** define CONFIG_STACKSIZE from Kconfig define */
+#define CONFIG_STACKSIZE   CONFIG_OMAP_CONFIG_STACKSIZE
+
+#endif /* __MACH_OMAP_CONFIG_H */
Index: barebox-2010.10.0/arch/arm/boards/phyCARD-L/devices-gpmc-nand.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/boards/phyCARD-L/devices-gpmc-nand.c	2010-11-04 10:16:48.791232249 +0100
@@ -0,0 +1,101 @@
+/**
+ * @file
+ * @brief GPMC specific NAND devices
+ *
+ * FileName: arch/arm/boards/omap/devices-gpmc-nand.c
+ *
+ * GPMC NAND Devices such as those from Micron, Samsung are listed here
+ */
+/*
+ * (C) Copyright 2006-2008
+ * Texas Instruments, <www.ti.com>
+ * Nishanth Menon <x0nishan@ti.com>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <console.h>
+#include <init.h>
+#include <driver.h>
+#include <clock.h>
+#include <asm/io.h>
+
+#include <mach/silicon.h>
+#include <mach/gpmc.h>
+#include <mach/gpmc_nand.h>
+
+#define GPMC_CONF1_VALx8	0x00000800
+#define GPMC_CONF1_VALx16	0x00001800
+/* Set up the generic params */
+
+/** GPMC timing for our nand device */
+static struct gpmc_config nand_cfg = {
+	.cfg = {
+		0,		/*CONF1 */
+		0x00141400,	/*CONF2 */
+		0x00141400,	/*CONF3 */
+		0x0F010F01,	/*CONF4 */
+		0x010C1414,	/*CONF5 */
+#ifdef CONFIG_ARCH_OMAP3
+		/* Additional bits in OMAP3 */
+		0x1F040000 |
+#endif
+		0x00000A80,	/*CONF6 */
+		},
+
+	/* Nand: dont care about base address */
+	.base = 0x28000000,
+	/* GPMC address map as small as possible */
+	.size = GPMC_SIZE_16M,
+};
+
+/** NAND platform specific settings settings */
+static struct gpmc_nand_platform_data nand_plat = {
+	.cs = 0,
+	.max_timeout = MSECOND,
+	.wait_mon_pin = 0,
+	.priv = (void *)&nand_cfg,
+};
+
+/** NAND device definition */
+static struct device_d gpmc_generic_nand_nand_device = {
+	.name = "gpmc_nand",
+	.map_base = OMAP_GPMC_BASE,
+	.size = 1024 * 4,	/* GPMC size */
+	.platform_data = (void *)&nand_plat,
+};
+
+/**
+ * @brief gpmc_generic_nand_devices_init - init generic nand device
+ *
+ * @return success/fail based on device funtion
+ */
+int gpmc_generic_nand_devices_init(int cs, int width, int hwecc)
+{
+	nand_plat.cs = cs;
+
+	if (width == 16)
+		nand_cfg.cfg[0] = GPMC_CONF1_VALx16;
+	else
+		nand_cfg.cfg[0] = GPMC_CONF1_VALx8;
+
+	nand_plat.device_width = width;
+	nand_plat.plat_options = hwecc ? NAND_HWECC_ENABLE : 0;
+
+	/* Configure GPMC CS before register */
+	gpmc_cs_config(nand_plat.cs, &nand_cfg);
+	return register_device(&gpmc_generic_nand_nand_device);
+}
Index: barebox-2010.10.0/arch/arm/boards/phyCARD-L/env/config
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/boards/phyCARD-L/env/config	2010-11-04 11:18:27.161636475 +0100
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+machine=pca102
+user=
+
+# use 'dhcp' to do dhcp in barebox and in kernel
+# use 'none' if you want to skip kernel ip autoconfiguration
+#ip=dhcp
+
+# or set your networking parameters here
+eth0.ipaddr=192.168.3.11
+eth0.netmask=255.255.255.0
+eth0.gateway=192.168.3.10
+eth0.serverip=192.168.3.10
+
+# can be either 'net' or 'nand''
+kernel_loc=nand
+# can be either 'net' or 'nand''
+rootfs_loc=nand
+
+# can be either 'jffs2' or 'ubifs'
+rootfs_type=jffs2
+rootfsimage=root-$machine.$rootfs_type
+
+# The image type of the kernel.
+kernelimage_type=uimage
+kernelimage=uImage-$machine
+
+if [ -n $user ]; then
+	kernelimage="$user"-"$kernelimage"
+	nfsroot="$eth0.serverip:/home/$user/nfsroot/$machine"
+	rootfsimage="$user"-"$rootfsimage"
+else
+	nfsroot="$eth0.serverip:/path/to/nfs/root"
+fi
+
+autoboot_timeout=3
+
+bootargs="console=ttyS0,115200"
+
+# the following displays are supported
+# pd050vl1 (640 x 480)
+# pd035vl1 (640 x 480)
+# pd104slf (800 x 600)
+# pm070wl4 (800 x 480)
+#
+# omapfb.mode=<display>:<mode>,[,...]
+# omapfb.debug=<y|n>
+#        - Enable debug printing. You have to have OMAPFB debug support enabled
+#          in kernel config.
+#
+bootargs="$bootargs omapdss.def_disp=pd050vl1"
+#bootargs="$bootargs omapdss.def_disp=pd035vl1"
+#bootargs="$bootargs omapdss.def_disp=pd104slf"
+#bootargs="$bootargs omapdss.def_disp=pm070wl4"
+
+nand_parts="512k(x-loader)ro,1920k(barebox),128k(bareboxenv),4M(kernel),-(root)"
+rootfs_mtdblock_nand=4
+
+nand_device=omap2-nand
+
+# set a fancy prompt (if support is compiled in)
+PS1="\e[1;32mbarebox@\e[1;31m\h:\w\e[0m "
+
Index: barebox-2010.10.0/arch/arm/boards/phyCARD-L/pca102.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/boards/phyCARD-L/pca102.c	2010-11-04 10:16:48.791232249 +0100
@@ -0,0 +1,390 @@
+/**
+ * @file
+ * @brief Board Initialization routines for the phyCARD-L (PCA02)
+ *
+ * FileName: board/phyCARD-L/pca102.c
+ *
+ * This board is based on OMAP3530.
+ * More on OMAP3530 (including documentation can be found here):
+ * http://focus.ti.com/docs/prod/folders/print/omap3530.html
+ *
+ * This file provides initialization in two stages:
+ * @li Boot time initialization - just get SDRAM working.
+ * This is run from SRAM - so no case constructs and global vars can be used.
+ * @li Run time initialization - this is for the rest of the initializations
+ * such as flash, uart etc.
+ *
+ * Boot time initialization includes:
+ * @li SDRAM initialization.
+ * @li Pin Muxing relevant for the EVM.
+ *
+ * Run time initialization includes
+ * @li serial @ref serial_ns16550.c driver device definition
+ *
+ * Originally from board/omap/board-beagle.c
+ */
+
+/*
+ * Copyright (C) 2010 Phytec Messtechnik GmbH - http://www.phytec.de/
+ * Juergen Kilb <j.kilb@phytec.de>
+ *
+ * bases on code from Texas Instruments / board-beagle.c
+ * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
+ * Sanjeev Premi <premi@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <console.h>
+#include <init.h>
+#include <driver.h>
+#include <asm/io.h>
+#include <ns16550.h>
+#include <asm/armlinux.h>
+#include <asm/mach-types.h>
+#include <mach/silicon.h>
+#include <mach/sdrc.h>
+#include <mach/sys_info.h>
+#include <mach/syslib.h>
+#include <mach/control.h>
+#include <mach/omap3-mux.h>
+#include <mach/gpmc.h>
+#include <mach/gpmc_nand.h>
+#include <partition.h>
+#include <nand.h>
+
+#include "board.h"
+
+#define SMC911X_BASE 0x2c000000
+
+/*
+ * Boot-time initialization(s)
+ */
+
+/**
+ * @brief Initialize the SDRC module
+ *
+ * @return void
+ */
+static void sdrc_init(void)
+{
+	/* SDRAM software reset */
+	/* No idle ack and RESET enable */
+	writel(0x1A, SDRC_REG(SYSCONFIG));
+	sdelay(100);
+	/* No idle ack and RESET disable */
+	writel(0x18, SDRC_REG(SYSCONFIG));
+
+	/* SDRC Sharing register */
+	/* 32-bit SDRAM on data lane [31:0] - CS0 */
+	/* pin tri-stated = 1 */
+	writel(0x00000100, SDRC_REG(SHARING));
+
+	/* ----- SDRC Registers Configuration --------- */
+	/* SDRC_MCFG0 register */
+	writel(0x02584099, SDRC_REG(MCFG_0));
+
+	/* SDRC_RFR_CTRL0 register */
+	writel(0x54601, SDRC_REG(RFR_CTRL_0));
+
+	/* SDRC_ACTIM_CTRLA0 register */
+	writel(0xA29DB4C6, SDRC_REG(ACTIM_CTRLA_0));
+
+	/* SDRC_ACTIM_CTRLB0 register */
+	writel(0x12214, SDRC_REG(ACTIM_CTRLB_0));
+
+	/* Disble Power Down of CKE due to 1 CKE on combo part */
+	writel(0x00000081, SDRC_REG(POWER));
+
+	/* SDRC_MANUAL command register */
+	/* NOP command */
+	writel(0x00000000, SDRC_REG(MANUAL_0));
+	/* Precharge command */
+	writel(0x00000001, SDRC_REG(MANUAL_0));
+	/* Auto-refresh command */
+	writel(0x00000002, SDRC_REG(MANUAL_0));
+	/* Auto-refresh command */
+	writel(0x00000002, SDRC_REG(MANUAL_0));
+
+	/* SDRC MR0 register Burst length=4 */
+	writel(0x00000032, SDRC_REG(MR_0));
+
+	/* SDRC DLLA control register */
+	writel(0x0000000A, SDRC_REG(DLLA_CTRL));
+
+	return;
+}
+
+/**
+ * @brief Do the necessary pin muxing required for OMAP3EVM. Some pins in OMAP3
+ * do not have alternate modes. We don't program these pins.
+ *
+ * See @ref MUX_VAL for description of the muxing mode.
+ *
+ * @return void
+ */
+static void mux_config(void)
+{
+	/*
+	 * SDRC
+	 * - SDRC_D0-SDRC_D31: Default MUX mode is mode0.
+	 */
+
+	/*
+	 * GPMC
+	 * - GPMC_D0-GPMC_D7: Default MUX mode is mode0.
+	 * - GPMC_NADV_ALE: Default MUX mode is mode0.
+	 * - GPMC_NOE: Default MUX mode is mode0.
+	 * - GPMC_NWE: Default MUX mode is mode0.
+	 * - GPMC_WAIT0: Default MUX mode is mode0.
+	 */
+	MUX_VAL(CP(GPMC_A1),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A2),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A3),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A4),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A5),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A6),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A7),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A8),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A9),		(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_A10),		(IDIS | PTD | DIS | M0));
+
+	MUX_VAL(CP(GPMC_D8),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_D9),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_D10),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_D11),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_D12),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_D13),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_D14),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_D15),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_CLK),		(IDIS | PTD | DIS | M0));
+
+	MUX_VAL(CP(GPMC_NBE0_CLE),	(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_NBE1),		(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(GPMC_NWP),		(IEN  | PTD | DIS | M0));
+
+	MUX_VAL(CP(GPMC_WAIT1),		(IEN  | PTU | EN  | M0));
+
+	/*
+	 * Serial Interface
+	 */
+	MUX_VAL(CP(UART3_CTS_RCTX),	(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(UART3_RTS_SD),	(IDIS | PTD | DIS | M0));
+	MUX_VAL(CP(UART3_RX_IRRX),	(IEN  | PTD | DIS | M0));
+	MUX_VAL(CP(UART3_TX_IRTX),	(IDIS | PTD | DIS | M0));
+
+	/*GPMC*/
+	MUX_VAL(CP(GPMC_A1),		(IDIS | PTU | EN  | M0));
+	MUX_VAL(CP(GPMC_A2),		(IDIS | PTU | EN  | M0));
+	MUX_VAL(CP(GPMC_A3),		(IDIS | PTU | EN  | M0));
+	MUX_VAL(CP(GPMC_A4),		(IDIS | PTU | EN  | M0));
+	MUX_VAL(CP(GPMC_A5),		(IDIS | PTU | EN  | M0)); /*GPMC_A5*/
+	MUX_VAL(CP(GPMC_A6),		(IDIS | PTU | EN  | M0)); /*GPMC_A6*/
+	MUX_VAL(CP(GPMC_A7),		(IDIS | PTU | EN  | M0)); /*GPMC_A7*/
+	MUX_VAL(CP(GPMC_A8),		(IDIS | PTU | EN  | M0)); /*GPMC_A8*/
+	MUX_VAL(CP(GPMC_A9),		(IDIS | PTU | EN  | M0)); /*GPMC_A9*/
+	MUX_VAL(CP(GPMC_A10),		(IDIS | PTU | EN  | M0)); /*GPMC_A10*/
+	MUX_VAL(CP(GPMC_D0),		(IEN  | PTU | EN  | M0)); /*GPMC_D0*/
+	MUX_VAL(CP(GPMC_D1),		(IEN  | PTU | EN  | M0)); /*GPMC_D1*/
+	MUX_VAL(CP(GPMC_D2),		(IEN  | PTU | EN  | M0)); /*GPMC_D2*/
+	MUX_VAL(CP(GPMC_D3),		(IEN  | PTU | EN  | M0)); /*GPMC_D3*/
+	MUX_VAL(CP(GPMC_D4),		(IEN  | PTU | EN  | M0)); /*GPMC_D4*/
+	MUX_VAL(CP(GPMC_D5),		(IEN  | PTU | EN  | M0)); /*GPMC_D5*/
+	MUX_VAL(CP(GPMC_D6),		(IEN  | PTU | EN  | M0)); /*GPMC_D6*/
+	MUX_VAL(CP(GPMC_D7),		(IEN  | PTU | EN  | M0)); /*GPMC_D7*/
+	MUX_VAL(CP(GPMC_D8),		(IEN  | PTU | EN  | M0)); /*GPMC_D8*/
+	MUX_VAL(CP(GPMC_D9),		(IEN  | PTU | EN  | M0)); /*GPMC_D9*/
+	MUX_VAL(CP(GPMC_D10),		(IEN  | PTU | EN  | M0)); /*GPMC_D10*/
+	MUX_VAL(CP(GPMC_D11),		(IEN  | PTU | EN  | M0)); /*GPMC_D11*/
+	MUX_VAL(CP(GPMC_D12),		(IEN  | PTU | EN  | M0)); /*GPMC_D12*/
+	MUX_VAL(CP(GPMC_D13),		(IEN  | PTU | EN  | M0)); /*GPMC_D13*/
+	MUX_VAL(CP(GPMC_D14),		(IEN  | PTU | EN  | M0)); /*GPMC_D14*/
+	MUX_VAL(CP(GPMC_D15),		(IEN  | PTU | EN  | M0)); /*GPMC_D15*/
+	MUX_VAL(CP(GPMC_NCS0),		(IDIS | PTU | EN  | M0)); /*GPMC_nCS0*/
+	MUX_VAL(CP(GPMC_NCS1),		(IDIS | PTU | EN  | M0)); /*GPMC_nCS1*/
+	MUX_VAL(CP(GPMC_NCS2),		(IDIS | PTU | EN  | M0)); /*GPMC_nCS2*/
+	MUX_VAL(CP(GPMC_NCS3),		(IEN  | PTU | EN  | M4)); /*GPIO_54*/
+	MUX_VAL(CP(GPMC_NCS4),		(IDIS | PTU | EN  | M0)); /*GPMC_nCS4*/
+	MUX_VAL(CP(GPMC_NCS5),		(IDIS | PTU | EN  | M0)); /*GPMC_nCS5*/
+	MUX_VAL(CP(GPMC_NCS6),		(IDIS | PTD | EN  | M4)); /*ETH_FIFO_SEL*/
+	MUX_VAL(CP(GPMC_NCS7),		(IEN  | PTU | EN  | M0)); /*GPMC_nCS7*/
+	MUX_VAL(CP(GPMC_NBE1),		(IEN  | PTD | DIS | M0)); /*GPMC_nCS3*/
+	MUX_VAL(CP(GPMC_CLK),		(IDIS | PTU | EN  | M0)); /*GPMC_CLK*/
+	MUX_VAL(CP(GPMC_NADV_ALE),	(IDIS | PTD | DIS | M0)); /*GPMC_nADV_ALE*/
+	MUX_VAL(CP(GPMC_NOE),		(IDIS | PTD | DIS | M0)); /*GPMC_nOE*/
+	MUX_VAL(CP(GPMC_NWE),		(IDIS | PTD | DIS | M0)); /*GPMC_nWE*/
+	MUX_VAL(CP(GPMC_NBE0_CLE),	(IDIS | PTD | DIS | M0)); /*GPMC_nBE0_CLE*/
+	MUX_VAL(CP(GPMC_NWP),		(IEN  | PTD | DIS | M0)); /*GPMC_nWP*/
+	MUX_VAL(CP(GPMC_WAIT0),		(IEN  | PTU | EN  | M0)); /*GPMC_WAIT0*/
+	MUX_VAL(CP(GPMC_WAIT1),		(IEN  | PTU | EN  | M0)); /*GPMC_WAIT1*/
+	MUX_VAL(CP(GPMC_WAIT2),		(IEN  | PTU | EN  | M4)); /*GPIO_64*/
+	MUX_VAL(CP(GPMC_WAIT3),		(IEN  | PTU | EN  | M0)); /*GPMC_nCS3*/
+}
+
+/**
+ * @brief The basic entry point for board initialization.
+ *
+ * This is called as part of machine init (after arch init).
+ * This is again called with stack in SRAM, so not too many
+ * constructs possible here.
+ *
+ * @return void
+ */
+void board_init(void)
+{
+	int in_sdram = running_in_sdram();
+
+	mux_config();
+	/* Dont reconfigure SDRAM while running in SDRAM! */
+	if (!in_sdram)
+		sdrc_init();
+}
+
+/*
+ * Run-time initialization(s)
+ */
+
+#ifdef CONFIG_DRIVER_SERIAL_NS16550
+
+static struct NS16550_plat serial_plat = {
+	.clock		= 48000000,      /* 48MHz (APLL96/2) */
+	.f_caps		= CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR,
+	.reg_read	= omap_uart_read,
+	.reg_write	= omap_uart_write,
+};
+
+static struct device_d omap3_pca102_serial_device = {
+	.name		= "serial_ns16550",
+	.map_base	= OMAP_UART3_BASE,
+	.size		= 1024,
+	.platform_data	= (void *)&serial_plat,
+};
+
+/**
+ * @brief Initialize the serial port to be used as console.
+ *
+ * @return result of device registration
+ */
+static int omap3_pca102_init_console(void)
+{
+	return register_device(&omap3_pca102_serial_device);
+}
+console_initcall(omap3_pca102_init_console);
+#endif /* CONFIG_DRIVER_SERIAL_NS16550 */
+
+/*
+ * SMSC 9221 network controller
+ * connected to CS line 5 and interrupt line
+ * GPIO177, data width is 16 bit
+ */
+static struct device_d network_dev = {
+	.name	= "smc911x",
+	.map_base = SMC911X_BASE,
+	.size	= GPMC_SIZE_16M,      /* area size */
+};
+
+static struct memory_platform_data sram_pdata0 = {
+	.name	= "ram0",
+	.flags	= DEVFS_RDWR,
+};
+
+static struct memory_platform_data sram_pdata1 = {
+	.name	= "ram1",
+	.flags	= DEVFS_RDWR,
+};
+
+static struct device_d sdram_dev0 = {
+	.name		= "mem",
+	.map_base	= 0x80000000,
+	.size		= 128 * 1024 * 1024,
+	.platform_data	= &sram_pdata0,
+};
+
+static struct device_d sdram_dev1 = {
+	.name		= "mem",
+	.map_base	= 0x88000000,
+	.size		= 128 * 1024 * 1024,
+	.platform_data	= &sram_pdata1,
+};
+
+/** GPMC timing for our SMSC9221 device */
+static struct gpmc_config smsc_cfg = {
+	.cfg = {
+	0x00001000,	/*CONF1 */
+	0x001e1e01,	/*CONF2 */
+	0x00080300,	/*CONF3 */
+	0x1c091c09,	/*CONF4 */
+	0x04181f1f,	/*CONF5 */
+	0x00000fcf,	/*CONF6 */
+},
+	.base = SMC911X_BASE,
+	/* GPMC address map as small as possible */
+	.size = GPMC_SIZE_16M,
+};
+
+/*
+ * Routine: setup_net_chip
+ * Description: Setting up the configuration GPMC registers specific to the
+ *            Ethernet hardware.
+ */
+static void setup_net_chip(void)
+{
+	gpmc_cs_config(5, &smsc_cfg);
+}
+
+static int omap3_pca102_init_devices(void)
+{
+#ifdef CONFIG_GPMC
+	/*
+	 * WP is made high and WAIT1 active Low
+	 */
+	gpmc_generic_init(0x10);
+#endif
+
+	register_device(&sdram_dev0);
+	register_device(&sdram_dev1);
+	setup_net_chip();
+	register_device(&network_dev);
+
+	armlinux_add_dram(&sdram_dev0);
+	armlinux_add_dram(&sdram_dev1);
+	armlinux_set_bootparams((void *)0x80000100);
+	armlinux_set_architecture(MACH_TYPE_PCA102);
+
+	return 0;
+}
+device_initcall(omap3_pca102_init_devices);
+
+static int omap3_pca102_late_init(void)
+{
+	struct device_d *nand;
+
+        gpmc_generic_nand_devices_init(0, 16, 0);
+
+	nand = get_device_by_name("nand0");
+
+	devfs_add_partition("nand0", 0x00000, 0x80000, PARTITION_FIXED, "x-loader");
+	dev_add_bb_dev("self_raw", "x_loader0");
+
+	devfs_add_partition("nand0", 0x80000, 0x1e0000, PARTITION_FIXED, "self_raw");
+	dev_add_bb_dev("self_raw", "self0");
+
+	devfs_add_partition("nand0", 0x260000, 0x20000, PARTITION_FIXED, "env_raw");
+	dev_add_bb_dev("env_raw", "env0");
+
+	return 0;
+}
+late_initcall(omap3_pca102_late_init);
Index: barebox-2010.10.0/arch/arm/boards/phyCARD-L/pca102.dox
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/boards/phyCARD-L/pca102.dox	2010-11-04 10:16:48.791232249 +0100
@@ -0,0 +1,16 @@
+/** @page PCA-102 Phytec's phyCARD-L (OMAP35xx)
+
+This CPU card is based on a Texas Instruments OMAP35xx CPU.
+The card is shipped with:
+
+- 256MiB DDR-RAM / 256MiB NAND Flash Memory
+- SMSC9221 ethernet controller
+- ISP1504 for USB-host interface
+- ISP1504 for USB-OTG interface
+- LVDS camera interface
+- LVDS display interface
+- TPS65023 Power-Managmanet IC
+- 4kB I2C EEPROM
+
+*/
+
Index: barebox-2010.10.0/arch/arm/boards/phyCARD-L/platform.S
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/boards/phyCARD-L/platform.S	2010-11-04 10:16:48.791232249 +0100
@@ -0,0 +1,65 @@
+/**
+ * @file
+ * @brief Wrapper to call board level initialization routine
+ *
+ * FileName: board/phyCARD-L/platform.S
+ *
+ * board_init_lowlevel is defined here. This calls board_init which
+ * is linked to the binary - the board_init only has a SRAM stack.
+ * so it needs to be careful about the usage of global variables
+ * and the likes. Enabled only if CONFIG_MACH_DO_LOWLEVEL_INIT is
+ * defined
+ */
+/*
+ * (C) Copyright 2006-2008
+ * Texas Instruments, <www.ti.com>
+ * Nishanth Menon <x0nishan@ti.com>
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <config.h>
+#include <mach/silicon.h>
+
+#ifdef CONFIG_MACH_DO_LOWLEVEL_INIT
+/**
+ * @fn void board_init_lowlevel(void)
+ *
+ * @brief This provides a assembly wrapper setting up SRAM before calling
+ * board_init
+ *
+ * @return void
+ */
+.globl board_init_lowlevel
+board_init_lowlevel:
+	/* Setup a temporary stack so that we can call C functions
+	 * Yes. this might have been already done by arch code.
+	 * No harm in being a bit redundant to avoid future complications
+	 */
+	ldr	sp,	SRAM_STACK
+        str     ip,	[sp]    /* stash old link register */
+        str     lr,	[sp]    /* stash current link register */
+	mov	ip,	lr	/* save link reg across call */
+	/* Do the pin muxes, sdram init etc..board-xxx.c */
+	bl	board_init
+        ldr     lr,	[sp]    /* restore current link register */
+        ldr     ip,	[sp]    /* restore save ip */
+	/* back to arch calling code */
+	mov	pc,	lr
+SRAM_STACK:
+	.word	OMAP_SRAM_STACK
+
+#endif /* CONFIG_MACH_DO_LOWLEVEL_INIT */
Index: barebox-2010.10.0/arch/arm/configs/pca102_defconfig
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ barebox-2010.10.0/arch/arm/configs/pca102_defconfig	2010-11-04 10:16:31.000000000 +0100
@@ -0,0 +1,256 @@
+#
+# Automatically generated make config: don't edit
+# Linux barebox version: 2010.10.0
+#
+# CONFIG_BOARD_LINKER_SCRIPT is not set
+CONFIG_GENERIC_LINKER_SCRIPT=y
+CONFIG_ARM=y
+
+#
+# System Type
+#
+# CONFIG_ARCH_AT91 is not set
+# CONFIG_ARCH_EP93XX is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_NOMADIK is not set
+CONFIG_ARCH_OMAP=y
+# CONFIG_ARCH_S3C24xx is not set
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_V7=y
+CONFIG_CPU_32v7=y
+
+#
+# processor features
+#
+CONFIG_BOARDINFO="Phytec phyCARD-L"
+
+#
+# OMAP Features
+#
+CONFIG_ARCH_OMAP3=y
+CONFIG_OMAP_CLOCK_ALL=y
+CONFIG_OMAP_CLOCK_SOURCE_S32K=y
+CONFIG_OMAP3_CLOCK_CONFIG=y
+# CONFIG_OMAP3_COPY_CLOCK_SRAM is not set
+CONFIG_GPMC=y
+CONFIG_GPIO=y
+
+#
+# OMAP Platform Features
+#
+# CONFIG_MACH_OMAP343xSDP is not set
+# CONFIG_MACH_BEAGLE is not set
+# CONFIG_MACH_OMAP3EVM is not set
+CONFIG_MACH_PCA102=y
+CONFIG_HAS_OMAP_NAND=y
+CONFIG_AEABI=y
+
+#
+# Arm specific settings
+#
+CONFIG_CMD_ARM_CPUINFO=y
+# CONFIG_CPU_V7_DCACHE_SKIP is not set
+# CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS is not set
+CONFIG_DEFCONFIG_LIST="$ARCH_DEFCONFIG"
+CONFIG_GREGORIAN_CALENDER=y
+CONFIG_HAS_KALLSYMS=y
+CONFIG_HAS_MODULES=y
+CONFIG_CMD_MEMORY=y
+CONFIG_ENV_HANDLING=y
+CONFIG_GENERIC_GPIO=y
+
+#
+# General Settings
+#
+CONFIG_LOCALVERSION_AUTO=y
+
+#
+# memory layout
+#
+CONFIG_HAVE_CONFIGURABLE_TEXT_BASE=y
+CONFIG_TEXT_BASE=0x87000000
+CONFIG_HAVE_CONFIGURABLE_MEMORY_LAYOUT=y
+CONFIG_MEMORY_LAYOUT_DEFAULT=y
+# CONFIG_MEMORY_LAYOUT_FIXED is not set
+CONFIG_STACK_SIZE=0x8000
+CONFIG_MALLOC_SIZE=0x1000000
+# CONFIG_BROKEN is not set
+CONFIG_EXPERIMENTAL=y
+# CONFIG_MODULES is not set
+CONFIG_MACH_HAS_LOWLEVEL_INIT=y
+CONFIG_MACH_DO_LOWLEVEL_INIT=y
+CONFIG_ARCH_HAS_LOWLEVEL_INIT=y
+CONFIG_PROMPT="phyCARD-L >"
+CONFIG_BAUDRATE=115200
+CONFIG_LONGHELP=y
+CONFIG_CBSIZE=1024
+CONFIG_MAXARGS=16
+CONFIG_SHELL_HUSH=y
+# CONFIG_SHELL_SIMPLE is not set
+CONFIG_GLOB=y
+CONFIG_PROMPT_HUSH_PS2="> "
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+CONFIG_DYNAMIC_CRC_TABLE=y
+CONFIG_ERRNO_MESSAGES=y
+CONFIG_TIMESTAMP=y
+CONFIG_CONSOLE_FULL=y
+CONFIG_CONSOLE_ACTIVATE_FIRST=y
+# CONFIG_OF_FLAT_TREE is not set
+CONFIG_PARTITION=y
+CONFIG_DEFAULT_ENVIRONMENT=y
+CONFIG_DEFAULT_ENVIRONMENT_PATH="defaultenv ./arch/arm/boards/phyCARD-L/env"
+
+#
+# Debugging
+#
+CONFIG_DEBUG_INFO=y
+CONFIG_ENABLE_FLASH_NOISE=y
+CONFIG_ENABLE_PARTITION_NOISE=y
+CONFIG_ENABLE_DEVICE_NOISE=y
+
+#
+# Commands
+#
+
+#
+# scripting
+#
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_LOADENV=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_TRUE=y
+CONFIG_CMD_FALSE=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENU_MANAGEMENT=y
+
+#
+# file commands
+#
+CONFIG_CMD_LS=y
+CONFIG_CMD_RM=y
+CONFIG_CMD_CAT=y
+CONFIG_CMD_MKDIR=y
+CONFIG_CMD_RMDIR=y
+CONFIG_CMD_CP=y
+CONFIG_CMD_PWD=y
+CONFIG_CMD_CD=y
+CONFIG_CMD_MOUNT=y
+CONFIG_CMD_UMOUNT=y
+
+#
+# console
+#
+CONFIG_CMD_CLEAR=y
+CONFIG_CMD_ECHO=y
+CONFIG_CMD_ECHO_E=y
+
+#
+# memory
+#
+CONFIG_CMD_LOADB=y
+# CONFIG_CMD_LOADY is not set
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_CRC=y
+CONFIG_CMD_MTEST=y
+CONFIG_CMD_MTEST_ALTERNATIVE=y
+
+#
+# flash
+#
+CONFIG_CMD_FLASH=y
+CONFIG_CMD_UBI=y
+
+#
+# booting
+#
+CONFIG_CMD_BOOTM=y
+# CONFIG_CMD_BOOTM_ZLIB is not set
+# CONFIG_CMD_BOOTM_BZLIB is not set
+CONFIG_CMD_BOOTM_SHOW_TYPE=y
+# CONFIG_CMD_BOOTZ is not set
+# CONFIG_CMD_BOOTU is not set
+# CONFIG_CMD_LINUX16 is not set
+CONFIG_CMD_RESET=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_TEST=y
+CONFIG_CMD_VERSION=y
+CONFIG_CMD_HELP=y
+CONFIG_CMD_DEVINFO=y
+# CONFIG_CMD_GPIO is not set
+CONFIG_CMD_UNLZO=y
+CONFIG_NET=y
+CONFIG_NET_DHCP=y
+CONFIG_NET_NFS=y
+CONFIG_NET_PING=y
+CONFIG_NET_TFTP=y
+CONFIG_NET_TFTP_PUSH=y
+CONFIG_NET_NETCONSOLE=y
+CONFIG_NET_RESOLV=y
+
+#
+# Drivers
+#
+
+#
+# serial drivers
+#
+# CONFIG_DRIVER_SERIAL_ARM_DCC is not set
+CONFIG_DRIVER_SERIAL_NS16550=y
+CONFIG_DRIVER_SERIAL_NS16550_OMAP_EXTENSIONS=y
+CONFIG_MIIDEV=y
+
+#
+# Network drivers
+#
+CONFIG_DRIVER_NET_SMC911X=y
+CONFIG_DRIVER_NET_SMC911X_ADDRESS_SHIFT=0
+# CONFIG_DRIVER_NET_SMC91111 is not set
+
+#
+# SPI drivers
+#
+# CONFIG_SPI is not set
+# CONFIG_I2C is not set
+
+#
+# flash drivers
+#
+# CONFIG_DRIVER_CFI is not set
+CONFIG_MTD=y
+CONFIG_NAND=y
+CONFIG_NAND_OMAP_GPMC=y
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+# CONFIG_MTD_NAND_ECC_SMC is not set
+CONFIG_MTD_NAND_IDS=y
+CONFIG_UBI=y
+# CONFIG_ATA is not set
+# CONFIG_USB is not set
+# CONFIG_USB_GADGET is not set
+# CONFIG_VIDEO is not set
+
+#
+# Filesystem support
+#
+# CONFIG_FS_CRAMFS is not set
+CONFIG_FS_RAMFS=y
+CONFIG_FS_DEVFS=y
+CONFIG_PARTITION_NEED_MTD=y
+CONFIG_CRC32=y
+CONFIG_CRC16=y
+# CONFIG_GENERIC_FIND_NEXT_BIT is not set
+CONFIG_PROCESS_ESCAPE_SEQUENCE=y
+CONFIG_LZO_DECOMPRESS=y
