Skip to contentSkip to conversation

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

PATCH Superseded Prabhakar Kushwaha 2 participants 4 messages Apr 11, 2013 – Apr 12, 2013

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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

 board/freescale/p1010rdb/Makefile                  |   16 ++
 .../freescale/p1010rdb/spl_minimal.c               |   20 +-
 board/freescale/p1010rdb/tlb.c                     |   12 +-
 include/configs/P1010RDB.h                         |   75 +++---
 nand_spl/board/freescale/p1010rdb/Makefile         |  142 ----------
 nand_spl/nand_boot_fsl_ifc.c                       |  271 --------------------
 6 files changed, 78 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 +44 -31

159 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
#1 lore raw

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

include/configs/P1010RDB.h line 39

Quoted 12 lines · Prabhakar Kushwaha
include/configs/P1010RDB.h +2 -0
index 437ee6e..a6ef276 100644
@@ -33,6 +33,8 @@
 
 #ifdef CONFIG_P1010RDB
 #define CONFIG_P1010
+#define CONFIG_E500			/* BOOKE e500 family */
+#include <asm/config_mpc85xx.h>
 #define CONFIG_NAND_FSL_IFC
 #endif

Why is this inside the P1010RDB ifdef? Why do we even have a CONFIG_P1010RDB? What other boards use this file?

-Scott

#2 lore raw

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

Quoted 7 lines · Scott Wood
Quoted 6 lines · Prabhakar Kushwaha
include/configs/P1010RDB.h +0 -0
index 437ee6e..a6ef276 100644
@@ -33,6 +33,8 @@
 
Quoted 9 lines

include/configs/P1010RDB.h line 39

Quoted 6 lines
include/configs/P1010RDB.h +2 -0
 #ifdef CONFIG_P1010RDB
 #define CONFIG_P1010
+#define CONFIG_E500            /* BOOKE e500 family */
+#include <asm/config_mpc85xx.h>
 #define CONFIG_NAND_FSL_IFC
 #endif

Why is this inside the P1010RDB ifdef? Why do we even have a CONFIG_P1010RDB? What other boards use this file

I am supposed to put config_mpc85xx.h after CONFIG_P1010 define. That's why put under CONFIG_P1010RDB.
CONFIG_P1010RDB is not being used for P1010 as no other board using this file. It can be removed.

Just to guess may be there were plan to add make target for P1014(Personality of P1010). but it never happened as it is taken care by reading svr.
I will update it.

Regards,
Prabhakar

#3 lore raw

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

Quoted 18 lines · Prabhakar Kushwaha
Quoted 7 lines · Scott Wood
Quoted 6 lines · Prabhakar Kushwaha
include/configs/P1010RDB.h +0 -0
index 437ee6e..a6ef276 100644
@@ -33,6 +33,8 @@
 
Quoted 9 lines

include/configs/P1010RDB.h line 39

Quoted 6 lines
include/configs/P1010RDB.h +2 -0
 #ifdef CONFIG_P1010RDB
 #define CONFIG_P1010
+#define CONFIG_E500            /* BOOKE e500 family */
+#include <asm/config_mpc85xx.h>
 #define CONFIG_NAND_FSL_IFC
 #endif

Why is this inside the P1010RDB ifdef? Why do we even have a CONFIG_P1010RDB? What other boards use this file

Quoted 1 line

I am supposed to put config_mpc85xx.h after CONFIG_P1010 define.

That doesn't have to mean *immediately* after. :-)

Quoted 8 lines

That's why put under CONFIG_P1010RDB.
CONFIG_P1010RDB is not being used for P1010 as no other board using this file. It can be removed.

Just to guess may be there were plan to add make target for P1014(Personality of P1010). but it never happened as it is taken care by reading svr.
I will update it.

OK.

-Scott