Skip to contentSkip to conversation

TNETV107X: Initial Commit

RFC New Cyril Chemparathy 1 participant 1 message Mar 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 TNETV107X: Initial Commit

TNETV107X is an ARM1176 SoC with a bunch on on-chip integrated peripherals. As suggested by Tom, this patch embeds the "ARM1176: Coexist with other ARM1176 platforms" patch posted on the list earlier.

At this point, I am faced with a bit of convoluted nastiness, and I would very much appreciate feedback and ideas on some of the issues detailed here.

This SOC needs a bit of an unusual boot up initialization process. The ROM code initializes the SOC's PLLs, DDR and NAND to "conservative" values before loading up u-boot into DDR and executing it. Subsequently, based on configuration read from eFUSE (and possibly board tie-offs and/or environment variables), the on-board power management device and PLL need to be reprogrammed to run at a different voltage and frequency respectively.

This is done as follows:

1. Relocate necessary code and data to on-chip SRAM
2. Switch to SRAM stack and branch to init code in SRAM
3. Get devices into a "safe" state:
3(a) Place the DDR SDRAM in self-refresh mode - From this point
on main memory should _not_ be accessed
3(b) Shutdown other devices - none for now
4. Program the power management IC to the required voltage
5. Reprogram PLL to the required frequency and adjust the rest of the clock tree as necessary
6. Restore devices:
6(a) Recalculate memory timing and reprogram the memory
controller
6(b) Recalculate other clocks as necessary (e.g. UART) 6(c) Reactivate DDR SDRAM by taking it out of self-refresh.
7. Return to u-boot in DDR
8. ...breathe...

This whole thing is pretty non-trivial, and hand coding this entire process in position independent assembly would result in a maintenance nightmare.

For this reason, I have implemented most of this internal-memory resident code in C, to be linked into a standalone binary embedded in u-boot. This binary is relocated into internal memory by lowlevel_init. After this, most of these functions are calleable from the main DDR resident u-boot through generated stubs that switch stacks and branch to internal memory.

1. Is there a better and/or simpler means to this end?

2. Has the need to run from internal memory in this fashion been faced on any other device that you know of? If so, how was that handled?

3. The monitor code is awkwardly split between SOC specific (mostly) and board specific (e.g. power management IC) pieces. This is currently placed in the appropriate places and pulled together in lib$(BOARD) by mon.mak. Any thoughts if this should be lumped together in one place or restructured in any other way?

4. Any other thoughts/comments/concerns/complaints?

