Patchwork [U-Boot,2/2] T1040QDS: Add support of 2 stage SD bootloader

login
register
mail settings
Submitter Priyanka Jain
Date Oct. 31, 2013, 9:45 a.m.
Message ID <1383212733-2324-1-git-send-email-Priyanka.Jain@freescale.com>
Download mbox | patch
Permalink /patch/287443/
State Deferred
Delegated to: York Sun
Headers show

Comments

Priyanka Jain - Oct. 31, 2013, 9:45 a.m.
Add support of 2-stage T1040QDS SD bootloader using SPL framework.
In this, PBL (hardware) initializes SRAM (256K) and copy SPL
(192K) from SD card to SRAM and transfer control to SPL.
This SPL bootloader furthur initializes DDR using SPD and
environment and copy final u-boot image (512K) from SD card
to DDR and transfer control to final u-boot.

Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
---
Based on u-boot-mpc85xx/next branch.
This patch depends upon following patches:
1)[U-Boot,2/2] T1040QDS: Add support of 2 stage SPI bootloader
	http://patchwork.ozlabs.org/patch/287139/

 board/freescale/t1040qds/README |    8 ++++++++
 board/freescale/t1040qds/spl.c  |    5 +++++
 boards.cfg                      |    1 +
 include/configs/T1040QDS.h      |   23 ++++++++++++++++++-----
 4 files changed, 32 insertions(+), 5 deletions(-)

Patch

diff --git a/board/freescale/t1040qds/README b/board/freescale/t1040qds/README
index 6235246..d4167c6 100644
--- a/board/freescale/t1040qds/README
+++ b/board/freescale/t1040qds/README
@@ -209,3 +209,11 @@  Command to build 2 stage SPI boot loader
      +66000002 00000000 58027000 01000000
  - make T1040QDS_SPIFLASH_config
  - make u-boot-with-spl-pbl.bin
+
+Command to build 2 stage SD card boot loader
+-------------------------------------------
+ - modify RCW at board/freescale/t1040qds/t1040_rcw.cfg for spi boot
+     -66000002 00000000 fc027000 01000000
+     +66000002 00000000 68027000 01000000
+ - make T1040QDS_SDCARD_config
+ - make u-boot-with-spl-pbl.bin
diff --git a/board/freescale/t1040qds/spl.c b/board/freescale/t1040qds/spl.c
index 60770f0..35d7651 100644
--- a/board/freescale/t1040qds/spl.c
+++ b/board/freescale/t1040qds/spl.c
@@ -107,6 +107,9 @@  void board_init_r(gd_t *gd, ulong dest_addr)
 	mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
 			CONFIG_SPL_RELOC_MALLOC_SIZE);
 	env_init();
+#ifdef CONFIG_SPL_MMC_BOOT
+	mmc_initialize(bd);
+#endif
 
 	/* relocate environment function pointers etc. */
 	env_relocate();
@@ -120,5 +123,7 @@  void board_init_r(gd_t *gd, ulong dest_addr)
 	nand_boot();
 #elif defined(CONFIG_SPL_SPI_BOOT)
 	spi_boot();
+#elif defined(CONFIG_SPL_MMC_BOOT)
+	mmc_boot();
 #endif
 }
diff --git a/boards.cfg b/boards.cfg
index 56f522e..e9a43a1 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -965,6 +965,7 @@  Active  powerpc     mpc85xx        -           freescale       t4qds
 Active  powerpc     mpc85xx        -           freescale       t1040qds            T1040QDS                             T1040QDS:PPC_T1040                                                                                                                Naveen Burmi <NaveenBurmi@freescale.com>
 Active  powerpc     mpc85xx        -           freescale       t1040qds            T1040QDS_NAND                        T1040QDS:PPC_T1040,RAMBOOT_PBL,NAND                                                                                                      Poonam Aggrwal <poonam.aggrwal@freescale.com>
 Active  powerpc     mpc85xx        -           freescale       t1040qds            T1040QDS_SPIFLASH                    T1040QDS:PPC_T1040,RAMBOOT_PBL,SPIFLASH                                                                                       Poonam Aggrwal <poonam.aggrwal@freescale.com>
