[U-Boot-Users] [PATCH] Make Sequoia boot vxWorks

Niklaus Giger niklausgiger at gmx.ch
Mon Jul 30 19:31:12 CEST 2007


In order to make vxWorks boot the following changes had to be made:

- Do not TLB#0, which is hardwired by vxWorks to be used for the machine
  check interrupt
- Patch some periferal bus configuration register to match the use by
  vxWorks

Signed-off-by: Niklaus Giger <niklaus.giger at netstal.com>
---
 board/amcc/sequoia/init.S    |   17 ++++++++++-------
 board/amcc/sequoia/sequoia.c |   11 +++++++++++
 common/cmd_elf.c             |    3 +++
 cpu/ppc4xx/start.S           |    5 ++++-
 include/configs/sequoia.h    |    2 ++
 5 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/board/amcc/sequoia/init.S b/board/amcc/sequoia/init.S
index 45bcd4b..f7f268b 100644
--- a/board/amcc/sequoia/init.S
+++ b/board/amcc/sequoia/init.S
@@ -87,8 +87,17 @@
 tlbtab:
 	tlbtab_start
 
+	/* TLB#0: vxWorks needs this entry for the Machine Check interrupt,  */
+	tlbentry( 0x40000000, SZ_256M, 0, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
+
+	/* TLB#1: TLB-entry for DDR SDRAM (Up to 2GB) */
+	tlbentry( CFG_SDRAM_BASE, SZ_256M, CFG_SDRAM_BASE, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
+
+	/* TLB#2: TLB-entry for EBC */
+	tlbentry( CFG_BCSR_BASE, SZ_256M, CFG_BCSR_BASE, 1, AC_R|AC_W|AC_X|SA_G|SA_I )
+
 	/*
-	 * BOOT_CS (FLASH) must be first. Before relocation SA_I can be off to use the
+	 * TLB#3: BOOT_CS (FLASH) must be forth. Before relocation SA_I can be off to use the
 	 * speed up boot process. It is patched after relocation to enable SA_I
 	 */
 #ifndef CONFIG_NAND_SPL
@@ -97,9 +106,6 @@ tlbtab:
 	tlbentry( CFG_NAND_BOOT_SPL_SRC, SZ_4K, CFG_NAND_BOOT_SPL_SRC, 1, AC_R|AC_W|AC_X|SA_G )
 #endif
 
-	/* TLB-entry for DDR SDRAM (Up to 2GB) */
-	tlbentry( CFG_SDRAM_BASE, SZ_256M, CFG_SDRAM_BASE, 0, AC_R|AC_W|AC_X|SA_G|SA_I )
-
 #ifdef CFG_INIT_RAM_DCACHE
 	/* TLB-entry for init-ram in dcache (SA_I must be turned off!) */
 	tlbentry( CFG_INIT_RAM_ADDR, SZ_64K, CFG_INIT_RAM_ADDR, 0, AC_R|AC_W|AC_X|SA_G )
@@ -111,9 +117,6 @@ tlbtab:
 	tlbentry( CFG_PCI_MEMBASE2, SZ_256M, CFG_PCI_MEMBASE2, 1, AC_R|AC_W|SA_G|SA_I )
 	tlbentry( CFG_PCI_MEMBASE3, SZ_256M, CFG_PCI_MEMBASE3, 1, AC_R|AC_W|SA_G|SA_I )
 
-	/* TLB-entry for EBC */
-	tlbentry( CFG_BCSR_BASE, SZ_1K, CFG_BCSR_BASE, 1, AC_R|AC_W|AC_X|SA_G|SA_I )
-
 	/* TLB-entry for NAND */
 	tlbentry( CFG_NAND_ADDR, SZ_1K, CFG_NAND_ADDR, 1, AC_R|AC_W|AC_X|SA_G|SA_I )
 
diff --git a/board/amcc/sequoia/sequoia.c b/board/amcc/sequoia/sequoia.c
index f823117..09c5f69 100644
--- a/board/amcc/sequoia/sequoia.c
+++ b/board/amcc/sequoia/sequoia.c
@@ -582,3 +582,14 @@ int post_hotkeys_pressed(void)
 	return 0;	/* No hotkeys supported */
 }
 #endif /* CONFIG_POST */
+
+#ifdef CFG_PATCH_BEFORE_BOOTING_VXWORKS
+void patch_vxworks_boot(void)
+{
+	printf("Patching pb0/3 for vxWorks\n");
+	mtebc(pb0cr, 0xfe0ba000);
+	mtebc(pb0ap, 0x03017300);
+	mtebc(pb3cr, 0xd00fc000);
+	mtebc(pb3ap, 0x7f8ffe80);
+}
+#endif
diff --git a/common/cmd_elf.c b/common/cmd_elf.c
index 0e3d56f..a3790c1 100644
--- a/common/cmd_elf.c
+++ b/common/cmd_elf.c
@@ -209,6 +209,9 @@ int do_bootvx (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		/* leave addr as load_addr */
 	}
 
+#if defined(CFG_PATCH_BEFORE_BOOTING_VXWORKS)
+	patch_vxworks_boot();
+#endif
 	printf ("## Using bootline (@ 0x%lx): %s\n", bootaddr,
 			(char *) bootaddr);
 	printf ("## Starting vxWorks at 0x%08lx ...\n", addr);
diff --git a/cpu/ppc4xx/start.S b/cpu/ppc4xx/start.S
index 8ecaaea..3f1c061 100644
--- a/cpu/ppc4xx/start.S
+++ b/cpu/ppc4xx/start.S
@@ -1432,7 +1432,10 @@ relocate_code:
 	dccci	0,0			/* Invalidate data cache, now no longer our stack */
 	sync
 	isync
-	addi	r1,r0,0x0000		/* TLB entry #0 */
+#ifndef CFG_TLB_FOR_BOOT_FLASH
+#define CFG_TLB_FOR_BOOT_FLASH 0
+#endif
+	addi	r1,r0,CFG_TLB_FOR_BOOT_FLASH	/* TLB entry (default #0) */
 	tlbre	r0,r1,0x0002		/* Read contents */
 	ori	r0,r0,0x0c00		/* Or in the inhibit, write through bit */
 	tlbwe	r0,r1,0x0002		/* Save it out */
diff --git a/include/configs/sequoia.h b/include/configs/sequoia.h
index 3219992..300b3f5 100644
--- a/include/configs/sequoia.h
+++ b/include/configs/sequoia.h
@@ -53,6 +53,8 @@
 #define CFG_MONITOR_LEN		(384 * 1024)	/* Reserve 384 kB for Monitor	*/
 #define CFG_MALLOC_LEN		(256 * 1024)	/* Reserve 256 kB for malloc()	*/
 
+#define CFG_TLB_FOR_BOOT_FLASH  3 /* Default is 0 */
+#define CFG_PATCH_BEFORE_BOOTING_VXWORKS 1
 #define CFG_BOOT_BASE_ADDR	0xf0000000
 #define CFG_SDRAM_BASE		0x00000000	/* _must_ be 0		*/
 #define CFG_FLASH_BASE		0xfc000000	/* start of FLASH	*/
-- 
1.5.2

-- 
Niklaus Giger
Netstal Maschinen AG
CH-8752 Naefels




More information about the U-Boot mailing list