[U-Boot] [PATCH] Initial support for Nomadik 8815 development board

Alessandro Rubini rubini-list at gnudd.com
Thu Oct 30 16:20:46 CET 2008


The NMDK8815 board is distributed by ST Microelectornics.
This is the initial port, with basic infrastructure and
a working serial port.

Signed-off-by: Alessandro Rubini <rubini at unipv.it>
---
 MAINTAINERS                    |    5 +
 MAKEALL                        |    1 +
 Makefile                       |   11 ++
 board/nmdk8815/Makefile        |   53 ++++++
 board/nmdk8815/config.mk       |   26 +++
 board/nmdk8815/nmdk8815.c      |   79 +++++++++
 board/nmdk8815/platform.S      |  349 ++++++++++++++++++++++++++++++++++++++++
 board/nmdk8815/u-boot.lds      |   51 ++++++
 cpu/arm926ejs/nomadik/Makefile |   46 ++++++
 cpu/arm926ejs/nomadik/reset.S  |   27 +++
 cpu/arm926ejs/nomadik/timer.c  |  172 ++++++++++++++++++++
 include/configs/nmdk8815.h     |  187 +++++++++++++++++++++
 12 files changed, 1007 insertions(+), 0 deletions(-)
 create mode 100644 board/nmdk8815/Makefile
 create mode 100644 board/nmdk8815/config.mk
 create mode 100644 board/nmdk8815/nmdk8815.c
 create mode 100644 board/nmdk8815/platform.S
 create mode 100644 board/nmdk8815/u-boot.lds
 create mode 100644 cpu/arm926ejs/nomadik/Makefile
 create mode 100644 cpu/arm926ejs/nomadik/reset.S
 create mode 100644 cpu/arm926ejs/nomadik/timer.c
 create mode 100644 include/configs/nmdk8815.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 260c3e6..76438cc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -581,6 +581,11 @@ Stefan Roese <sr at denx.de>
 	pdnb3		xscale
 	scpu		xscale
 
+Alessandro Rubini <rubini at unipv.it>
+Nomadik Linux Team <STN_WMM_nomadik_linux at list.st.com>
+
+	nmdk8815	ARM926EJS (Nomadik 8815 Soc)
+
 Robert Schwebel <r.schwebel at pengutronix.de>
 
 	csb226		xscale
diff --git a/MAKEALL b/MAKEALL
index 1f56ac5..347fe73 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -487,6 +487,7 @@ LIST_ARM9="			\
 	mx1ads			\
 	mx1fs2			\
 	netstar			\
+	nmdk8815		\
 	omap1510inn		\
 	omap1610h2		\
 	omap1610inn		\
diff --git a/Makefile b/Makefile
index d6abb4d..c671602 100644
--- a/Makefile
+++ b/Makefile
@@ -2612,6 +2612,17 @@ mx1fs2_config	:	unconfig
 netstar_config:		unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm925t netstar
 
+nmdk8815_config \
+nmdk8815_onenand_config:     unconfig
+	@ > $(obj)include/config.h     
+	@if [ "$(findstring _onenand, $@)" ] ; then \
+		echo "#define CONFIG_BOOT_ONENAND" >> $(obj)include/config.h; \
+		$(XECHO) "... configured for OneNand Flash"; \
+	else \
+		$(XECHO) "... configured for Nand Flash"; \
+	fi
+	@./mkconfig -a nmdk8815 arm arm926ejs nmdk8815 NULL nomadik
+
 omap1510inn_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm925t omap1510inn
 