+Active  powerpc     mpc85xx        -           freescale       t1040qds            T1040QDS_SDCARD                      T1040QDS:PPC_T1040,RAMBOOT_PBL,SDCARD                                                                                             Poonam Aggrwal <poonam.aggrwal@freescale.com>
 Active  powerpc     mpc85xx        -           gdsys           p1022               controlcenterd_36BIT_SDCARD          controlcenterd:36BIT,SDCARD                                                                                                       Dirk Eibach <eibach@gdsys.de>
 Active  powerpc     mpc85xx        -           gdsys           p1022               controlcenterd_36BIT_SDCARD_DEVELOP  controlcenterd:36BIT,SDCARD,DEVELOP                                                                                               Dirk Eibach <eibach@gdsys.de>
 Active  powerpc     mpc85xx        -           gdsys           p1022               controlcenterd_TRAILBLAZER           controlcenterd:TRAILBLAZER,SPIFLASH                                                                                               Dirk Eibach <eibach@gdsys.de>
diff --git a/include/configs/T1040QDS.h b/include/configs/T1040QDS.h
index 27b812d..7bb8227 100644
--- a/include/configs/T1040QDS.h
+++ b/include/configs/T1040QDS.h
@@ -70,6 +70,17 @@ 
 #define CONFIG_SYS_LDSCRIPT	"arch/powerpc/cpu/mpc85xx/u-boot.lds"
 #define CONFIG_SPL_SPI_BOOT
 #endif
+#ifdef CONFIG_SDCARD
+#define CONFIG_SPL_MMC_SUPPORT
+#define CONFIG_SYS_MMC_U_BOOT_SIZE	(512 << 10)
+#define CONFIG_SYS_MMC_U_BOOT_DST	(0x280000)
+#define CONFIG_SYS_MMC_U_BOOT_START	(0x2ff000)
+#define CONFIG_SYS_MMC_U_BOOT_OFFS	(512 << 10)
+#define CONFIG_SYS_TEXT_BASE		0x280000
+#define CONFIG_RESET_VECTOR_ADDRESS	0x2ffffc
+#define CONFIG_SYS_LDSCRIPT	"arch/powerpc/cpu/mpc85xx/u-boot.lds"
+#define CONFIG_SPL_MMC_BOOT
+#endif
 #ifdef CONFIG_SPL_BUILD
 #define CONFIG_SPL_COMMON_INIT_DDR
 #define CONFIG_SYS_CCSR_DO_NOT_RELOCATE
@@ -138,7 +149,7 @@ 
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV          0
 #define CONFIG_ENV_SIZE			0x2000
-#define CONFIG_ENV_OFFSET		(512 * 1105)
+#define CONFIG_ENV_OFFSET		0x100000	/*1MB*/
 #elif defined(CONFIG_NAND)
 #define CONFIG_SYS_EXTRA_ENV_RELOC
 #define CONFIG_ENV_IS_IN_NAND
@@ -640,12 +651,14 @@  unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_QE_FMAN_FW_ADDR	0x110000
 #elif defined(CONFIG_SDCARD)
 /*
- * PBL SD boot image should stored at 0x1000(8 blocks), the size of the image is
- * about 545KB (1089 blocks), Env is stored after the image, and the env size is
- * 0x2000 (16 blocks), 8 + 1089 + 16 = 1113, enlarge it to 1130.
+ * For 2 stage bootloader, SD card will contain
+ * PBL SD boot image for SPL at offset 0x0
+ * final u-boot image at offset 0x400 of size 0x400
+ * env at offset 0x100000 of size 0x2000
+ * FMAN microcode can be stored at 0x110000
  */
 #define CONFIG_SYS_QE_FMAN_FW_IN_MMC
-#define CONFIG_SYS_QE_FMAN_FW_ADDR	(512 * 1130)
+#define CONFIG_SYS_QE_FMAN_FW_ADDR	0x110000
 #elif defined(CONFIG_NAND)
 #define CONFIG_SYS_QE_FMAN_FW_IN_NAND
 #define CONFIG_SYS_QE_FMAN_FW_ADDR	(9 * CONFIG_SYS_NAND_BLOCK_SIZE)