Skip to contentSkip to conversation

T1040QDS: Add support of 2 stage NAND boot loader

PATCH Superseded Prabhakar Kushwaha 1 participant 1 message Oct 1, 2013

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 6/6 T1040QDS: Add support of 2 stage NAND boot loader

Add support of 2 stage NAND boot loader using SPL framework.
here, PBL initialise the internal SRAM(256K) and copy SPL(192K). This further initialise DDR using SPD and environment and copy u-boot(512 kb) from NAND to DDR. Finally SPL transer control to u-boot.

Initialise/create followings required for SPL framework
- Add spl.c which defines board_init_f, board_init_r
- update tlb and ddr accordingly

---
Based upon git://git.denx.de/u-boot-mpc85xx.git branch next

 board/freescale/t1040qds/Makefile |    9 ++-
 board/freescale/t1040qds/README   |   33 ++++++++++
 board/freescale/t1040qds/ddr.c    |    7 ++-
 board/freescale/t1040qds/spl.c    |  122 +++++++++++++++++++++++++++++++++++++
 board/freescale/t1040qds/tlb.c    |    8 ++-
 boards.cfg                        |    1 +
 include/configs/T1040QDS.h        |   58 +++++++++++++++---
 7 files changed, 227 insertions(+), 11 deletions(-)
 create mode 100644 board/freescale/t1040qds/spl.c
board/freescale/t1040qds/Makefile +8 -1
index 8f0057b..8f3d7ef 100644
@@ -8,9 +8,16 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
+ifdef CONFIG_SPL_BUILD
+COBJS-y += spl.o
+endif
+
+ifndef CONFIG_SPL_BUILD
 COBJS-y	+= $(BOARD).o
+COBJS-$(CONFIG_PCI) += pci.o
+endif
+
 COBJS-y	+= ddr.o
-COBJS-$(CONFIG_PCI)     += pci.o
 COBJS-y	+= law.o
 COBJS-y	+= tlb.o
 
board/freescale/t1040qds/README +33 -0
index f8b53b4..0e4d32e 100644
@@ -167,3 +167,36 @@ T1042 Personality
 --------------------
 T1042 is a reduced personality of T1040 without Integrated 8-port Gigabit
 Ethernet switch. Rest of the blocks are same as T1040
+
+
+2 Stage boot loader
+-------------------
+PBL initialise the internal SRAM and copy SPL(192K) in SRAM.
+SPL further initialise DDR using SPD and environment variables and copy
+u-boot(512 KB) from flash to DDR.
+Finally SPL transer control to u-boot for futher booting.
+
+SPL has following features:
+ - Executes within 256K
+ - Actual SPL size 96K + padding till 192K for extra code
+ - No relocation required
+
+ Run time view of SPL framework :-
+ -----------------------------------------------
+ Area        | Address                         |
+ -----------------------------------------------
+ GD, BD      | 0x0xFFFC0000 (4K)               |
+ -----------------------------------------------
+ HEAP        | 0xFFFC1000 (40K) grow downwards |
+ -----------------------------------------------
+ STACK       | 0xFFFD0000 (20K) grow upwards   |
+ -----------------------------------------------
+ U-boot SPL  | 0xfffD0000 -  0xfffffffc (192K) |
+ -----------------------------------------------
+
+Command to build 2 stage NAND boot loader
+ - modify RCW at board/freescale/t1040qds/t1040_rcw.cfg for nand boot
+     -66000002 00000000 fc027000 01000000
+     +66000002 00000000 ec106000 01000000
+ - make T1040QDS_NAND_config
+ - make u-boot-with-spl-pbl.bin
board/freescale/t1040qds/ddr.c +5 -2
index 4fd17da..dd2e0cb 100644
@@ -107,11 +107,14 @@ phys_size_t initdram(int board_type)
 
 	puts("Initializing....using SPD\n");
 
+#ifdef CONFIG_SPL_BUILD
 	dram_size = fsl_ddr_sdram();
 
 	dram_size = setup_ddr_tlbs(dram_size / 0x100000);
 	dram_size *= 0x100000;
-
-	puts("    DDR: ");
+#else
+	puts("DDR has been initialised by pre loader\n");
+	dram_size =  0x80000000;
+#endif
 	return dram_size;
 }
board/freescale/t1040qds/spl.c new file +122 -0

122 lines not on this page · raw message

board/freescale/t1040qds/tlb.c +7 -1
index 412c591..c733040 100644
@@ -52,7 +52,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
 		      MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
 		      0, 2, BOOKE_PAGESZ_256M, 1),
-
+#ifndef CONFIG_SPL_BUILD
 	/* *I*G* - PCI */
 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS,
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -82,6 +82,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 8, BOOKE_PAGESZ_16M, 1),
 #endif
+#endif
 #ifdef CONFIG_SYS_DCSRBAR_PHYS
 	SET_TLB_ENTRY(1, CONFIG_SYS_DCSRBAR, CONFIG_SYS_DCSRBAR_PHYS,
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -103,6 +104,11 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      0, 11, BOOKE_PAGESZ_4K, 1),
 #endif
 
+#if defined(CONFIG_RAMBOOT_PBL) && !defined(CONFIG_SPL_BUILD)
+	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
+		      MAS3_SX|MAS3_SW|MAS3_SR, 0,
+		      0, 17, BOOKE_PAGESZ_2G, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +1 -0
index f103f76..6b04ee2 100644
@@ -958,6 +958,7 @@ Active  powerpc     mpc85xx        -           freescale       t4qds
 Active  powerpc     mpc85xx        -           freescale       t4qds               T4240QDS_SPIFLASH                    T4240QDS:PPC_T4240,RAMBOOT_PBL,SPIFLASH,SYS_TEXT_BASE=0xFFF80000                                                                  -
 Active  powerpc     mpc85xx        -           freescale       t4qds               T4240QDS_SRIO_PCIE_BOOT              T4240QDS:PPC_T4240,SRIO_PCIE_BOOT_SLAVE,SYS_TEXT_BASE=0xFFF80000                                                                  -
 Active  powerpc     mpc85xx        -           freescale       t1040qds            T1040QDS                             T1040QDS:PPC_T1040                                                                                                                Naveen Burmi <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       t1040qds            T1040QDS_NAND                        T1040QDS:PPC_T1040,RAMBOOT_PBL,NAND                                                                                                      Poonam Aggrwal <[email protected]>
 Active  powerpc     mpc85xx        -           gdsys           p1022               controlcenterd_36BIT_SDCARD          controlcenterd:36BIT,SDCARD                                                                                                       Dirk Eibach <[email protected]>
 Active  powerpc     mpc85xx        -           gdsys           p1022               controlcenterd_36BIT_SDCARD_DEVELOP  controlcenterd:36BIT,SDCARD,DEVELOP                                                                                               Dirk Eibach <[email protected]>
 Active  powerpc     mpc85xx        -           gdsys           p1022               controlcenterd_TRAILBLAZER           controlcenterd:TRAILBLAZER,SPIFLASH                                                                                               Dirk Eibach <[email protected]>
include/configs/T1040QDS.h +51 -7

104 lines not on this page · raw message

Signature · 1 line
1.7.9.5