Skip to contentSkip to conversation

board/p1010rdb:Add NAND boot support using new SPL format

PATCH New Prabhakar Kushwaha 2 participants 2 messages Apr 16, 2013 – Jun 21, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v5 3/5 board/p1010rdb:Add NAND boot support using new SPL format

- defines contants
- Add spl_minimal.c to initialise DDR
- update TLB entries as per NAND boot
- remove nand_spl support for P1010RDB

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

Changes for v2:
- Define CONFIG_A003399_NOR_WORKAROUND for NOR boot
Changes for v3:
- Put CONFIG_A003399_NOR_WORKAROUND in CONFIG_SYS_FSL_ERRATUM_IFC_A003399
- Fix tools/checkpatch errors
Changes for v4:
- Remove unused CONFIG_P1010RDB
Changes for v5:
- Rebased
- define CONFIG_SPL_MAX_SIZE as 8192 instead of 8 * 1204

 board/freescale/p1010rdb/Makefile                  |   16 ++
 .../freescale/p1010rdb/spl_minimal.c               |   20 +-
 board/freescale/p1010rdb/tlb.c                     |   12 +-
 include/configs/P1010RDB.h                         |   66 ++---
 nand_spl/board/freescale/p1010rdb/Makefile         |  142 ----------
 nand_spl/nand_boot_fsl_ifc.c                       |  271 --------------------
 6 files changed, 69 insertions(+), 458 deletions(-)
 rename nand_spl/board/freescale/p1010rdb/nand_boot.c => board/freescale/p1010rdb/spl_minimal.c (95%)
 delete mode 100644 nand_spl/board/freescale/p1010rdb/Makefile
 delete mode 100644 nand_spl/nand_boot_fsl_ifc.c
board/freescale/p1010rdb/Makefile +16 -0
index 4c705b6..e6563be 100644
@@ -24,11 +24,27 @@ include $(TOPDIR)/config.mk
 
 LIB	= $(obj)lib$(BOARD).o
 
+MINIMAL=
+
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+
+COBJS-y	+= spl_minimal.o tlb.o law.o
+
+else
+
 COBJS-y	+= $(BOARD).o
 COBJS-y	+= ddr.o
 COBJS-y	+= law.o
 COBJS-y	+= tlb.o
 
+endif
+
 SRCS	:= $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS-y))
 SOBJS	:= $(addprefix $(obj),$(SOBJS))
board/freescale/p1010rdb/spl_minimal.c renamed from nand_spl/board/freescale/p1010rdb/nand_boot.c +12 -8
similarity index 95%
rename from nand_spl/board/freescale/p1010rdb/nand_boot.c
rename to board/freescale/p1010rdb/spl_minimal.c
index 3c7bc2b..c909e0e 100644
@@ -31,11 +31,18 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-unsigned long ddr_freq_mhz;
 
 void sdram_init(void)
 {
 	ccsr_ddr_t *ddr = (ccsr_ddr_t *)CONFIG_SYS_MPC8xxx_DDR_ADDR;
+	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+	u32 ddr_ratio;
+	unsigned long ddr_freq_mhz;
+
+	ddr_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO;
+	ddr_ratio = ddr_ratio >> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT;
+	ddr_freq_mhz = (CONFIG_SYS_CLK_FREQ * ddr_ratio) / 0x1000000;
+
 	/* mask off E bit */
 	u32 svr = SVR_SOC_VER(mfspr(SPRN_SVR));
 
@@ -81,6 +88,7 @@ void sdram_init(void)
 		__raw_writel((CONFIG_SYS_DDR_CS0_BNDS >> 1) & 0x0fff0fff, &ddr->cs0_bnds);
 	}
 
+	asm volatile("sync;isync");
 	udelay(500);
 
 	/* Let the controller go */
@@ -91,7 +99,7 @@ void sdram_init(void)
 
 void board_init_f(ulong bootflag)
 {
-	u32 plat_ratio, ddr_ratio;
+	u32 plat_ratio;
 	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
 
 	/* initialize selected port with appropriate baud rate */
@@ -99,10 +107,6 @@ void board_init_f(ulong bootflag)
 	plat_ratio >>= 1;
 	gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
 
-	ddr_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_DDR_RATIO;
-	ddr_ratio = ddr_ratio >> MPC85xx_PORPLLSR_DDR_RATIO_SHIFT;
-	ddr_freq_mhz = (CONFIG_SYS_CLK_FREQ * ddr_ratio) / 0x1000000;
-
 	NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
 			gd->bus_clk / 16 / CONFIG_BAUDRATE);
 
@@ -115,8 +119,8 @@ void board_init_f(ulong bootflag)
 	/* NOTE - code has to be copied out of NAND buffer before
 	 * other blocks can be read.
 	 */
-	relocate_code(CONFIG_SYS_NAND_U_BOOT_RELOC_SP, 0,
-			CONFIG_SYS_NAND_U_BOOT_RELOC);
+
+	relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
 }
 
 void board_init_r(gd_t *gd, ulong dest_addr)
board/freescale/p1010rdb/tlb.c +6 -6
index 4256bf4..7a8690a 100644
@@ -43,16 +43,16 @@ struct fsl_e_tlb_entry tlb_table[] = {
 
 	/* TLB 1 */
 	/* *I*** - Covers boot page */
-	SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
-			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-			0, 0, BOOKE_PAGESZ_4K, 1),
+	SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
+		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+		      0, 0, BOOKE_PAGESZ_8K, 1),
 
 	/* *I*G* - CCSRBAR */
 	SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 1, BOOKE_PAGESZ_1M, 1),
 
-#ifndef CONFIG_NAND_SPL
+#ifndef CONFIG_SPL_BUILD
 #ifndef CONFIG_SDCARD
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
@@ -64,7 +64,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			0, 3, BOOKE_PAGESZ_16M, 1),
 #endif
 
-#ifdef CONFIG_PCI
+#ifndef CONFIG_PCI
 	/* *I*G* - PCI */
 	SET_TLB_ENTRY(1, CONFIG_SYS_PCIE1_MEM_VIRT, CONFIG_SYS_PCIE1_MEM_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
@@ -88,7 +88,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			0, 7, BOOKE_PAGESZ_1M, 1),
 #endif
 
-#if defined(CONFIG_SYS_RAMBOOT)
+#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SPL)
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 8, BOOKE_PAGESZ_1G, 1)
include/configs/P1010RDB.h +35 -31

138 lines not on this page · raw message

nand_spl/board/freescale/p1010rdb/Makefile deleted +0 -142

142 lines not on this page · raw message

nand_spl/nand_boot_fsl_ifc.c deleted +0 -271

271 lines not on this page · raw message

Signature · 1 line
1.7.9.5
Applied
#1 lore raw

PATCH v5 3/5 board/p1010rdb:Add NAND boot support using new SPL format

Quoted 6 lines · Prabhakar Kushwaha

- defines contants
- Add spl_minimal.c to initialise DDR
- update TLB entries as per NAND boot
- remove nand_spl support for P1010RDB

Applied, thanks! Fixed typos in commit message

Andy