diff --git a/board/nmdk8815/Makefile b/board/nmdk8815/Makefile
new file mode 100644
index 0000000..50ff6dd
--- /dev/null
+++ b/board/nmdk8815/Makefile
@@ -0,0 +1,53 @@
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# (C) Copyright 2004
+# ARM Ltd.
+# Philippe Robin, <philippe.robin at arm.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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 $(TOPDIR)/config.mk
+
+CFLAGS += -D__I2C_ENHANCED -D__RELEASE -D__NOMADIK_I2C -D__STN_8815=10
+CFLAGS += -DSTN8815 -D__MMCI_HCL_ENHANCED -D__MMCI_HCL_ELEMENTARY
+LIB	= lib$(BOARD).a
+
+OBJS	:= nmdk8815.o
+SOBJS	:= platform.o
+
+$(LIB):	$(OBJS) $(SOBJS)
+	$(AR) crv $@ $^
+
+clean:
+	rm -f $(SOBJS) $(OBJS)
+
+distclean:	clean
+	rm -f $(LIB) core *.bak .depend
+
+#########################################################################
+
+.depend:	Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
+		$(CC) -M -g3 $(CPPFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+
+-include .depend
+
+#########################################################################
diff --git a/board/nmdk8815/config.mk b/board/nmdk8815/config.mk
new file mode 100644
index 0000000..590393b
--- /dev/null
+++ b/board/nmdk8815/config.mk
@@ -0,0 +1,26 @@
+# (C) Copyright 2007
+# STMicroelectronics, <www.st.com>
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+#
+# image should be loaded at 0x01000000
+#
+
+TEXT_BASE = 0x03F80000
diff --git a/board/nmdk8815/nmdk8815.c b/board/nmdk8815/nmdk8815.c
new file mode 100644
index 0000000..15fa0a3
--- /dev/null
+++ b/board/nmdk8815/nmdk8815.c
@@ -0,0 +1,79 @@
+/*
+ * (C) Copyright 2005
+ * STMicrolelctronics, <www.st.com>
+ *
+ * (C) Copyright 2004
+ * ARM Ltd.
+ * Philippe Robin, <philippe.robin at arm.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <linux/mtd/nand.h>
+
+
+
+#ifdef CONFIG_SHOW_BOOT_PROGRESS
+void show_boot_progress(int progress)
+{
+	printf("%i\n", progress);
+}
+#endif
+
+
+/*
+ * Miscellaneous platform dependent initialisations
+ */
+__u16 cpld_uart0 = 0x0100, uart0_value = 0;
+__u16 cpld_eth_reset = 0x6888, eth_reset_value = 0;
+
+int board_init(void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+	gd->bd->bi_arch_number = MACH_TYPE_NOMADIK;
+	gd->bd->bi_boot_params = 0x00000100;
+	*((volatile unsigned int *)(NOMADIK_GPIO1_BASE + 0x20)) = 0xC37800F0;
+	*((volatile unsigned int *)(NOMADIK_GPIO1_BASE + 0x24)) &= 0;
+	*((volatile unsigned int *)(NOMADIK_GPIO1_BASE + 0x28)) &= 0;
+	*((volatile unsigned int *)(NOMADIK_SRC_BASE)) |= 0x8000;
+
+	icache_enable();
+
+	return 0;
+}
+int misc_init_r(void)
+{
+	setenv("verify", "n");
+	return (0);
+}
+
+
+int dram_init(void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+
+	/* set dram bank start addr and size */
+	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
+	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+
+	gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
+	gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE;
+	return 0;
+}
diff --git a/board/nmdk8815/platform.S b/board/nmdk8815/platform.S
new file mode 100644
index 0000000..6153da2
--- /dev/null
+++ b/board/nmdk8815/platform.S
@@ -0,0 +1,349 @@
+/*
+ * Board specific setup info
+ *
+ * (C) Copyright 2004, ARM Ltd.
+ * Philippe Robin, <philippe.robin at arm.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <version.h>
+
+.globl lowlevel_init
+lowlevel_init:
+	/* Jump to the flash address */
+	ldr r0, =CFG_ONENAND_BASE
+
+	/* orr-ing makes it independent whether we boot from 0x0 
+	  or 0x30000000 */
+	/* This code is non-portable, relies on the knowledge that ip
+	   has to be updated */
+	orr ip, ip, r0  /* adjust return address of cpu_init_crit */
+	orr lr, lr, r0  /* adjust return address */
+	orr pc, pc, r0  /* jump to the normal address */
+	nop
+
+	/* Initialize PLL, Remap clear, FSMC, MPMC here! */
+	/* What about GPIO, CLCD and UART */
+
+	/* PLL Initialization */
+	/*Prog the PLL1 @ 266 MHz ==> SDRAM Clock = 100.8 MHz*/
+	ldr r0, =NOMADIK_SRC_BASE
+
+	ldr r1, =0x2B013502
+
+	str r1, [r0, #0x14]
+
+
+	/*Used to set all the timers clock to 2.4MHZ*/ 
+	ldr r1, =0x2AAAA004
+	str r1, [r0]
+
+	ldr r1, =0x10000000
+	str r1, [r0, #0x10]
+
+	/* FSMC setup ----  */
+	ldr r0, =NOMADIK_FSMC_BASE
+
+	ldr r1, =0x10DB		/* For 16-bit NOR flash */
+	str r1, [r0,#0x08]
+
+	ldr r1, =0x03333333 	/* For 16-bit NOR flash */
+	str r1, [r0, #0xc]
+
+	/* oneNAND setting */
+	ldr r1, =0x0000105B	/*BCR0 Prog control register*/
+	str r1, [r0]
+
+	ldr r1, =0x0A200551	/*BTR0 Prog timing register*/
+	str r1, [r0, #0x04]
+
+	/* preload the instructions into icache */
+	add r0, pc, #0x1F
+	bic r0, r0, #0x1F
+	mcr p15, 0, r0, c7, c13, 1
+	add r0, r0, #0x20
+	mcr p15, 0, r0, c7, c13, 1
+
+	/* Put the SDRAM under MPMC control */
+/*	ldr r0, =NOMADIK_SRC_BASE
+
+	ldr r1, =0x00000008
+	str r1, [r0,#0x9000]
+	
+*/
+
+	/* Now Clear Remap */
+	ldr r0, =NOMADIK_SRC_BASE
+
+	ldr r1, =0x2004
+	str r1, [r0]
+
+	ldr r1, =0x10000000
+	str r1, [r0,#0x10]
+
+	ldr r0,=0x101E9000
+	ldr r1, =0x2004
+	str r1, [r0]
+
+	ldr r0, =NOMADIK_SRC_BASE
+	ldr r1, =0x2104
+	str r1, [r0]
+
+	/* FSMC setup -- */
+	mov r0, #(NOMADIK_FSMC_BASE & 0x10000000)
+	orr r0, r0, #(NOMADIK_FSMC_BASE & 0x0FFFFFFF)
+
+	ldr r1, =0x10DB		/* For 16-bit NOR flash */
+	str r1, [r0, #0x8]
+
+	ldr r1, =0x03333333 	/* For 16-bit NOR flash */
+	str r1, [r0, #0xc]
+
+	
+
+	/* MPMC Setup */
+	ldr r0, =NOMADIK_MPMC_BASE
+
+	ldr r1, =0xF00003
+	str r1, [r0]		/* Enable the MPMC and the DLL*/
+
+	ldr r1, =0x183
+	str r1, [r0, #0x20]
+
+	ldr r2, =NOMADIK_PMU_BASE
+
+	ldr r1, =0x1111
+	str r1, [r2]
+
+	ldr r1, =0x1111		/* Prog the, mand delay strategy*/
+	str r1, [r0, #0x28]
+
+	ldr r1, =0x103		/* NOP ,mand */
+	str r1, [r0, #0x20]
+
+	/* FIXME -- Wait required here */
+
+	ldr r1, =0x103		/* PALL ,mand*/
+	str r1, [r0, #0x20]
+
+	ldr r1, =0x1
+	str r1, [r0, #0x24]	/* To do at least two auto-refresh*/
+
+	/* FIXME -- Wait required here */
+
+	ldr r1, =0x31
+	str r1, [r0, #0x24]	/* Prog the Auto-refresh period = 7.8µs @ SDRAM Clock = 100.8 MHz*/
+	
+	ldr r1, =0x0
+	str r1,	[r0, #0x8]		/*Prog Little Endian, Not defined in 8800 board*/
+
+
+	ldr r1, =0x2
+	str r1, [r0, #0x30]		/*Prog tRP timing*/
+
+	ldr r1, =0x4			/* Change for 8815 */
+	str r1, [r0, #0x34]		/*Prog tRAS timing*/
+
+	ldr r1, =0xB
+	str r1, [r0, #0x38]		/*Prog tSREX timing*/
+
+
+	ldr r1, =0x1
+	str r1, [r0, #0x44]		/*Prog tWR timing */
+
+	ldr r1, =0x8
+	str r1, [r0, #0x48]		/* Prog tRC timing*/
+
+	ldr r1, =0xA
+	str r1, [r0, #0x4C]		/*Prog tRFC timing*/
+
+	ldr r1, =0xB
+	str r1, [r0, #0x50]		/*Prog tXSR timing*/
+
+	ldr r1, =0x1
+	str r1, [r0, #0x54]		/*Prog tRRD timing*/
+
+	ldr r1, =0x1
+	str r1, [r0, #0x58]		/*Prog tMRD timing*/
+
+	ldr r1, =0x1
+	str r1, [r0, #0x5C]		/*Prog tCDLR timing*/
+
+	/*DDR-SDRAM MEMORY IS ON BANK0* 8815/
+	ldr r1, =0x304			/*Prog RAS and CAS for Chip Select 0*/
+	str r1, [r0, #0x104]
+
+	/*SDR-SDRAM MEMORY IS ON BANK1 8815*/
+	ldr r1, =0x304			/*Prog RAS and CAS for Chip Select 1*/
+	str r1, [r0, #0x124]
+	/*THE DATA BUS WIDE IS PROGRAM FOR 16-BITS*/
+	/* DDR-SDRAM MEMORY IS ON BANK0*/
+
+	ldr r1, =0x884			/*8815 : Prog config register in BRC for Chip Select 0*/
+	str r1, [r0, #0x100]
+
+	/*SDR-SDRAM MEMORY IS ON BANK1*/
+
+	ldr r1, =0x884			/* 8815 : Prog config register in BRC for Chip Select 1*/
+	str r1, [r0, #0x120]
+
+	ldr r1, =0x83			/*MODE Mand*/
+	str r1, [r0, #0x20]
+
+	/*HERE, PROGRAM LOAD MODE REGISTER FOR 2 bursts of 16 bits, with DDR memory ON BANK0  */
+	
+	ldr r1, =0x62000			/*Data in*/
+	ldr r1, [r1]
+	
+	/*HERE, PROGRAM LOAD MODE REGISTER FOR 2 bursts of 16 bits, with DDR memory ON BANK1  */
+
+	ldr r1, =0x8062000
+	ldr r1, [r1]
+
+	ldr r1, =0x003			/* NORMAL ,mand and prog CE always high*/
+	str r1, [r0, #0x20]
+
+	/* ENABLE ALL THE BUFFER FOR EACH AHB PORT*/
+	
+	ldr r1, =0x01			/*Enable buffer 0*/
+	str r1, [r0, #0x400]
+
+	ldr r1, =0x01			/*Enable buffer 1*/
+	str r1, [r0, #0x420]
+
+	ldr r1, =0x01			/*Enable buffer 2*/
+	str r1, [r0, #0x440]
+
+	ldr r1, =0x01			/*Enable buffer 3*/
+	str r1, [r0, #0x460]
+
+	ldr r1, =0x01			/*Enable buffer 4*/
+	str r1, [r0, #0x480]
+
+	ldr r1, =0x01			/*Enable buffer 5*/
+	str r1, [r0, #0x4A0]
+
+	/* GPIO settings */
+
+	ldr r0, =NOMADIK_GPIO1_BASE
+
+	ldr r1, =0xC0600000
+	str r1, [r0, #0x20]
+
+	ldr r1, =0x3F9FFFFF //ABHI change this for uart1
+	str r1, [r0, #0x24]
+
+	ldr r1, =0x3F9FFFFF  //ABHI change this for uart1
+	str r1, [r0, #0x28]
+
+	ldr r0, =NOMADIK_GPIO0_BASE
+
+	ldr r1, =0xFFFFFFFF
+	str r1, [r0, #0x20]
+
+	ldr r1, =0x00
+	str r1, [r0, #0x24]
+
+	ldr r1, =0x00
+	str r1, [r0, #0x28]
+
+/*Configure CPLD_CTRL register for enabling MUX logic for UART0/UART2*/
+	
+	ldr r0, =NOMADIK_FSMC_BASE
+	
+	ldr r1,=0x10DB			/*INIT FSMC bank 0*/
+	str r1, [r0, #0x00]
+
+	ldr r1,=0x0FFFFFFF
+	str r1, [r0, #0x04]
+
+	ldr r1,=0x010DB		/*INIT FSMC bank 1*/
+	str r1, [r0, #0x08]
+
+	ldr r1,=0x00FFFFFFF
+	str r1, [r0, #0x0C]
+
+	ldr r0,=NOMADIK_UART0_BASE
+	
+	ldr r1,=0x00000000
+	str r1,[r0,#0x30]
+	
+	ldr r1,=0x0000004e
+	str r1,[r0,#0x24]
+	
+	ldr r1,=0x00000008
+	str r1,[r0,#0x28]
+	
+	ldr r1,=0x00000060
+	str r1,[r0,#0x2C]
+	
+	ldr r1,=0x00000301
+	str r1,[r0,#0x30]
+		
+	ldr r1,=0x00000066
+	str r1,[r0]
+	
+
+	ldr r0,=NOMADIK_UART1_BASE
+
+	ldr r1,=0x00000000
+	str r1,[r0,#0x30]
+	
+	ldr r1,=0x0000004e
+	str r1,[r0,#0x24]
+	
+	ldr r1,=0x00000008
+	str r1,[r0,#0x28]
+	
+	ldr r1,=0x00000060
+	str r1,[r0,#0x2C]
+	
+	ldr r1,=0x00000301
+	str r1,[r0,#0x30]
+		
+	ldr r1,=0x00000066
+	str r1,[r0]
+	
+	ldr r0,=NOMADIK_UART2_BASE
+
+	ldr r1,=0x00000000
+	str r1,[r0,#0x30]
+	
+	ldr r1,=0x0000004e
+	str r1,[r0,#0x24]
+	
+	ldr r1,=0x00000008
+	str r1,[r0,#0x28]
+	
+	ldr r1,=0x00000060
+	str r1,[r0,#0x2C]
+	
+	ldr r1,=0x00000301
+	str r1,[r0,#0x30]
+		
+	ldr r1,=0x00000066
+	str r1,[r0]
+	
+	/*Configure CPLD to enable UART0*/
+
+
+	mov pc, lr
+
diff --git a/board/nmdk8815/u-boot.lds b/board/nmdk8815/u-boot.lds
new file mode 100644
index 0000000..eee4813
--- /dev/null
+++ b/board/nmdk8815/u-boot.lds
@@ -0,0 +1,51 @@
+/*
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <gj at denx.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+SECTIONS
+{
+	. = 0x00000000;
+	. = ALIGN(4);
+	.text	:
+	{
+	  cpu/arm926ejs/start.o	(.text)
+	  *(.text)
+	}
+	. = ALIGN(4);
+	.rodata : { *(.rodata) }
+	. = ALIGN(4);
+	.data : { *(.data) }
+	. = ALIGN(4);
+	.got : { *(.got) }
+
+	__u_boot_cmd_start = .;
+	.u_boot_cmd : { *(.u_boot_cmd) }
+	__u_boot_cmd_end = .;
+
+	. = ALIGN(4);
+	__bss_start = .;
+	.bss : { *(.bss) }
+	_end = .;
+}
diff --git a/cpu/arm926ejs/nomadik/Makefile b/cpu/arm926ejs/nomadik/Makefile
new file mode 100644
index 0000000..e3bd2ee
--- /dev/null
+++ b/cpu/arm926ejs/nomadik/Makefile
@@ -0,0 +1,46 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).a
+
+COBJS	= timer.o
+SOBJS	= reset.o
+
+SRCS	:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(COBJS)) $(addprefix $(obj),$(SOBJS))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(AR) $(ARFLAGS) $@ $(OBJS)
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/cpu/arm926ejs/nomadik/reset.S b/cpu/arm926ejs/nomadik/reset.S
new file mode 100644
index 0000000..522a817
--- /dev/null
+++ b/cpu/arm926ejs/nomadik/reset.S
@@ -0,0 +1,27 @@
+#include <config.h>
+/*
+ * Processor reset for Nomadik
+ */
+
+        .align  5
+.globl reset_cpu
+reset_cpu:
+#if defined CONFIG_NOMADIK_8815
+        ldr r0, =NOMADIK_SRC_BASE
+        ldr r1, =0x1
+        str r1, [r0, #0x18]
+#else
+        ldr     r1, rstctl1     /* get clkm1 reset ctl */
+        mov     r3, #0x0
+        strh    r3, [r1]        /* clear it */
+        mov     r3, #0x8
+        strh    r3, [r1]        /* force dsp+arm reset */
+#endif
+_loop_forever:
+        b       _loop_forever
+
+
+rstctl1:
+        .word   0xfffece10
+
+
diff --git a/cpu/arm926ejs/nomadik/timer.c b/cpu/arm926ejs/nomadik/timer.c
new file mode 100644
index 0000000..68b9217
--- /dev/null
+++ b/cpu/arm926ejs/nomadik/timer.c
@@ -0,0 +1,172 @@
+/*
+ * (C) Copyright 2003
+ * Texas Instruments <www.ti.com>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Marius Groeger <mgroeger at sysgo.de>
+ *
+ * (C) Copyright 2002
+ * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Alex Zuepke <azu at sysgo.de>
+ *
+ * (C) Copyright 2002-2004
+ * Gary Jennejohn, DENX Software Engineering, <gj at denx.de>
+ *
+ * (C) Copyright 2004
+ * Philippe Robin, ARM Ltd. <philippe.robin at arm.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <arm926ejs.h>
+
+
+extern void reset_cpu(ulong addr);
+#define TIMER_LOAD_VAL 0xffffffff
+
+/* macro to read the 32 bit timer */
+#define READ_TIMER (*(volatile ulong *)(CONFIG_SYS_TIMERBASE+20))
+
+static ulong timestamp;
+static ulong lastdec;
+
+/* nothing really to do with interrupts, just starts up a counter. */
+int timer_init (void)
+{
+	/* Load timer with initial value */
+	*(volatile ulong *)(CONFIG_SYS_TIMERBASE + 16) = TIMER_LOAD_VAL;
+	/* Set timer to be enabled, free-running, no interrupts, 256 divider,
+	  32-bit, wrap-mode */
+	*(volatile ulong *)(CONFIG_SYS_TIMERBASE + 24) = 0x8A;
+	/* init the timestamp and lastdec value */
+	reset_timer_masked();
+	return 0;
+}
+
+/*
+ * timer without interrupts
+ */
+void reset_timer (void)
+{
+	reset_timer_masked ();
+}
+
+ulong get_timer (ulong base)
+{
+	return get_timer_masked () - base;
+}
+
+void set_timer (ulong t)
+{
+	timestamp = t;
+}
+
+/* delay x useconds AND perserve advance timstamp value */
+void udelay (unsigned long usec)
+{
+	ulong tmo, tmp;
+
+	if(usec >= 1000){               /* if "big" number, spread normalization to seconds */
+		tmo = usec / 1000;      /* start to normalize for usec to ticks per sec */
+		tmo *= CONFIG_SYS_HZ;   /* find number of "ticks" to wait to achieve target */
+		tmo /= 1000;            /* finish normalize. */
+	}else{                          /* else small number, don't kill it prior to HZ multiply */
+		tmo = usec * CONFIG_SYS_HZ;
+		tmo /= (1000*1000);
+	}
+
+	tmp = get_timer (0);		/* get current timestamp */
+	if( (tmo + tmp + 1) < tmp ) 	/* if setting this fordward will roll time stamp */
+		reset_timer_masked ();	/* reset "advancing" timestamp to 0, set lastdec value */
+	else
+		tmo += tmp;		/* else, set advancing stamp wake up time */
+
+	while (get_timer_masked () < tmo)/* loop till event */
+		/*NOP*/;
+}
+
+void reset_timer_masked (void)
+{
+	/* reset time */
+	lastdec = READ_TIMER;  /* capure current decrementer value time */
+	timestamp = 0;         /* start "advancing" time stamp from 0 */
+}
+
+ulong get_timer_masked (void)
+{
+	ulong now = READ_TIMER;		/* current tick value */
+
+	if (lastdec >= now) {		/* normal mode (non roll) */
+		/* normal mode */
+		timestamp += lastdec - now; /* move stamp fordward with absoulte diff ticks */
+	} else {			/* we have overflow of the count down timer */
+		/* nts = ts + ld + (TLV - now)
+		 * ts=old stamp, ld=time that passed before passing through -1
+		 * (TLV-now) amount of time after passing though -1
+		 * nts = new "advancing time stamp"...it could also roll and cause problems.
+		 */
+		timestamp += lastdec + TIMER_LOAD_VAL - now;
+	}
+	lastdec = now;
+
+	return timestamp;
+}
+
+/* waits specified delay value and resets timestamp */
+void udelay_masked (unsigned long usec)
+{
+	ulong tmo;
+
+	if(usec >= 1000){               /* if "big" number, spread normalization to seconds */
+		tmo = usec / 1000;      /* start to normalize for usec to ticks per sec */
+		tmo *= CONFIG_SYS_HZ;	/* find number of "ticks" to wait to achieve target */
+		tmo /= 1000;            /* finish normalize. */
+	}else{                          /* else small number, don't kill it prior to HZ multiply */
+		tmo = usec * CONFIG_SYS_HZ;
+		tmo /= (1000*1000);
+	}
+
+	reset_timer_masked ();	/* set "advancing" timestamp to 0, set lastdec vaule */
+
+	while (get_timer_masked () < tmo) /* wait for time stamp to overtake tick number.*/
+		/*NOP*/;
+}
+
+/*
+ * This function is derived from PowerPC code (read timebase as long long).
+ * On ARM it just returns the timer value.
+ */
+unsigned long long get_ticks(void)
+{
+	return get_timer(0);
+}
+
+/*
+ * This function is derived from PowerPC code (timebase clock frequency).
+ * On ARM it returns the number of timer ticks per second.
+ */
+ulong get_tbclk (void)
+{
+	ulong tbclk;
+
+	tbclk = CONFIG_SYS_HZ;
+	return tbclk;
+}
diff --git a/include/configs/nmdk8815.h b/include/configs/nmdk8815.h
new file mode 100644
index 0000000..7d38c9d
--- /dev/null
+++ b/include/configs/nmdk8815.h
@@ -0,0 +1,187 @@
+/*
+ * (C) Copyright 2005
+ * STMicroelectronics.
+ * Configuration settings for the STn8815 nomadik board.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+
+#define CONFIG_ARM926EJS
+#define CONFIG_NOMADIK
+#define CONFIG_NOMADIK_8815
+#define CONFIG_NOMADIK_NDK15
+#define CONFIG_NOMADIK_NHK15
+
+#define CONFIG_SKIP_LOWLEVEL_INIT /* we have already been loaded to RAM */
+
+/* commands */
+#include <config_cmd_default.h>
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+/* At this point there is no flash driver, so remove some commands */
+#undef CONFIG_CMD_ENV
+#undef CONFIG_CMD_FLASH
+#undef CONFIG_CMD_IMLS
+
+/* user interface */
+#define CONFIG_SYS_LONGHELP
+#define CONFIG_SYS__HUSH_PARSER
+#define CONFIG_SYS_PROMPT		"Nomadik> "
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
+#define CONFIG_SYS_CBSIZE		256	/* Console I/O Buffer Size  */
+#define CONFIG_SYS_PBSIZE   (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
+#define CONFIG_SYS_BARGSIZE  CONFIG_SYS_CBSIZE /* Boot Argument Buffer Size */
+#define CONFIG_SYS_MAXARGS	16
+#define CONFIG_SYS_LOAD_ADDR	0x800000	/* default load address */
+#define CONFIG_SYS_LOADS_BAUD_CHANGE
+
+/* boot config */
+#define CONFIG_SETUP_MEMORY_TAGS 
+#define CONFIG_INITRD_TAG
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_BOOTDELAY	1
+#define CONFIG_BOOTARGS	"root=/dev/ram0 console=ttyAMA1,115200n8 init=linuxrc"
+#define CONFIG_BOOTCOMMAND	"fsload 0x100000 kernel.uimg;" \
+				" fsload 0x800000 initrd.gz.uimg;" \
+				" bootm 0x100000 0x800000"
+
+/* memory-related information */
+#define CONFIG_NR_DRAM_BANKS	2
+#define PHYS_SDRAM_1            0x00000000	/* DDR-SDRAM Bank #1 */
+#define PHYS_SDRAM_1_SIZE	0x04000000	/* 64 MB */
+#define PHYS_SDRAM_2		0x08000000	/* SDR-SDRAM BANK #2*/
+#define PHYS_SDRAM_2_SIZE	0x04000000	/* 64 MB */
+
+#define CONFIG_STACKSIZE	(128*1024)	/* regular stack */
+#ifdef CONFIG_USE_IRQ
+#  define CONFIG_STACKSIZE_IRQ	(4*1024)	/* IRQ stack */
+#  define CONFIG_STACKSIZE_FIQ	(4*1024)	/* FIQ stack */
+#endif
+
+#define CONFIG_SYS_MEMTEST_START	0x00000000
+#define CONFIG_SYS_MEMTEST_END		0x0FFFFFFF
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 256*1024)
+#define CONFIG_SYS_GBL_DATA_SIZE	128	/* for initial data */
+
+#define CONFIG_MISC_INIT_R	/* call misc_init_r during start up */
+
+/* timing informazion */
+#define CONFIG_SYS_HZ		(2400000 / 256)	/* Timer0: 2.4Mhz + divider */
+#define CONFIG_SYS_TIMERBASE	0x101E2000
+#undef	CONFIG_SYS_CLKS_IN_HZ
+
+/* serial port (PL011) configuration */
+#define CONFIG_PL011_SERIAL
+#define CONFIG_CONS_INDEX	1
+#define CONFIG_BAUDRATE        	115200 
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
+#define CFG_SERIAL0		0x101FD000
+#define CFG_SERIAL1		0x101FB000
+
+#define CONFIG_PL01x_PORTS	{ (void *)CFG_SERIAL0, (void *)CFG_SERIAL1 }
+#define CONFIG_PL011_CLOCK	48000000 
+
+/* Ethernet */
+#define PCI_MEMORY_VADDR        0xe8000000
+#define PCI_IO_VADDR            0xee000000
+#define __io(a)                 ((void __iomem *)(PCI_IO_VADDR + (a)))
+#define __mem_isa(a)            ((a) + PCI_MEMORY_VADDR)
+
+#define CONFIG_DRIVER_SMC91111	/* Using SMC91c111*/
+#define CONFIG_SMC91111_BASE	0x34000300
+#undef  CONFIG_SMC91111_EXT_PHY	/* Internal PHY */
+#define CONFIG_SMC_USE_32_BIT
+#define CONFIG_BOOTFILE		"uImage"
+
+/* flash memory and filesystem information */
+#define CONFIG_DOS_PARTITION
+#define CONFIG_MTD_ONENAND_VERIFY_WRITE
+#define CONFIG_SYS_ONENAND_BASE		0x30000000
+#define CONFIG_SYS_MAX_NAND_DEVICE	1
+#define CONFIG_SYS_NAND_BASE		0x40000000
+
+#define CONFIG_SYS_NO_FLASH
+
+#ifdef CONFIG_BOOT_ONENAND
+
+#   undef CONFIG_CMD_NAND /* Temporary: nand and onenand can't coexist */
+   /* Partition                    Size    Start
+    * XloaderTOC + X-Loader        256KB   0x00000000 
+    * Memory init function         256KB   0x00040000
+    * U-Boot                       2MB     0x00080000
+    * Sysimage (kernel + ramdisk)  4MB     0x00280000
+    * JFFS2 Root filesystem        22MB    0x00680000
+    * JFFS2 User Data              227.5MB 0x01C80000
+    */
+#   define CONFIG_JFFS2_PART_SIZE	0x400000
+#   define CONFIG_JFFS2_PART_OFFSET	0x280000
+
+#   define CONFIG_ENV_IS_IN_ONENAND
+#   define CONFIG_ENV_SIZE		(256*1024)
+#   define CONFIG_ENV_ADDR		0x30300000
+
+#else /* ! CONFIG_BOOT_ONENAND */
+
+#   undef CONFIG_CMD_ONENAND /* Temporary: nand and onenand can't coexist */
+
+#   define CONFIG_JFFS2_DEV		"nand0"
+#   define CONFIG_JFFS2_NAND		1 /* For the jffs2 support*/
+#   define CONFIG_JFFS2_PART_SIZE	0x00300000
+#   define CONFIG_JFFS2_PART_OFFSET	0x00280000 
+
+#   define CONFIG_ENV_IS_IN_NAND 
+#   define CONFIG_ENV_SIZE 		0x20000 /*128 Kb*/
+#   define CONFIG_ENV_OFFSET          (0x8000000 - 0x20000)
+
+#endif /* CONFIG_BOOT_ONENAND */
+
+/* Temporarily, until we have no driver, env is not in nand */
+#undef CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_IS_NOWHERE
+
+/* this is needed to make hello_world.c and other stuff happy */
+#define CONFIG_SYS_MAX_FLASH_SECT	512
+#define CONFIG_SYS_MAX_FLASH_BANKS	1
+
+/* base addresses of our peripherals */
+#define NOMADIK_SRC_BASE	0x101E0000	/* System and Reset Cnt */
+#define NOMADIK_PMU_BASE	0x101E9000	/* Power Management Unit */
+#define NOMADIK_MPMC_BASE	0x10110000	/* SDRAM Controller */
+#define NOMADIK_FSMC_BASE	0x10100000	/* FSMC Controller */
+#define NOMADIK_1NAND_BASE	0x30000000
+#define NOMADIK_GPIO0_BASE	0x101E4000
+#define NOMADIK_GPIO1_BASE	0x101E5000
+#define NOMADIK_GPIO2_BASE	0x101E6000
+#define NOMADIK_GPIO3_BASE	0x101E7000
+#define NOMADIK_CPLD_BASE	0x36000000
+#define NOMADIK_UART0_BASE	0x101FD000
+#define NOMADIK_UART1_BASE	0x101FB000
+#define NOMADIK_UART2_BASE	0x101F2000
+
+#define NOMADIK_I2C1_BASE	0x101F7000	/* I2C1 interface */
+#define NOMADIK_I2C0_BASE	0x101F8000	/* I2C0 interface */ 
+
+#define NOMADIK_RTC_BASE	0x101E8000
+#define NOMADIK_ETH0_BASE	0x36800300
+#define NOMADIK_CPLD_UART_BASE	0x36480000
+
+#endif /* __CONFIG_H */
-- 
1.6.0.2



More information about the U-Boot mailing list