---
 MAKEALL                                    |    1 +
 Makefile                                   |    3 +
 board/ti/tnetv107xevm/Makefile             |   62 +++
 board/ti/tnetv107xevm/config.mk            |   20 +
 board/ti/tnetv107xevm/debug.c              |   61 +++
 board/ti/tnetv107xevm/mon_pmic.c           |  267 +++++++++++++
 board/ti/tnetv107xevm/pmic.c               |   74 ++++
 board/ti/tnetv107xevm/sdb_board.c          |  168 ++++++++
 board/ti/tnetv107xevm/tnetv107x.h          |   27 ++
 board/ti/tnetv107xevm/u-boot.lds           |   52 +++
 board/ti/tnetv107xevm/wdt.c                |   56 +++
 cpu/arm1176/cpu.c                          |    1 -
 cpu/arm1176/start.S                        |   64 +++-
 cpu/arm1176/tnetv107x/Makefile             |   52 +++
 cpu/arm1176/tnetv107x/init.c               |   34 ++
 cpu/arm1176/tnetv107x/mon/README           |   61 +++
 cpu/arm1176/tnetv107x/mon/lowlevel_init.S  |   89 +++++
 cpu/arm1176/tnetv107x/mon/mon.lds          |   85 ++++
 cpu/arm1176/tnetv107x/mon/mon.mak          |   70 ++++
 cpu/arm1176/tnetv107x/mon/mon_aemif.c      |  186 +++++++++
 cpu/arm1176/tnetv107x/mon/mon_cache.c      |  196 ++++++++++
 cpu/arm1176/tnetv107x/mon/mon_clock.c      |  578 ++++++++++++++++++++++++++++
 cpu/arm1176/tnetv107x/mon/mon_ddr.c        |  320 +++++++++++++++
 cpu/arm1176/tnetv107x/mon/mon_init.c       |   58 +++
 cpu/arm1176/tnetv107x/mon/mon_log.c        |  183 +++++++++
 cpu/arm1176/tnetv107x/mon/mon_mux.c        |  465 ++++++++++++++++++++++
 cpu/arm1176/tnetv107x/mon/mon_ssp.c        |  235 +++++++++++
 cpu/arm1176/tnetv107x/mon/mon_stubs.awk    |  101 +++++
 cpu/arm1176/tnetv107x/mon/mon_timer.c      |  167 ++++++++
 cpu/arm1176/tnetv107x/mon/mon_wdt.c        |  213 ++++++++++
 include/asm-arm/arch-tnetv107x/clock.h     |   41 ++
 include/asm-arm/arch-tnetv107x/emif_defs.h |   28 ++
 include/asm-arm/arch-tnetv107x/hardware.h  |  300 ++++++++++++++
 include/asm-arm/arch-tnetv107x/mux.h       |  307 +++++++++++++++
 include/asm-arm/arch-tnetv107x/nand_defs.h |   43 ++
 include/asm-arm/arch-tnetv107x/ssp.h       |   79 ++++
 include/configs/smdk6400.h                 |    6 +
 include/configs/tnetv107x_evm.h            |  361 +++++++++++++++++
 38 files changed, 5103 insertions(+), 11 deletions(-)
 create mode 100644 board/ti/tnetv107xevm/Makefile
 create mode 100644 board/ti/tnetv107xevm/config.mk
 create mode 100644 board/ti/tnetv107xevm/debug.c
 create mode 100644 board/ti/tnetv107xevm/mon_pmic.c
 create mode 100644 board/ti/tnetv107xevm/pmic.c
 create mode 100644 board/ti/tnetv107xevm/sdb_board.c
 create mode 100644 board/ti/tnetv107xevm/tnetv107x.h
 create mode 100644 board/ti/tnetv107xevm/u-boot.lds
 create mode 100644 board/ti/tnetv107xevm/wdt.c
 create mode 100644 cpu/arm1176/tnetv107x/Makefile
 create mode 100644 cpu/arm1176/tnetv107x/init.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/README
 create mode 100644 cpu/arm1176/tnetv107x/mon/lowlevel_init.S
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon.lds
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon.mak
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_aemif.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_cache.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_clock.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_ddr.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_init.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_log.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_mux.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_ssp.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_stubs.awk
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_timer.c
 create mode 100644 cpu/arm1176/tnetv107x/mon/mon_wdt.c
 create mode 100644 include/asm-arm/arch-tnetv107x/clock.h
 create mode 100644 include/asm-arm/arch-tnetv107x/emif_defs.h
 create mode 100644 include/asm-arm/arch-tnetv107x/hardware.h
 create mode 100644 include/asm-arm/arch-tnetv107x/mux.h
 create mode 100644 include/asm-arm/arch-tnetv107x/nand_defs.h
 create mode 100644 include/asm-arm/arch-tnetv107x/ssp.h
 create mode 100644 include/configs/tnetv107x_evm.h
MAKEALL +1 -0
index 2eb8bb6..7daf414 100755
@@ -624,6 +624,7 @@ LIST_ARM11="			\
 	mx31pdk_nand		\
 	qong			\
 	smdk6400		\
+	tnetv107x_evm		\
 "
 
 #########################################################################
Makefile +3 -0
index 5147df7..3ce4487 100644
@@ -2932,6 +2932,9 @@ davinci_dm365evm_config :	unconfig
 davinci_dm6467evm_config :	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs dm6467evm davinci davinci
 
+tnetv107x_evm_config: unconfig
+	@$(MKCONFIG) $(@:_config=) arm arm1176 tnetv107xevm ti tnetv107x
+
 imx27lite_config:	unconfig
 	@$(MKCONFIG) $(@:_config=) arm arm926ejs imx27lite logicpd mx27
 
board/ti/tnetv107xevm/Makefile new file +62 -0

62 lines not on this page · raw message

