summaryrefslogtreecommitdiffstats
path: root/board
diff options
context:
space:
mode:
authorIvo Clarysse <ivo.clarysse@gmail.com>2009-04-07 11:00:16 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-04-07 11:00:16 +0200
commit3ccfdfd9b97506638baf960f8c0bcdca740f7845 (patch)
treea97245c92952d655e47dc3f39bfabcd781dd1da3 /board
parentfcfbd10d3c09082275debdda9c9622e7f776791d (diff)
downloadbarebox-3ccfdfd9b97506638baf960f8c0bcdca740f7845.tar.gz
barebox-3ccfdfd9b97506638baf960f8c0bcdca740f7845.tar.xz
Add i.MX21ads support
Signed-off-by: Ivo Clarysse <ivo.clarysse@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'board')
-rw-r--r--board/imx21ads/Makefile2
-rw-r--r--board/imx21ads/config.h24
-rw-r--r--board/imx21ads/env/bin/init1
-rw-r--r--board/imx21ads/imx21ads.c146
-rw-r--r--board/imx21ads/imx21ads.dox5
-rw-r--r--board/imx21ads/lowlevel_init.S70
6 files changed, 248 insertions, 0 deletions
diff --git a/board/imx21ads/Makefile b/board/imx21ads/Makefile
new file mode 100644
index 0000000000..7993fdef8a
--- /dev/null
+++ b/board/imx21ads/Makefile
@@ -0,0 +1,2 @@
+obj-y += lowlevel_init.o
+obj-y += imx21ads.o
diff --git a/board/imx21ads/config.h b/board/imx21ads/config.h
new file mode 100644
index 0000000000..6ec1996a8b
--- /dev/null
+++ b/board/imx21ads/config.h
@@ -0,0 +1,24 @@
+/**
+ * @file
+ * @brief Global defintions for the ARM i.MX21 based imx21ads
+ *
+ * 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 __CONFIG_H
+#define __CONFIG_H
+
+#endif /* __CONFIG_H */
diff --git a/board/imx21ads/env/bin/init b/board/imx21ads/env/bin/init
new file mode 100644
index 0000000000..224a6b40be
--- /dev/null
+++ b/board/imx21ads/env/bin/init
@@ -0,0 +1 @@
+# Dummy Init environment script
diff --git a/board/imx21ads/imx21ads.c b/board/imx21ads/imx21ads.c
new file mode 100644
index 0000000000..be9b487cf8
--- /dev/null
+++ b/board/imx21ads/imx21ads.c
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2009 Ivo Clarysse
+ *
+ * Based on imx27ads.c,
+ * Copyright (C) 2007 Sascha Hauer, Pengutronix
+ *
+ * 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 <net.h>
+#include <cfi_flash.h>
+#include <init.h>
+#include <environment.h>
+#include <asm/arch/imx-regs.h>
+#include <asm/armlinux.h>
+#include <asm/io.h>
+#include <asm/arch/gpio.h>
+#include <partition.h>
+#include <fs.h>
+#include <fcntl.h>
+#include <asm/mach-types.h>
+#include <asm/arch/imx-nand.h>
+
+static struct device_d cfi_dev = {
+ .name = "cfi_flash",
+ .id = "nor0",
+
+ .map_base = 0xC8000000,
+ .size = 32 * 1024 * 1024,
+};
+
+static struct device_d sdram_dev = {
+ .name = "ram",
+ .id = "ram0",
+
+ .map_base = 0xc0000000,
+ .size = 64 * 1024 * 1024,
+
+ .type = DEVICE_TYPE_DRAM,
+};
+
+struct imx_nand_platform_data nand_info = {
+ .width = 1,
+ .hw_ecc = 1,
+};
+
+static struct device_d nand_dev = {
+ .name = "imx_nand",
+ .map_base = 0xDF003000,
+ .platform_data = &nand_info,
+};
+
+
+static int imx21ads_timing_init(void)
+{
+ u32 temp;
+
+ /* Configure External Interface Module */
+ /* CS0: burst flash */
+ CS0U = 0x00003E00;
+ CS0L = 0x00000E01;
+
+ /* CS1: Ethernet controller, external UART, memory-mapped I/O (16-bit) */
+ CS1U = 0x00002000;
+ CS1L = 0x11118501;
+
+ /* CS2: disable (not available, since CSD0 in use) */
+ CS2U = 0x0;
+ CS2L = 0x0;
+
+ /* CS3: disable */
+ CS3U = 0x0;
+ CS3L = 0x0;
+ /* CS4: disable */
+ CS4U = 0x0;
+ CS4L = 0x0;
+ /* CS5: disable */
+ CS5U = 0x0;
+ CS5L = 0x0;
+
+ temp = PCDR0;
+ temp &= ~0xF000;
+ temp |= 0xA000; /* Set NFC divider; 0xA yields 24.18MHz */
+ PCDR0 = temp;
+
+ return 0;
+}
+
+core_initcall(imx21ads_timing_init);
+
+static int mx21ads_devices_init(void)
+{
+ int i;
+ unsigned int mode[] = {
+ PE12_PF_UART1_TXD,
+ PE13_PF_UART1_RXD,
+ PE14_PF_UART1_CTS,
+ PE15_PF_UART1_RTS,
+ };
+
+ /* initizalize gpios */
+ for (i = 0; i < ARRAY_SIZE(mode); i++)
+ imx_gpio_mode(mode[i]);
+
+ register_device(&cfi_dev);
+ register_device(&sdram_dev);
+ register_device(&nand_dev);
+
+ armlinux_set_bootparams((void *)0xc0000100);
+ armlinux_set_architecture(MACH_TYPE_MX21ADS);
+
+ return 0;
+}
+
+device_initcall(mx21ads_devices_init);
+
+static struct device_d mx21ads_serial_device = {
+ .name = "imx_serial",
+ .id = "cs0",
+ .map_base = IMX_UART1_BASE,
+ .size = 4096,
+ .type = DEVICE_TYPE_CONSOLE,
+};
+
+static int mx21ads_console_init(void)
+{
+ register_device(&mx21ads_serial_device);
+ return 0;
+}
+
+console_initcall(mx21ads_console_init);
diff --git a/board/imx21ads/imx21ads.dox b/board/imx21ads/imx21ads.dox
new file mode 100644
index 0000000000..9f11ffaa6e
--- /dev/null
+++ b/board/imx21ads/imx21ads.dox
@@ -0,0 +1,5 @@
+/** @page imx21ads Freescale i.MX21ads
+
+This is the Freescale evaluation board for the i.MX21 Processor
+
+*/
diff --git a/board/imx21ads/lowlevel_init.S b/board/imx21ads/lowlevel_init.S
new file mode 100644
index 0000000000..ee3b0853ce
--- /dev/null
+++ b/board/imx21ads/lowlevel_init.S
@@ -0,0 +1,70 @@
+/*
+ * For clock initialization, see chapter 6 of the
+ * "i.MX21 Applications Processor Reference Manual, Rev. 3".
+ */
+
+#include <config.h>
+#include <asm/arch/imx-regs.h>
+
+#define writel(val, reg) \
+ ldr r0, =reg; \
+ ldr r1, =val; \
+ str r1, [r0];
+
+.macro sdram_init_mx21ads
+#if 0
+ /* Set precharge command */
+ writel(0x92120300, SDCTL0);
+
+ /* Issue Precharge all Command */
+ ldr r3, =0xC0200000;
+ ldr r2, [r3];
+
+ /* Set AutoRefresh command */
+ writel(0x92120300, SDCTL0);
+
+ /* Issue AutoRefresh command */
+ ldr r3, =0xC0000000;
+ ldr r2, [r3];
+ ldr r2, [r3];
+ ldr r2, [r3];
+ ldr r2, [r3];
+ ldr r2, [r3];
+ ldr r2, [r3];
+ ldr r2, [r3];
+ ldr r2, [r3];
+
+
+ /* Set Mode Register */
+ writel(0xB2120300, SDCTL0);
+#endif
+.endm
+
+.globl board_init_lowlevel
+board_init_lowlevel:
+
+ mov r10, lr
+
+ /* ahb lite ip interface */
+ writel(0x00040304, AIPI1_PSR0)
+ writel(0xFFFBFCFB, AIPI1_PSR1)
+ writel(0x00000000, AIPI2_PSR0)
+ writel(0xFFFFFFFF, AIPI2_PSR1)
+
+ /* Set MPLL to 266MHz */
+ writel(0x007B1C73, MPCTL0);
+ /* PLL 133MHz */
+ writel(0x17000607, CSCR);
+
+ /* skip sdram initialization if we run from ram */
+ /* (SDRAM is mapped from C0000000 to C3FFFFFF) */
+ cmp pc, #0xc0000000
+ bls 1f
+ cmp pc, #0xc8000000
+ bhi 1f
+
+ mov pc,r10
+1:
+ sdram_init_mx21ads
+
+ mov pc,r10