board/ti/tnetv107xevm/config.mk new file +20 -0
new file mode 100644
index 0000000..f5487cb
@@ -0,0 +1,20 @@
+#
+# (C) Copyright 2009
+# Cyril Chemparathy, Texas Instruments, <[email protected]>
+#
+# (C) Copyright 2002
+# Gary Jennejohn, DENX Software Engineering, <[email protected]>
+# David Mueller, ELSOFT AG, <[email protected]>
+#
+# (C) Copyright 2003
+# Texas Instruments, <www.ti.com>
+# Swaminathan <[email protected]>
+#
+# Copyright (C) 2007 Sergey Kubushyn <[email protected]>
+#
+# (C) Copyright 2008
+# Sekhar Nori, Texas Instruments, Inc. <[email protected]>
+
+# Provide at least 16MB spacing between us and the Linux Kernel image
+
+TEXT_BASE = 0x83FC0000
board/ti/tnetv107xevm/debug.c new file +61 -0

61 lines not on this page · raw message

board/ti/tnetv107xevm/mon_pmic.c new file +267 -0

267 lines not on this page · raw message

board/ti/tnetv107xevm/pmic.c new file +74 -0

74 lines not on this page · raw message

board/ti/tnetv107xevm/sdb_board.c new file +168 -0

168 lines not on this page · raw message

board/ti/tnetv107xevm/tnetv107x.h new file +27 -0
new file mode 100644
index 0000000..faf6cee
@@ -0,0 +1,27 @@
+/*
+ * SoC-specific include for TNETV107X and similar chips
+ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef __TNETV107X_CPU_H__
+#define __TNETV107X_CPU_H__
+
+int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+int do_wdt(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+
+#endif /* __TNETV107X_CPU_H__ */
board/ti/tnetv107xevm/u-boot.lds new file +52 -0

52 lines not on this page · raw message

board/ti/tnetv107xevm/wdt.c new file +56 -0

56 lines not on this page · raw message

cpu/arm1176/cpu.c +0 -1
index 2c0014f..c0fd114 100644
@@ -33,7 +33,6 @@
 
 #include <common.h>
 #include <command.h>
-#include <asm/arch/s3c6400.h>
 #include <asm/system.h>
 
 static void cache_flush (void);
cpu/arm1176/start.S +54 -10

120 lines not on this page · raw message

cpu/arm1176/tnetv107x/Makefile new file +52 -0

52 lines not on this page · raw message

cpu/arm1176/tnetv107x/init.c new file +34 -0
new file mode 100644
index 0000000..dbe0b5f
@@ -0,0 +1,34 @@
+/*
+ * (C) Copyright 2009
+ * Texas Instruments Inc., <www.ti.com>
+ * Cyril Chemparathy <[email protected]>
+ *
+ * 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 <config.h>
+
+int timer_init(void)
+{
+	/*
+	 * Nothing here, timer should already have been initialized during
+	 * early_init() in the monitor code
+	 */
+	return 0;
+}
cpu/arm1176/tnetv107x/mon/README new file +61 -0

61 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/lowlevel_init.S new file +89 -0

89 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon.lds new file +85 -0

85 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon.mak new file +70 -0

70 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_aemif.c new file +186 -0

186 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_cache.c new file +196 -0

196 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_clock.c new file +578 -0

578 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_ddr.c new file +320 -0

320 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_init.c new file +58 -0

58 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_log.c new file +183 -0

183 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_mux.c new file +465 -0

158 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_ssp.c new file +235 -0

235 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_stubs.awk new file +101 -0

101 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_timer.c new file +167 -0

167 lines not on this page · raw message

cpu/arm1176/tnetv107x/mon/mon_wdt.c new file +213 -0

213 lines not on this page · raw message

include/asm-arm/arch-tnetv107x/clock.h new file +41 -0

41 lines not on this page · raw message

include/asm-arm/arch-tnetv107x/emif_defs.h new file +28 -0
new file mode 100644
index 0000000..b8ed6b8

Lines of this file are not shown. View the raw message.

include/asm-arm/arch-tnetv107x/hardware.h new file +300 -0

300 lines not on this page · raw message

include/asm-arm/arch-tnetv107x/mux.h new file +307 -0

307 lines not on this page · raw message

include/asm-arm/arch-tnetv107x/nand_defs.h new file +43 -0

43 lines not on this page · raw message

include/asm-arm/arch-tnetv107x/ssp.h new file +79 -0

79 lines not on this page · raw message

include/configs/smdk6400.h +6 -0
index f04feae..7b4501d 100644

Lines of this file are not shown. View the raw message.

include/configs/tnetv107x_evm.h new file +361 -0

361 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.6.3.3

Part of the diff is not shown here. View the raw message.