Skip to contentSkip to conversation

powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

PATCH New Po Liu 4 participants 34 messages Dec 2, 2013 – Jan 21, 2014 4 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Po Liu

author
#0 lore raw

PATCH 1/1 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Using the TPL/SPL method to booting from 8k page NAND flash.
- Add 4kB size tlb for minimal SPL image;
- Add 256kB size SRAM tlb for second step booting;
- Add spl.c for TPL image boot;
- Add spl_minimal.c for minimal SPL image;
- Add C291PCIE_NAND/C292PCIE_NAND/C293PCIE_NAND configure;
- Modify C29XPCIE.h for nand config and enviroment;

---
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds |  15 ++--
 board/freescale/c29xpcie/Makefile       |  15 ++++
 board/freescale/c29xpcie/cpld.c         |   2 +
 board/freescale/c29xpcie/spl.c          |  73 ++++++++++++++++++
 board/freescale/c29xpcie/spl_minimal.c  |  63 ++++++++++++++++
 board/freescale/c29xpcie/tlb.c          |  22 +++++-
 boards.cfg                              |   1 +
 drivers/mtd/nand/fsl_ifc_spl.c          |  29 +++++--
 include/configs/C29XPCIE.h              | 129 +++++++++++++++++++++++++++++++-
 9 files changed, 330 insertions(+), 19 deletions(-)
 create mode 100644 board/freescale/c29xpcie/spl.c
 create mode 100644 board/freescale/c29xpcie/spl_minimal.c
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +8 -7
index bc13267..acaa093 100644
@@ -57,7 +57,14 @@ SECTIONS
 	. = ALIGN(8);
 	__init_begin = .;
 	__init_end = .;
-/* FIXME for non-NAND SPL */
+
+/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+	.bootpg ADDR(.text) - 0x1000 :
+	{
+		KEEP(*(.bootpg))
+	} :text = 0xffff
+#else
 #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
 	.bootpg ADDR(.text) + 0x1000 :
 	{
@@ -69,12 +76,6 @@ SECTIONS
 #else
 #error unknown NAND controller
 #endif
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-	.bootpg ADDR(.text) - 0x1000 :
-	{
-		KEEP(*(.bootpg))
-	} :text = 0xffff
-#else
 	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
 		KEEP(*(.resetvec))
 	} = 0xffff
board/freescale/c29xpcie/Makefile +15 -0
index 626d48a..818484a 100644
@@ -3,8 +3,23 @@
 #
 # SPDX-License-Identifier:	GPL-2.0+
 
+MINIMAL=
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+obj-y	+= spl_minimal.o tlb.o law.o
+else
+ifdef CONFIG_SPL_BUILD
+obj-y	+= spl.o
+endif
+
 obj-y	+= c29xpcie.o
 obj-y	+= cpld.o
 obj-y	+= ddr.o
 obj-y	+= law.o
 obj-y	+= tlb.o
+endif
board/freescale/c29xpcie/cpld.c +2 -0
index 5cbccff..37722da 100644
@@ -89,6 +89,7 @@ static void cpld_dump_regs(void)
 }
 #endif
 
+#ifndef CONFIG_SPL_BUILD
 int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int rc = 0;
@@ -129,3 +130,4 @@ U_BOOT_CMD(
 	"cpld_cmd dump - display the CPLD registers\n"
 #endif
 	);
+#endif
board/freescale/c29xpcie/spl.c new file +73 -0

73 lines not on this page · raw message

board/freescale/c29xpcie/spl_minimal.c new file +63 -0

63 lines not on this page · raw message

board/freescale/c29xpcie/tlb.c +20 -2
index 84844ee..11f8a37 100644
@@ -26,10 +26,20 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			0, 0, BOOKE_PAGESZ_4K, 0),
 
 	/* TLB 1 */
+#ifdef CONFIG_SPL_NAND_MINIMAL
+	SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 10, BOOKE_PAGESZ_4K, 1),
+	SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 11, BOOKE_PAGESZ_4K, 1),
+#endif
+
 	SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 0, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
 			0, 1, BOOKE_PAGESZ_64M, 1),
@@ -43,13 +53,14 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 3, BOOKE_PAGESZ_256K, 1),
 #endif
+#endif
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 4, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE,
@@ -61,7 +72,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 7, BOOKE_PAGESZ_256K, 1),
 
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || (defined(CONFIG_SPL) \
+		&& !defined(CONFIG_SPL_COMMON_INIT_DDR))
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE,
 			CONFIG_SYS_DDR_SDRAM_BASE,
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
@@ -71,6 +83,12 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_256M, 1),
 #endif
+
+#ifdef CONFIG_SYS_INIT_L2_ADDR
+	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
+		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
+		      0, 12, BOOKE_PAGESZ_256K, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +1 -0
index e742746..b5f4750 100644
@@ -784,6 +784,7 @@ Active  powerpc     mpc85xx        -           freescale       bsc9132qds
 Active  powerpc     mpc85xx        -           freescale       bsc9132qds          BSC9132QDS_SPIFLASH_DDRCLK133        BSC9132QDS:BSC9132QDS,SPIFLASH,SYS_CLK_100_DDR_133                                                                                Naveen Burmi <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE                             C29XPCIE:C29XPCIE,36BIT                                                                                                           Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_SPIFLASH                    C29XPCIE:C29XPCIE,36BIT,SPIFLASH                                                                                                  Po Liu <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_NAND                        C29XPCIE:C29XPCIE,36BIT,NAND                                                                                                  Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS                              -                                                                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_NAND                         P3041DS:RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF80000                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_SDCARD                       P3041DS:RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF80000                                                                               -
drivers/mtd/nand/fsl_ifc_spl.c +23 -6
index 9fa5ccb..5e58614 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
+#ifdef CONFIG_TPL_BUILD
+void nand_spl_load_image(uint32_t offs, int uboot_size, void *vdst)
+#else
 static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#endif
 {
 	struct fsl_ifc *ifc = IFC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
@@ -105,6 +109,9 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	int sram_addr;
 	int pg_no;
+#ifdef CONFIG_TPL_BUILD
+	char *dst = vdst;
+#endif
 
 	/* Get NAND Flash configuration */
 	csor = CONFIG_SYS_NAND_CSOR;
@@ -211,6 +218,15 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 }
 
 /*
++ * Defines a static function nand_load_image() here, because non-static makes
++ * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
++ */
+#ifndef CONFIG_TPL_BUILD
+#define nand_spl_load_image(offs, uboot_size, dst) \
+	nand_load(offs, uboot_size, dst)
+#endif
+
+/*
  * Main entrypoint for NAND Boot. It's necessary that SDRAM is already
  * configured and available since this code loads the main U-boot image
  * from NAND into SDRAM and starts from there.
@@ -221,16 +237,17 @@ void nand_boot(void)
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
-		  (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			    CONFIG_SYS_NAND_U_BOOT_SIZE,
+			    (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST);
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
+	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
 	/*
include/configs/C29XPCIE.h +125 -4

183 lines not on this page · raw message

Signature · 1 line
1.8.0
author
#1 lore raw

PATCH v2 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot.

- For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec.
- Use a clear function name for nand spl boot.
- Add CONFIG_SPL_IFC_SUPPORT to compile the fsl_ifc.c in spl/Makefile;

---
changes for v2:
- seperate public code and c29xpcie board code
- add ifc support

 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++-------
 drivers/mtd/nand/fsl_ifc_spl.c          | 29 +++++++++++++++++++++++------
 spl/Makefile                            |  1 +
 3 files changed, 32 insertions(+), 13 deletions(-)
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +8 -7
index bc13267..acaa093 100644
@@ -57,7 +57,14 @@ SECTIONS
 	. = ALIGN(8);
 	__init_begin = .;
 	__init_end = .;
-/* FIXME for non-NAND SPL */
+
+/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+	.bootpg ADDR(.text) - 0x1000 :
+	{
+		KEEP(*(.bootpg))
+	} :text = 0xffff
+#else
 #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
 	.bootpg ADDR(.text) + 0x1000 :
 	{
@@ -69,12 +76,6 @@ SECTIONS
 #else
 #error unknown NAND controller
 #endif
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-	.bootpg ADDR(.text) - 0x1000 :
-	{
-		KEEP(*(.bootpg))
-	} :text = 0xffff
-#else
 	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
 		KEEP(*(.resetvec))
 	} = 0xffff
drivers/mtd/nand/fsl_ifc_spl.c +23 -6
index 9de327b..93303b4 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
+#ifdef CONFIG_TPL_BUILD
+void nand_spl_load_image(uint32_t offs, int uboot_size, void *vdst)
+#else
 static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#endif
 {
 	struct fsl_ifc *ifc = IFC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
@@ -105,6 +109,9 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	int sram_addr;
 	int pg_no;
+#ifdef CONFIG_TPL_BUILD
+	char *dst = vdst;
+#endif
 
 	/* Get NAND Flash configuration */
 	csor = CONFIG_SYS_NAND_CSOR;
@@ -211,6 +218,15 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 }
 
 /*
++ * Defines a static function nand_load_image() here, because non-static makes
++ * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
++ */
+#ifndef CONFIG_TPL_BUILD
+#define nand_spl_load_image(offs, uboot_size, dst) \
+	nand_load(offs, uboot_size, dst)
+#endif
+
+/*
  * Main entrypoint for NAND Boot. It's necessary that SDRAM is already
  * configured and available since this code loads the main U-boot image
  * from NAND into SDRAM and starts from there.
@@ -221,16 +237,17 @@ void nand_boot(void)
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
-		  (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			    CONFIG_SYS_NAND_U_BOOT_SIZE,
+			    (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST);
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
+	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
 	/*
spl/Makefile +1 -0
index 2a787af..908af35 100644
@@ -79,6 +79,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \
 	drivers/power/pmic/
 LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/
+LIBS-$(CONFIG_SPL_IFC_SUPPORT) += drivers/misc/
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/
 LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/
 LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
Signature · 1 line
1.8.4
author
#2 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Using the TPL/SPL method to booting from 8k page NAND flash.
- Add 8kB size tlb for minimal SPL image;
- Add 256kB size SRAM tlb for second step booting;
- Add spl.c for TPL image boot;
- Add spl_minimal.c for minimal SPL image;
- Add C29XPCIE_NAND configure;
- Modify C29XPCIE.h for nand config and enviroment;

---
changes for v2:
- seperate the public code and c29xpcie board code;

 board/freescale/c29xpcie/Makefile      |  15 ++++
 board/freescale/c29xpcie/cpld.c        |   2 +
 board/freescale/c29xpcie/spl.c         |  73 ++++++++++++++++++
 board/freescale/c29xpcie/spl_minimal.c |  63 ++++++++++++++++
 board/freescale/c29xpcie/tlb.c         |  22 +++++-
 boards.cfg                             |   1 +
 include/configs/C29XPCIE.h             | 130 ++++++++++++++++++++++++++++++++-
 7 files changed, 300 insertions(+), 6 deletions(-)
 create mode 100644 board/freescale/c29xpcie/spl.c
 create mode 100644 board/freescale/c29xpcie/spl_minimal.c
board/freescale/c29xpcie/Makefile +15 -0
index 626d48a..818484a 100644
@@ -3,8 +3,23 @@
 #
 # SPDX-License-Identifier:	GPL-2.0+
 
+MINIMAL=
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+obj-y	+= spl_minimal.o tlb.o law.o
+else
+ifdef CONFIG_SPL_BUILD
+obj-y	+= spl.o
+endif
+
 obj-y	+= c29xpcie.o
 obj-y	+= cpld.o
 obj-y	+= ddr.o
 obj-y	+= law.o
 obj-y	+= tlb.o
+endif
board/freescale/c29xpcie/cpld.c +2 -0
index 5cbccff..37722da 100644
@@ -89,6 +89,7 @@ static void cpld_dump_regs(void)
 }
 #endif
 
+#ifndef CONFIG_SPL_BUILD
 int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int rc = 0;
@@ -129,3 +130,4 @@ U_BOOT_CMD(
 	"cpld_cmd dump - display the CPLD registers\n"
 #endif
 	);
+#endif
board/freescale/c29xpcie/spl.c new file +73 -0

73 lines not on this page · raw message

board/freescale/c29xpcie/spl_minimal.c new file +63 -0

63 lines not on this page · raw message

board/freescale/c29xpcie/tlb.c +20 -2
index 84844ee..11f8a37 100644
@@ -26,10 +26,20 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			0, 0, BOOKE_PAGESZ_4K, 0),
 
 	/* TLB 1 */
+#ifdef CONFIG_SPL_NAND_MINIMAL
+	SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 10, BOOKE_PAGESZ_4K, 1),
+	SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 11, BOOKE_PAGESZ_4K, 1),
+#endif
+
 	SET_TLB_ENTRY(1, CONFIG_SYS_CCSRBAR, CONFIG_SYS_CCSRBAR_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 0, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
 			0, 1, BOOKE_PAGESZ_64M, 1),
@@ -43,13 +53,14 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 3, BOOKE_PAGESZ_256K, 1),
 #endif
+#endif
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 4, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE,
@@ -61,7 +72,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 7, BOOKE_PAGESZ_256K, 1),
 
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || (defined(CONFIG_SPL) \
+		&& !defined(CONFIG_SPL_COMMON_INIT_DDR))
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE,
 			CONFIG_SYS_DDR_SDRAM_BASE,
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
@@ -71,6 +83,12 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_256M, 1),
 #endif
+
+#ifdef CONFIG_SYS_INIT_L2_ADDR
+	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
+		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
+		      0, 12, BOOKE_PAGESZ_256K, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +1 -0
index 114cc86..adcbbdf 100644
@@ -784,6 +784,7 @@ Active  powerpc     mpc85xx        -           freescale       bsc9132qds
 Active  powerpc     mpc85xx        -           freescale       bsc9132qds          BSC9132QDS_SPIFLASH_DDRCLK133        BSC9132QDS:BSC9132QDS,SPIFLASH,SYS_CLK_100_DDR_133                                                                                Naveen Burmi <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE                             C29XPCIE:C29XPCIE,36BIT                                                                                                           Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_SPIFLASH                    C29XPCIE:C29XPCIE,36BIT,SPIFLASH                                                                                                  Po Liu <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_NAND                        C29XPCIE:C29XPCIE,36BIT,NAND                                                                                                  Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS                              -                                                                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_NAND                         P3041DS:RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF80000                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_SDCARD                       P3041DS:RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF80000                                                                               -
include/configs/C29XPCIE.h +126 -4

184 lines not on this page · raw message

Signature · 1 line
1.8.4
#3 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 66 lines · Po Liu
board/freescale/c29xpcie/spl.c new file +60 -0
new file mode 100644
index 0000000..7bc8ce1
@@ -0,0 +1,73 @@
+/* Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <ns16550.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <nand.h>
+#include <i2c.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+ulong get_effective_memsize(void)
+{
+	return CONFIG_SYS_L2_SIZE;
+}
+
+void board_init_f(ulong bootflag)
+{
+	u32 plat_ratio;
+	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+	console_init_f();
+
+	/* initialize selected port with appropriate baud rate */
+	plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
+	plat_ratio >>= 1;
+	gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
+
+	NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+		     gd->bus_clk / 16 / CONFIG_BAUDRATE);
+
+	/* copy code to RAM and jump to it - this should not return */
+	/* NOTE - code has to be copied out of NAND buffer before
+	 * other blocks can be read.
+	 */
+	relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
+}
+
+void board_init_r(gd_t *gd, ulong dest_addr)
+{
+	/* Pointer is writable since we allocated a register for it */
+	gd = (gd_t *)CONFIG_SPL_GD_ADDR;
+	bd_t *bd;
+
+	memset(gd, 0, sizeof(gd_t));
+	bd = (bd_t *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t));
+	memset(bd, 0, sizeof(bd_t));
+	gd->bd = bd;
+	bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
+	bd->bi_memsize = CONFIG_SYS_L2_SIZE;
+
+	probecpu();
+	get_clocks();
+	mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
+			CONFIG_SPL_RELOC_MALLOC_SIZE);
+
+	/* relocate environment function pointers etc. */

board/freescale/c29xpcie/spl.c line 70

Quoted 10 lines
board/freescale/c29xpcie/spl.c new file +10 -0
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			  (uchar *)CONFIG_ENV_ADDR);
+			  gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
+	gd->env_valid = 1;
+
+	i2c_init_all();
+
+	gd->ram_size = initdram(0);
+
+	puts("\nTertiary program loader running in sram...");

Why do you assume tertiary? Couldn't this be SPL for SD/SPI? Or was it a copy/paste error that you added things to the board config file for SD/SPI (after all, the subject line says it's a NAND patch)?

board/freescale/c29xpcie/spl.c line 73

Quoted 3 lines
board/freescale/c29xpcie/spl.c new file +3 -0
+void board_init_r(gd_t *gd, ulong dest_addr)
+{
+	puts("\nSecond program loader running in sram...");

I see that this isn't new to this patch, but we ought to be consistent and either change this to "secondary", or change "tertiary" to "third".

It's also probably too verbose... Simply saying "SPL\n" or "TPL\n" would suffice to indicate progress and verify that console output is working (if nothing is printed, then that path doesn't get tested in the absence of a load error).

Quoted 6 lines
board/freescale/c29xpcie/tlb.c +0 -0
index 84844ee..11f8a37 100644
@@ -26,10 +26,20 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			0, 0, BOOKE_PAGESZ_4K, 0),

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 36

Quoted 10 lines
board/freescale/c29xpcie/tlb.c +8 -0
 
 	/* TLB 1 */
+#ifdef CONFIG_SPL_NAND_MINIMAL
+	SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 10, BOOKE_PAGESZ_4K, 1),
+	SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 11, BOOKE_PAGESZ_4K, 1),
+#endif

CONFIG_SPL_NAND_MINIMAL should not exist. It was introduced by accident after a different approach was chosen in patch review (and even then, this wasn't what it meant).

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing boards?

If this needs to be ifdeffed (and it probably does, if only to avoid possible speculative instruction fetches), use (and document) CONFIG_SPL_NAND_BOOT.

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 64

Quoted 4 lines
board/freescale/c29xpcie/tlb.c +1 -1
 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),

No.

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 79

Quoted 11 lines
board/freescale/c29xpcie/tlb.c +2 -1
 	SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE,
@@ -61,7 +72,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 7, BOOKE_PAGESZ_256K, 1),
 
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || (defined(CONFIG_SPL) \
+		&& !defined(CONFIG_SPL_COMMON_INIT_DDR))
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE,
 			CONFIG_SYS_DDR_SDRAM_BASE,
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,

This will have the result of mapping DDR in the SPL where it's not used, but not in the TPL where it is.

-Scott

#4 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 99 lines · Scott Wood
Quoted 66 lines · Po Liu
board/freescale/c29xpcie/spl.c new file +60 -0
new file mode 100644
index 0000000..7bc8ce1
@@ -0,0 +1,73 @@
+/* Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <ns16550.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <nand.h>
+#include <i2c.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+ulong get_effective_memsize(void)
+{
+	return CONFIG_SYS_L2_SIZE;
+}
+
+void board_init_f(ulong bootflag)
+{
+	u32 plat_ratio;
+	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+	console_init_f();
+
+	/* initialize selected port with appropriate baud rate */
+	plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
+	plat_ratio >>= 1;
+	gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
+
+	NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+		     gd->bus_clk / 16 / CONFIG_BAUDRATE);
+
+	/* copy code to RAM and jump to it - this should not return */
+	/* NOTE - code has to be copied out of NAND buffer before
+	 * other blocks can be read.
+	 */
+	relocate_code(CONFIG_SPL_RELOC_STACK, 0, CONFIG_SPL_RELOC_TEXT_BASE);
+}
+
+void board_init_r(gd_t *gd, ulong dest_addr)
+{
+	/* Pointer is writable since we allocated a register for it */
+	gd = (gd_t *)CONFIG_SPL_GD_ADDR;
+	bd_t *bd;
+
+	memset(gd, 0, sizeof(gd_t));
+	bd = (bd_t *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t));
+	memset(bd, 0, sizeof(bd_t));
+	gd->bd = bd;
+	bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
+	bd->bi_memsize = CONFIG_SYS_L2_SIZE;
+
+	probecpu();
+	get_clocks();
+	mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
+			CONFIG_SPL_RELOC_MALLOC_SIZE);
+
+	/* relocate environment function pointers etc. */

board/freescale/c29xpcie/spl.c line 70

Quoted 10 lines
board/freescale/c29xpcie/spl.c new file +10 -0
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			  (uchar *)CONFIG_ENV_ADDR);
+			  gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
+	gd->env_valid = 1;
+
+	i2c_init_all();
+
+	gd->ram_size = initdram(0);
+
+	puts("\nTertiary program loader running in sram...");

Why do you assume tertiary? Couldn't this be SPL for SD/SPI? Or was it a copy/paste error that you added things to the board config file for SD/SPI (after all, the subject line says it's a NAND patch)?

board/freescale/c29xpcie/spl.c line 73

Quoted 3 lines
board/freescale/c29xpcie/spl.c new file +3 -0
+void board_init_r(gd_t *gd, ulong dest_addr)
+{
+	puts("\nSecond program loader running in sram...");

I see that this isn't new to this patch, but we ought to be consistent and either change this to "secondary", or change "tertiary" to "third".

It's also probably too verbose... Simply saying "SPL\n" or "TPL\n" would suffice to indicate progress and verify that console output is working (if nothing is printed, then that path doesn't get tested in the absence of a load error).

Quoted 7 lines
board/freescale/c29xpcie/tlb.c +0 -0
index 84844ee..11f8a37 100644
@@ -26,10 +26,20 @@ struct fsl_e_tlb_entry tlb_table[] = {
  			0, 0, BOOKE_PAGESZ_4K, 0),
 
Quoted 12 lines

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 36

Quoted 9 lines
board/freescale/c29xpcie/tlb.c +8 -0
  	/* TLB 1 */
+#ifdef CONFIG_SPL_NAND_MINIMAL
+	SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 10, BOOKE_PAGESZ_4K, 1),
+	SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			0, 11, BOOKE_PAGESZ_4K, 1),
+#endif

CONFIG_SPL_NAND_MINIMAL should not exist. It was introduced by accident after a different approach was chosen in patch review (and even then, this wasn't what it meant).

I was not aware of this. My mistake :(

Quoted 2 lines

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing boards?

both entry should not be in ifdef. p1010rdb/bsc9131rdb/bsc9132qds does not have this.
i dont think NOR boot tested after this patch. NOR boot will not work after applying this patch.

Quoted 3 lines

If this needs to be ifdeffed (and it probably does, if only to avoid possible speculative instruction fetches), use (and document) CONFIG_SPL_NAND_BOOT.

Yes, I will suggest to have CONFIG_SPL_NAND_BOOT instead of CONFIG_SPL_NAND_MINIMAL.
I will fix for p1010rdb, bsc9131rdb, bsc9132qds.

Regards,
Prabhakar

#5 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 8 lines · Prabhakar Kushwaha
Quoted 2 lines · Scott Wood

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing boards?

both entry should not be in ifdef. p1010rdb/bsc9131rdb/bsc9132qds does not have this.
i dont think NOR boot tested after this patch. NOR boot will not work after applying this patch.

So what happens if there's a speculative access to the non-ifdeffed 0xfffff000 when we're not booting from that (e.g. ramboot, SPL payload, SD/SPI...)?

-Scott

#6 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 4 lines · Scott Wood
Quoted 3 lines · Prabhakar Kushwaha
Quoted 2 lines · Scott Wood

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing boards?

Quoted 9 lines
Quoted 4 lines

both entry should not be in ifdef. p1010rdb/bsc9131rdb/bsc9132qds does not have this.
i dont think NOR boot tested after this patch. NOR boot will not work after applying this patch.

So what happens if there's a speculative access to the non-ifdeffed 0xfffff000 when we're not booting from that (e.g. ramboot, SPL payload, SD/SPI...)?

If I understand the question correctly,
Ideally ramboot, SPL payload, SD/SPI should not make access to this
address. They assumed to be running from DDR whose TLB has already been created by IBR, or First stage boot loader.

do you see any such requirement

Regards,
Pabhakar

#7 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 14 lines · Prabhakar Kushwaha
Quoted 4 lines · Scott Wood
Quoted 3 lines · Prabhakar Kushwaha
Quoted 2 lines · Scott Wood

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing boards?

Quoted 9 lines
Quoted 4 lines

both entry should not be in ifdef. p1010rdb/bsc9131rdb/bsc9132qds does not have this.
i dont think NOR boot tested after this patch. NOR boot will not work after applying this patch.

So what happens if there's a speculative access to the non-ifdeffed 0xfffff000 when we're not booting from that (e.g. ramboot, SPL payload, SD/SPI...)?

Quoted 4 lines

If I understand the question correctly,
Ideally ramboot, SPL payload, SD/SPI should not make access to this
address. They assumed to be running from DDR whose TLB has already been created by IBR, or First stage boot loader.

Speculative accesses don't come (directly) from software. They are initiated by the hardware and are not predictable.

-Scott

A message that is not in the archive (sent off-list or not yet received): 5d27987f1d694ae9977cba2e8a78d843@DM2PR03MB317.namprd03.prod.outlook.com

#9 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 26 lines

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com]
Sent: Wednesday, December 11, 2013 2:20 AM
To: Kushwaha Prabhakar-B32579
Cc: Liu Po-B43644; u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [PATCH v2 2/2] powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 5 lines · Prabhakar Kushwaha
Quoted 4 lines · Scott Wood
Quoted 3 lines · Prabhakar Kushwaha
Quoted 2 lines · Scott Wood

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing

boards?

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

both entry should not be in ifdef. p1010rdb/bsc9131rdb/bsc9132qds does not have this.
i dont think NOR boot tested after this patch. NOR boot will not work after applying this patch.

So what happens if there's a speculative access to the non-ifdeffed 0xfffff000 when we're not booting from that (e.g. ramboot, SPL payload, SD/SPI...)?

Quoted 7 lines
Quoted 4 lines

If I understand the question correctly,
Ideally ramboot, SPL payload, SD/SPI should not make access to
this address. They assumed to be running from DDR whose TLB has already been created by IBR, or First stage boot loader.

Speculative accesses don't come (directly) from software. They are initiated by the hardware and are not predictable.

Remove the:
-#ifdef CONFIG_SPL_NAND_MINIMAL
- SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
- MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
- 0, 10, BOOKE_PAGESZ_4K, 1),
- SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
- MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
- 0, 11, BOOKE_PAGESZ_4K, 1),
-#endif
Do not effect the NAND/NOR boot after I test on C29XPCIE.

Quoted 4 lines

-Scott

#10 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

In reply to a message not in the archive
Quoted 40 lines · On 12/11/2013 8:24 AM, Liu Po-B43644 wrote:
Quoted 24 lines

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com]
Sent: Wednesday, December 11, 2013 2:20 AM
To: Kushwaha Prabhakar-B32579
Cc: Liu Po-B43644; u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [PATCH v2 2/2] powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 5 lines · Prabhakar Kushwaha
Quoted 4 lines · Scott Wood
Quoted 3 lines · Prabhakar Kushwaha
Quoted 2 lines · Scott Wood

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing

boards?

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

both entry should not be in ifdef. p1010rdb/bsc9131rdb/bsc9132qds does not have this.
i dont think NOR boot tested after this patch. NOR boot will not work after applying this patch.

So what happens if there's a speculative access to the non-ifdeffed 0xfffff000 when we're not booting from that (e.g. ramboot, SPL payload, SD/SPI...)?

Quoted 7 lines
Quoted 4 lines

If I understand the question correctly,
Ideally ramboot, SPL payload, SD/SPI should not make access to
this address. They assumed to be running from DDR whose TLB has already been created by IBR, or First stage boot loader.

Speculative accesses don't come (directly) from software. They are initiated by the hardware and are not predictable.

Remove the:

(quoted diff) +0 -8
-#ifdef CONFIG_SPL_NAND_MINIMAL
-       SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
-                       MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                       0, 10, BOOKE_PAGESZ_4K, 1),
-       SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
-                       MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
-                       0, 11, BOOKE_PAGESZ_4K, 1),
-#endif
Quoted 2 lines

Do not effect the NAND/NOR boot after I test in C29XPCIE.

I just wonder how it is working without both TLBs. I can guess what is happening
- NOR boot: After coming to AS1--> AS0, system is running with NOR
TLB entry
- NAND boot: after coming to AS1--> AS0, It is
usingCONFIG_SYS_INIT_L2_ADDR TLB entry

so, it can be removed for c293PCIe.

Regards,
Prabhakar

#11 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

In reply to Scott Wood
Quoted 15 lines · Scott Wood
Quoted 14 lines · Prabhakar Kushwaha
Quoted 13 lines · Scott Wood
Quoted 7 lines · Prabhakar Kushwaha
Quoted 2 lines · Scott Wood

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing boards?

both entry should not be in ifdef. p1010rdb/bsc9131rdb/bsc9132qds does not have this.
i dont think NOR boot tested after this patch. NOR boot will not work after applying this patch.

So what happens if there's a speculative access to the non-ifdeffed 0xfffff000 when we're not booting from that (e.g. ramboot, SPL payload, SD/SPI...)?

Quoted 8 lines
Quoted 4 lines

If I understand the question correctly,
Ideally ramboot, SPL payload, SD/SPI should not make access to this
address. They assumed to be running from DDR whose TLB has already been created by IBR, or First stage boot loader.

Speculative accesses don't come (directly) from software. They are initiated by the hardware and are not predictable.

Please help me in understanding this.
What are the scenario where it is possible? means how hardware can
initiate any access?
do hardware initiated transaction require TLB?

Regards,
Prabhakar

#12 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 25 lines · Prabhakar Kushwaha
Quoted 15 lines · Scott Wood
Quoted 14 lines · Prabhakar Kushwaha
Quoted 13 lines · Scott Wood
Quoted 7 lines · Prabhakar Kushwaha
Quoted 2 lines · Scott Wood

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing boards?

both entry should not be in ifdef. p1010rdb/bsc9131rdb/bsc9132qds does not have this.
i dont think NOR boot tested after this patch. NOR boot will not work after applying this patch.

So what happens if there's a speculative access to the non-ifdeffed 0xfffff000 when we're not booting from that (e.g. ramboot, SPL payload, SD/SPI...)?

Quoted 8 lines
Quoted 4 lines

If I understand the question correctly,
Ideally ramboot, SPL payload, SD/SPI should not make access to this
address. They assumed to be running from DDR whose TLB has already been created by IBR, or First stage boot loader.

Speculative accesses don't come (directly) from software. They are initiated by the hardware and are not predictable.

Quoted 4 lines

Please help me in understanding this.
What are the scenario where it is possible? means how hardware can
initiate any access?
do hardware initiated transaction require TLB?

Any mapping that is in the TLB can be used for speculative reads (except that the guarded bit or lack of read permission inhibits speculative data reads, and the lack of execute permission inhibits speculative instruction fetches). Any TLB where speculative reads aren't inhibited as described must be backed by something memory-like.

The CPU will do this when it predicts that it will need data from that address, though sometimes the predictions are wrong.

-Scott

A message that is not in the archive (sent off-list or not yet received): c957f7e802e245488c0c0e0fc0f425ed@DM2PR03MB317.namprd03.prod.outlook.com

#14 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Sorry for late reply since the email system crash.

Quoted 80 lines

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com]
Sent: Saturday, December 07, 2013 9:22 AM
To: Liu Po-B43644
Cc: u-boot at lists.denx.de; Sun York-R58495; Kushwaha Prabhakar-B32579
Subject: Re: [PATCH v2 2/2] powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 71 lines · Po Liu
(quoted diff) +0 -0

b/board/freescale/c29xpcie/spl.c new file mode 100644 index 0000000..7bc8ce1

board/freescale/c29xpcie/spl.c new file +65 -0
@@ -0,0 +1,73 @@
+/* Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <ns16550.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <nand.h>
+#include <i2c.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+ulong get_effective_memsize(void)
+{
+  return CONFIG_SYS_L2_SIZE;
+}
+
+void board_init_f(ulong bootflag)
+{
+  u32 plat_ratio;
+  ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+  console_init_f();
+
+  /* initialize selected port with appropriate baud rate */
+  plat_ratio = in_be32(&gur->porpllsr) & MPC85xx_PORPLLSR_PLAT_RATIO;
+  plat_ratio >>= 1;
+  gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
+
+  NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+               gd->bus_clk / 16 / CONFIG_BAUDRATE);
+
+  /* copy code to RAM and jump to it - this should not return */
+  /* NOTE - code has to be copied out of NAND buffer before
+   * other blocks can be read.
+   */
+  relocate_code(CONFIG_SPL_RELOC_STACK, 0,
+CONFIG_SPL_RELOC_TEXT_BASE); }
+
+void board_init_r(gd_t *gd, ulong dest_addr) {
+  /* Pointer is writable since we allocated a register for it */
+  gd = (gd_t *)CONFIG_SPL_GD_ADDR;
+  bd_t *bd;
+
+  memset(gd, 0, sizeof(gd_t));
+  bd = (bd_t *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t));
+  memset(bd, 0, sizeof(bd_t));
+  gd->bd = bd;
+  bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
+  bd->bi_memsize = CONFIG_SYS_L2_SIZE;
+
+  probecpu();
+  get_clocks();
+  mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
+                  CONFIG_SPL_RELOC_MALLOC_SIZE);
+
+  /* relocate environment function pointers etc. */
+  nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+                    (uchar *)CONFIG_ENV_ADDR);
+                    gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
+  gd->env_valid = 1;
+
+  i2c_init_all();
Quoted 9 lines

board/freescale/c29xpcie/spl.c line 70

Quoted 4 lines
board/freescale/c29xpcie/spl.c new file +4 -0
+
+  gd->ram_size = initdram(0);
+
+  puts("\nTertiary program loader running in sram...");

Why do you assume tertiary? Couldn't this be SPL for SD/SPI? Or was it a copy/paste error that you added things to the board config file for SD/SPI (after all, the subject line says it's a NAND patch)?

Yes, I assume this patch only for NAND boot for C29XPCIE.

Quoted 32 lines

board/freescale/c29xpcie/spl.c line 71

Quoted 2 lines
board/freescale/c29xpcie/spl.c new file +2 -0
+void board_init_r(gd_t *gd, ulong dest_addr) {
+  puts("\nSecond program loader running in sram...");

I see that this isn't new to this patch, but we ought to be consistent and either change this to "secondary", or change "tertiary" to "third".

It's also probably too verbose... Simply saying "SPL\n" or "TPL\n" would suffice to indicate progress and verify that console output is working (if nothing is printed, then that path doesn't get tested in the absence of a load error).

Quoted 6 lines
(quoted diff) +0 -0

b/board/freescale/c29xpcie/tlb.c index 84844ee..11f8a37 100644

board/freescale/c29xpcie/tlb.c +0 -0
@@ -26,10 +26,20 @@ struct fsl_e_tlb_entry tlb_table[] = {
                    0, 0, BOOKE_PAGESZ_4K, 0),

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 36

Quoted 10 lines
board/freescale/c29xpcie/tlb.c +8 -0
 
    /* TLB 1 */
+#ifdef CONFIG_SPL_NAND_MINIMAL
+  SET_TLB_ENTRY(1, 0xfffff000, 0xfffff000,
+                  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+                  0, 10, BOOKE_PAGESZ_4K, 1),
+  SET_TLB_ENTRY(1, 0xffffe000, 0xffffe000,
+                  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+                  0, 11, BOOKE_PAGESZ_4K, 1),
+#endif

CONFIG_SPL_NAND_MINIMAL should not exist. It was introduced by accident after a different approach was chosen in patch review (and even then, this wasn't what it meant).

Quoted 6 lines

Prabhakar, why did you extend that to other uses? Why are both entries ifdeffed here, but only the 0xffffe000 entry on existing boards?

If this needs to be ifdeffed (and it probably does, if only to avoid possible speculative instruction fetches), use (and document) CONFIG_SPL_NAND_BOOT.

I'll replace the CONFIG_SPL_NAND_MINIMAL with CONFIG_SPL_NAND_BOOT

Quoted 13 lines

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 64

Quoted 5 lines
board/freescale/c29xpcie/tlb.c +1 -1
    SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-                  MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+                  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
                    0, 5, BOOKE_PAGESZ_64K, 1),

No.

Quoted 5 lines
board/freescale/c29xpcie/tlb.c +0 -0
    SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE, @@ -61,7 +72,8 @@
 struct fsl_e_tlb_entry tlb_table[] = {
                    MAS3_SX|MAS3_SW|MAS3_SR, 0,
                    0, 7, BOOKE_PAGESZ_256K, 1),
Quoted 9 lines

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 79

Quoted 6 lines
board/freescale/c29xpcie/tlb.c +2 -1
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || (defined(CONFIG_SPL) \
+          && !defined(CONFIG_SPL_COMMON_INIT_DDR))
    SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE,
                    CONFIG_SYS_DDR_SDRAM_BASE,
                    MAS3_SX|MAS3_SW|MAS3_SR, 0,

This will have the result of mapping DDR in the SPL where it's not used, but not in the TPL where it is.

Just define:
#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SPL) ?
I think code load image to SRAM from NAND for SPL and DDR do not need to be allocate.

Quoted 4 lines

-Scott

#15 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 92 lines · On Tue, 2013-12-10 at 20:46 -0600, Liu Po-B43644 wrote:

Sorry for late reply since the email system crash.

Quoted 5 lines

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com]
Sent: Saturday, December 07, 2013 9:22 AM
To: Liu Po-B43644
Cc: u-boot at lists.denx.de; Sun York-R58495; Kushwaha

Prabhakar-B32579

Quoted 1 line

Subject: Re: [PATCH v2 2/2] powerpc/c29xpcie: 8k page size NAND

boot

Quoted 29 lines

support base on TPL/SPL

Quoted 26 lines · Po Liu
(quoted diff) +0 -0

b/board/freescale/c29xpcie/spl.c new file mode 100644 index 0000000..7bc8ce1

board/freescale/c29xpcie/spl.c new file +20 -0
@@ -0,0 +1,73 @@
+/* Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <ns16550.h>
+#include <malloc.h>
+#include <mmc.h>
+#include <nand.h>
+#include <i2c.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+ulong get_effective_memsize(void)
+{
+  return CONFIG_SYS_L2_SIZE;
+}
+
+void board_init_f(ulong bootflag)
Quoted 8 lines

board/freescale/c29xpcie/spl.c

Quoted 8 lines
board/freescale/c29xpcie/spl.c new file +8 -0
+{
+  u32 plat_ratio;
+  ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+  console_init_f();
+
+  /* initialize selected port with appropriate baud rate */
+  plat_ratio = in_be32(&gur->porpllsr) &

MPC85xx_PORPLLSR_PLAT_RATIO;

Quoted 42 lines
Quoted 41 lines
board/freescale/c29xpcie/spl.c new file +41 -0
+  plat_ratio >>= 1;
+  gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
+
+  NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+               gd->bus_clk / 16 / CONFIG_BAUDRATE);
+
+  /* copy code to RAM and jump to it - this should not return */
+  /* NOTE - code has to be copied out of NAND buffer before
+   * other blocks can be read.
+   */
+  relocate_code(CONFIG_SPL_RELOC_STACK, 0,
+CONFIG_SPL_RELOC_TEXT_BASE); }
+
+void board_init_r(gd_t *gd, ulong dest_addr) {
+  /* Pointer is writable since we allocated a register for it */
+  gd = (gd_t *)CONFIG_SPL_GD_ADDR;
+  bd_t *bd;
+
+  memset(gd, 0, sizeof(gd_t));
+  bd = (bd_t *)(CONFIG_SPL_GD_ADDR + sizeof(gd_t));
+  memset(bd, 0, sizeof(bd_t));
+  gd->bd = bd;
+  bd->bi_memstart = CONFIG_SYS_INIT_L2_ADDR;
+  bd->bi_memsize = CONFIG_SYS_L2_SIZE;
+
+  probecpu();
+  get_clocks();
+  mem_malloc_init(CONFIG_SPL_RELOC_MALLOC_ADDR,
+                  CONFIG_SPL_RELOC_MALLOC_SIZE);
+
+  /* relocate environment function pointers etc. */
+  nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+                    (uchar *)CONFIG_ENV_ADDR);
+                    gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
+  gd->env_valid = 1;
+
+  i2c_init_all();
+
+  gd->ram_size = initdram(0);
+
+  puts("\nTertiary program loader running in sram...");
Quoted 7 lines
Quoted 1 line

Why do you assume tertiary? Couldn't this be SPL for SD/SPI? Or

was it

Quoted 1 line

a copy/paste error that you added things to the board config file

for

Quoted 2 lines

SD/SPI (after all, the subject line says it's a NAND patch)?

Yes, I assume this patch only for NAND boot for C29XPCIE.

Then why did you add a "#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)" section in the board config file?

-Scott

A message that is not in the archive (sent off-list or not yet received): ce05f24a72e0474f82d7f99c215353e6@DM2PR03MB317.namprd03.prod.outlook.com

#17 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 8 lines

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 64

Quoted 6 lines

SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,

board/freescale/c29xpcie/tlb.c +1 -1
-                  MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+                  MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
                    0, 5, BOOKE_PAGESZ_64K, 1),

No.

Without MAS3_SX, the board can't run in booting from NAND.

Quoted 6 lines
Quoted 6 lines
    SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE, @@ -61,7 +72,8 @@
struct fsl_e_tlb_entry tlb_table[] = {
                    MAS3_SX|MAS3_SW|MAS3_SR, 0,
                    0, 7, BOOKE_PAGESZ_256K, 1),
Quoted 9 lines

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 79

Quoted 6 lines
board/freescale/c29xpcie/tlb.c +2 -1
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || (defined(CONFIG_SPL) \
+          && !defined(CONFIG_SPL_COMMON_INIT_DDR))
    SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE,
                    CONFIG_SYS_DDR_SDRAM_BASE,
                    MAS3_SX|MAS3_SW|MAS3_SR, 0,

This will have the result of mapping DDR in the SPL where it's not used, but not in the TPL where it is.

For the TPL the ddr initial by initdram(), so don't need to mapping ddr here.
I intend to change it to #if defined(CONFIG_SYS_RAMBOOT) || !defined(CONFIG_SPL_COMMON_INIT_DDR) Is it more clear?

Quoted 4 lines

-Scott

-Po Liu

#18 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

In reply to a message not in the archive
Quoted 7 lines · On Wed, 2013-12-11 at 00:16 -0600, Liu Po-B43644 wrote:
Quoted 6 lines

board/freescale/c29xpcie/tlb.c struct fsl_e_tlb_entry tlb_table[] = { · line 64

Quoted 4 lines
board/freescale/c29xpcie/tlb.c +1 -1
 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),

No.

Without MAS3_SX, the board can't run in booting from NAND.

Explain why you're executing from this TLB entry. This should be for accessing the NAND as I/O after you've relocated away from the boot buffer. There should be a different mapping for the boot buffer early on. None of the other NAND boot targets have needed this. Perhaps this is related to the other TLB entry that you said you could work without.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE, @@ -61,7 +72,8 @@
struct fsl_e_tlb_entry tlb_table[] = {

board/freescale/c29xpcie/tlb.c +2 -1
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 7, BOOKE_PAGESZ_256K, 1),
 
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || (defined(CONFIG_SPL) \
+		&& !defined(CONFIG_SPL_COMMON_INIT_DDR))
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE,
 			CONFIG_SYS_DDR_SDRAM_BASE,
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
Quoted 5 lines
Quoted 2 lines

This will have the result of mapping DDR in the SPL where it's not used, but not in the TPL where it is.

For the TPL the ddr initial by initdram(), so don't need to mapping ddr here.
I intend to change it to #if defined(CONFIG_SYS_RAMBOOT) || !defined(CONFIG_SPL_COMMON_INIT_DDR) Is it more clear?

No, you'll still end up mapping it in the SPL (when DDR hasn't been set up yet, so again there could be speculative accesses causing machine checks), and that change would make the mapping happen in ordinary NOR boot as well (where it would duplicate what initdram() does). We only want this TLB entry in phases that are booting out of DDR.

How about:

#if defined(CONFIG_SYS_RAMBOOT) || \
	(defined(CONFIG_SPL) && !defined(CONFIG_SPL_BUILD))

...with the assumption that all SPLs for a given board will either put the final U-boot in DDR or SRAM, and the board tlb.c knows the difference.

-Scott

A message that is not in the archive (sent off-list or not yet received): 8cbfa2585cd04b348c5883a628e3a33c@DM2PR03MB317.namprd03.prod.outlook.com

#20 lore raw

PATCH v2 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 23 lines · On Fri, 2013-12-13 at 21:09 -0600, Liu Po-B43644 wrote:
Quoted 15 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Saturday, December 14, 2013 4:26 AM
To: Liu Po-B43644
Cc: u-boot at lists.denx.de; Sun York-R58495; Kushwaha Prabhakar-B32579
Subject: Re: [PATCH v2 2/2] powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 1 line · On Wed, 2013-12-11 at 00:16 -0600, Liu Po-B43644 wrote:
Quoted 1 line
Quoted 1 line

SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE,

CONFIG_SYS_NAND_BASE_PHYS,

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
board/freescale/c29xpcie/tlb.c +1 -1
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),
Quoted 8 lines
Quoted 2 lines
Quoted 1 line

No.

Without MAS3_SX, the board can't run in booting from NAND.

Explain why you're executing from this TLB entry. This should be for accessing the NAND as I/O after you've relocated away from the boot buffer. There should be a different mapping for the boot buffer early on. None of the other NAND boot targets have needed this. Perhaps this is related to the other TLB entry that you said you could work without.

Quoted 4 lines

This is because for SPL, the
#define CONFIG_SPL_TEXT_BASE 0xff800000
#define CONFIG_SYS_NAND_BASE 0xff800000
Code space overlap the nand io space.

OK, I guess we move the NAND buffer before relocating out of it. And for some reason I missed that existing targets do the same thing. Never mind...

-Scott

author
#21 lore raw

PATCH v3 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

In reply to Po Liu

Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot.

- For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec.
- Use a clear function name for nand spl boot.
- Add CONFIG_SPL_IFC_SUPPORT to compile the fsl_ifc.c in spl/Makefile;

---
changes for v2:
- seperate public code and c29xpcie board code
- add ifc support
changes for v3:
- remove the redundant plus
- ifc support use CONFIG_SPL_DRIVERS_MISC_SUPPORT

 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++-------
 drivers/mtd/nand/fsl_ifc_spl.c          | 29 +++++++++++++++++++++++------
 spl/Makefile                            |  1 +
 3 files changed, 32 insertions(+), 13 deletions(-)
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +8 -7
index bc13267..acaa093 100644
@@ -57,7 +57,14 @@ SECTIONS
 	. = ALIGN(8);
 	__init_begin = .;
 	__init_end = .;
-/* FIXME for non-NAND SPL */
+
+/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+	.bootpg ADDR(.text) - 0x1000 :
+	{
+		KEEP(*(.bootpg))
+	} :text = 0xffff
+#else
 #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
 	.bootpg ADDR(.text) + 0x1000 :
 	{
@@ -69,12 +76,6 @@ SECTIONS
 #else
 #error unknown NAND controller
 #endif
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-	.bootpg ADDR(.text) - 0x1000 :
-	{
-		KEEP(*(.bootpg))
-	} :text = 0xffff
-#else
 	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
 		KEEP(*(.resetvec))
 	} = 0xffff
drivers/mtd/nand/fsl_ifc_spl.c +23 -6
index 9de327b..28656f2 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
+#ifdef CONFIG_TPL_BUILD
+void nand_spl_load_image(uint32_t offs, int uboot_size, void *vdst)
+#else
 static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#endif
 {
 	struct fsl_ifc *ifc = IFC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
@@ -105,6 +109,9 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	int sram_addr;
 	int pg_no;
+#ifdef CONFIG_TPL_BUILD
+	uchar *dst = vdst;
+#endif
 
 	/* Get NAND Flash configuration */
 	csor = CONFIG_SYS_NAND_CSOR;
@@ -211,6 +218,15 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 }
 
 /*
+ * Defines a static function nand_load_image() here, because non-static makes
+ * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
+ */
+#ifndef CONFIG_TPL_BUILD
+#define nand_spl_load_image(offs, uboot_size, dst) \
+	nand_load(offs, uboot_size, dst)
+#endif
+
+/*
  * Main entrypoint for NAND Boot. It's necessary that SDRAM is already
  * configured and available since this code loads the main U-boot image
  * from NAND into SDRAM and starts from there.
@@ -221,16 +237,17 @@ void nand_boot(void)
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
-		  (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			    CONFIG_SYS_NAND_U_BOOT_SIZE,
+			    (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST);
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
+	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
 	/*
spl/Makefile +1 -0
index 2a787af..7e2adf9 100644
@@ -79,6 +79,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \
 	drivers/power/pmic/
 LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/
+LIBS-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/
 LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/
 LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
Signature · 1 line
1.8.0
author
#22 lore raw

PATCH v3 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Using the TPL/SPL method to booting from 8k page NAND flash.
- Add 256kB size SRAM tlb for second step booting;
- Add spl.c for TPL image boot;
- Add spl_minimal.c for minimal SPL image;
- Add C29XPCIE_NAND configure;
- Modify C29XPCIE.h for nand config and enviroment;

---
changes for v2:
- seperate the public code and c29xpcie board code;
changes for v3:
- booting log simple to "SPL" "TPL"
- remove the 8k TLB from 0xffffe000 to 0xffffffff
- change the ddr tlb mapping condition

 board/freescale/c29xpcie/Makefile      |  15 ++++
 board/freescale/c29xpcie/cpld.c        |   2 +
 board/freescale/c29xpcie/spl.c         |  77 +++++++++++++++++++
 board/freescale/c29xpcie/spl_minimal.c |  63 ++++++++++++++++
 board/freescale/c29xpcie/tlb.c         |  13 +++-
 boards.cfg                             |   1 +
 include/configs/C29XPCIE.h             | 130 ++++++++++++++++++++++++++++++++-
 7 files changed, 295 insertions(+), 6 deletions(-)
 create mode 100644 board/freescale/c29xpcie/spl.c
 create mode 100644 board/freescale/c29xpcie/spl_minimal.c
board/freescale/c29xpcie/Makefile +15 -0
index 626d48a..818484a 100644
@@ -3,8 +3,23 @@
 #
 # SPDX-License-Identifier:	GPL-2.0+
 
+MINIMAL=
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+obj-y	+= spl_minimal.o tlb.o law.o
+else
+ifdef CONFIG_SPL_BUILD
+obj-y	+= spl.o
+endif
+
 obj-y	+= c29xpcie.o
 obj-y	+= cpld.o
 obj-y	+= ddr.o
 obj-y	+= law.o
 obj-y	+= tlb.o
+endif
board/freescale/c29xpcie/cpld.c +2 -0
index 5cbccff..37722da 100644
@@ -89,6 +89,7 @@ static void cpld_dump_regs(void)
 }
 #endif
 
+#ifndef CONFIG_SPL_BUILD
 int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int rc = 0;
@@ -129,3 +130,4 @@ U_BOOT_CMD(
 	"cpld_cmd dump - display the CPLD registers\n"
 #endif
 	);
+#endif
board/freescale/c29xpcie/spl.c new file +77 -0

77 lines not on this page · raw message

board/freescale/c29xpcie/spl_minimal.c new file +63 -0

63 lines not on this page · raw message

board/freescale/c29xpcie/tlb.c +11 -2
index 84844ee..c5abed0 100644
@@ -30,6 +30,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 0, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
 			0, 1, BOOKE_PAGESZ_64M, 1),
@@ -43,13 +44,14 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 3, BOOKE_PAGESZ_256K, 1),
 #endif
+#endif
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 4, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE,
@@ -61,7 +63,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 7, BOOKE_PAGESZ_256K, 1),
 
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || \
+		(defined(CONFIG_SPL) && !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,
@@ -71,6 +74,12 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_256M, 1),
 #endif
+
+#ifdef CONFIG_SYS_INIT_L2_ADDR
+	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
+		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
+		      0, 12, BOOKE_PAGESZ_256K, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +1 -0
index 114cc86..adcbbdf 100644
@@ -784,6 +784,7 @@ Active  powerpc     mpc85xx        -           freescale       bsc9132qds
 Active  powerpc     mpc85xx        -           freescale       bsc9132qds          BSC9132QDS_SPIFLASH_DDRCLK133        BSC9132QDS:BSC9132QDS,SPIFLASH,SYS_CLK_100_DDR_133                                                                                Naveen Burmi <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE                             C29XPCIE:C29XPCIE,36BIT                                                                                                           Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_SPIFLASH                    C29XPCIE:C29XPCIE,36BIT,SPIFLASH                                                                                                  Po Liu <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_NAND                        C29XPCIE:C29XPCIE,36BIT,NAND                                                                                                  Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS                              -                                                                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_NAND                         P3041DS:RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF80000                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_SDCARD                       P3041DS:RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF80000                                                                               -
include/configs/C29XPCIE.h +126 -4

184 lines not on this page · raw message

Signature · 1 line
1.8.0
#23 lore raw

PATCH v3 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

In reply to Po Liu
Quoted 17 lines · Po Liu
drivers/mtd/nand/fsl_ifc_spl.c +4 -0
index 9de327b..28656f2 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
+#ifdef CONFIG_TPL_BUILD
+void nand_spl_load_image(uint32_t offs, int uboot_size, void *vdst)
+#else
 static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#endif
 {
 	struct fsl_ifc *ifc = IFC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;

drivers/mtd/nand/fsl_ifc_spl.c static void nand_load(unsigned int offs, int uboot_size, uchar *dst) · line 114

Quoted 6 lines
drivers/mtd/nand/fsl_ifc_spl.c +3 -0
@@ -105,6 +109,9 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	int sram_addr;
 	int pg_no;
+#ifdef CONFIG_TPL_BUILD
+	uchar *dst = vdst;
+#endif

Please change the static function signature to match, as fsl_elbc_spl.c does.

spl/Makefile LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ · line 85

Quoted 12 lines
spl/Makefile +1 -0
index 2a787af..7e2adf9 100644
@@ -79,6 +79,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \
 	drivers/power/pmic/
 LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/
+LIBS-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/
 LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/
 LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/

Document this in README.

-Scott

author
#24 lore raw

PATCH v4 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

In reply to Po Liu

Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot.

- For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec.
- Use a clear function name for nand spl boot.
- Add CONFIG_SPL_DRIVERS_MISC_SUPPORT to compile the fsl_ifc.c in spl/Makefile;

---
changes for v2:
- seperate public code and c29xpcie board code
- add ifc support
changes for v3:
- remove the redundant plus
- ifc support use CONFIG_SPL_DRIVERS_MISC_SUPPORT
changes for v4:
- modify the nand_load function
- add comments in README.SPL

 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++-------
 doc/README.SPL                          |  1 +
 drivers/mtd/nand/fsl_ifc_spl.c          | 31 ++++++++++++++++++++++++-------
 spl/Makefile                            |  1 +
 4 files changed, 34 insertions(+), 14 deletions(-)
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +8 -7
index bc13267..acaa093 100644
@@ -57,7 +57,14 @@ SECTIONS
 	. = ALIGN(8);
 	__init_begin = .;
 	__init_end = .;
-/* FIXME for non-NAND SPL */
+
+/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+	.bootpg ADDR(.text) - 0x1000 :
+	{
+		KEEP(*(.bootpg))
+	} :text = 0xffff
+#else
 #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
 	.bootpg ADDR(.text) + 0x1000 :
 	{
@@ -69,12 +76,6 @@ SECTIONS
 #else
 #error unknown NAND controller
 #endif
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-	.bootpg ADDR(.text) - 0x1000 :
-	{
-		KEEP(*(.bootpg))
-	} :text = 0xffff
-#else
 	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
 		KEEP(*(.resetvec))
 	} = 0xffff
doc/README.SPL +1 -0
index 312a6a6..20d53fb 100644
@@ -62,6 +62,7 @@ CONFIG_SPL_FAT_SUPPORT (fs/fat/libfat.o)
 CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o)
 CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o)
 CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o)
+CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc/fsl_ifc.o)
 CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o)
 CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
 CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o)
drivers/mtd/nand/fsl_ifc_spl.c +24 -7
index 9de327b..6b43496 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
-static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#ifdef CONFIG_TPL_BUILD
+int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
+#else
+static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
+#endif
 {
 	struct fsl_ifc *ifc = IFC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
@@ -105,6 +109,7 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	int sram_addr;
 	int pg_no;
+	uchar *dst = vdst;
 
 	/* Get NAND Flash configuration */
 	csor = CONFIG_SYS_NAND_CSOR;
@@ -208,9 +213,20 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 			offs += page_size;
 		} while ((offs & (blk_size - 1)) && (pos < uboot_size));
 	}
+
+	return 0;
 }
 
 /*
+ * Defines a static function nand_load_image() here, because non-static makes
+ * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
+ */
+#ifndef CONFIG_TPL_BUILD
+#define nand_spl_load_image(offs, uboot_size, vdst) \
+	nand_load(offs, uboot_size, vdst)
+#endif
+
+/*
  * Main entrypoint for NAND Boot. It's necessary that SDRAM is already
  * configured and available since this code loads the main U-boot image
  * from NAND into SDRAM and starts from there.
@@ -221,16 +237,17 @@ void nand_boot(void)
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
-		  (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			    CONFIG_SYS_NAND_U_BOOT_SIZE,
+			    (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST);
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
+	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
 	/*
spl/Makefile +1 -0
index 1e88d74..4a0442b 100644
@@ -72,6 +72,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \
 	drivers/power/pmic/
 LIBS-$(if $(CONFIG_CMD_NAND),$(CONFIG_SPL_NAND_SUPPORT)) += drivers/mtd/nand/
+LIBS-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/
 LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/
 LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
Signature · 1 line
1.8.0
author
#25 lore raw

PATCH v4 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Using the TPL/SPL method to booting from 8k page NAND flash.
- Add 256kB size SRAM tlb for second step booting;
- Add spl.c for TPL image boot;
- Add spl_minimal.c for minimal SPL image;
- Add C29XPCIE_NAND configure;
- Modify C29XPCIE.h for nand config and enviroment;

---
changes for v2:
- seperate the public code and c29xpcie board code;
changes for v3:
- booting log simple to "SPL" "TPL"
- remove the 8k TLB from 0xffffe000 to 0xffffffff
- change the ddr tlb mapping condition
changes for v4:
- None.

 board/freescale/c29xpcie/Makefile      |  15 ++++
 board/freescale/c29xpcie/cpld.c        |   2 +
 board/freescale/c29xpcie/spl.c         |  77 +++++++++++++++++++
 board/freescale/c29xpcie/spl_minimal.c |  63 ++++++++++++++++
 board/freescale/c29xpcie/tlb.c         |  13 +++-
 boards.cfg                             |   1 +
 include/configs/C29XPCIE.h             | 130 ++++++++++++++++++++++++++++++++-
 7 files changed, 295 insertions(+), 6 deletions(-)
 create mode 100644 board/freescale/c29xpcie/spl.c
 create mode 100644 board/freescale/c29xpcie/spl_minimal.c
board/freescale/c29xpcie/Makefile +15 -0
index 626d48a..818484a 100644
@@ -3,8 +3,23 @@
 #
 # SPDX-License-Identifier:	GPL-2.0+
 
+MINIMAL=
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+obj-y	+= spl_minimal.o tlb.o law.o
+else
+ifdef CONFIG_SPL_BUILD
+obj-y	+= spl.o
+endif
+
 obj-y	+= c29xpcie.o
 obj-y	+= cpld.o
 obj-y	+= ddr.o
 obj-y	+= law.o
 obj-y	+= tlb.o
+endif
board/freescale/c29xpcie/cpld.c +2 -0
index 5cbccff..37722da 100644
@@ -89,6 +89,7 @@ static void cpld_dump_regs(void)
 }
 #endif
 
+#ifndef CONFIG_SPL_BUILD
 int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int rc = 0;
@@ -129,3 +130,4 @@ U_BOOT_CMD(
 	"cpld_cmd dump - display the CPLD registers\n"
 #endif
 	);
+#endif
board/freescale/c29xpcie/spl.c new file +77 -0

77 lines not on this page · raw message

board/freescale/c29xpcie/spl_minimal.c new file +63 -0

63 lines not on this page · raw message

board/freescale/c29xpcie/tlb.c +11 -2
index 84844ee..c5abed0 100644
@@ -30,6 +30,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 0, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
 			0, 1, BOOKE_PAGESZ_64M, 1),
@@ -43,13 +44,14 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 3, BOOKE_PAGESZ_256K, 1),
 #endif
+#endif
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 4, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE,
@@ -61,7 +63,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 7, BOOKE_PAGESZ_256K, 1),
 
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || \
+		(defined(CONFIG_SPL) && !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,
@@ -71,6 +74,12 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_256M, 1),
 #endif
+
+#ifdef CONFIG_SYS_INIT_L2_ADDR
+	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
+		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
+		      0, 12, BOOKE_PAGESZ_256K, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +1 -0
index 93c3fd1..d26e041 100644
@@ -791,6 +791,7 @@ Active  powerpc     mpc85xx        -           freescale       bsc9132qds
 Active  powerpc     mpc85xx        -           freescale       bsc9132qds          BSC9132QDS_SPIFLASH_DDRCLK133        BSC9132QDS:BSC9132QDS,SPIFLASH,SYS_CLK_100_DDR_133                                                                                Naveen Burmi <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE                             C29XPCIE:C29XPCIE,36BIT                                                                                                           Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_SPIFLASH                    C29XPCIE:C29XPCIE,36BIT,SPIFLASH                                                                                                  Po Liu <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_NAND                        C29XPCIE:C29XPCIE,36BIT,NAND                                                                                                  Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS                              -                                                                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_NAND                         P3041DS:RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF80000                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_SDCARD                       P3041DS:RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF80000                                                                               -
include/configs/C29XPCIE.h +126 -4

184 lines not on this page · raw message

Signature · 1 line
1.8.0
author
#26 lore raw

PATCH v5 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot.

- For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec.
- Use a clear function name for nand spl boot.
- Add CONFIG_SPL_DRIVERS_MISC_SUPPORT to compile the fsl_ifc.c in spl/Makefile;

---
changes for v2:
- seperate public code and c29xpcie board code
- add ifc support
changes for v3:
- remove the redundant plus
- ifc support use CONFIG_SPL_DRIVERS_MISC_SUPPORT
changes for v4:
- modify the nand_load function
- add comments in README.SPL
changes for v5:
-none

 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++-------
 doc/README.SPL                          |  1 +
 drivers/mtd/nand/fsl_ifc_spl.c          | 31 ++++++++++++++++++++++++-------
 spl/Makefile                            |  1 +
 4 files changed, 34 insertions(+), 14 deletions(-)
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +8 -7
index bc13267..acaa093 100644
@@ -57,7 +57,14 @@ SECTIONS
 	. = ALIGN(8);
 	__init_begin = .;
 	__init_end = .;
-/* FIXME for non-NAND SPL */
+
+/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+	.bootpg ADDR(.text) - 0x1000 :
+	{
+		KEEP(*(.bootpg))
+	} :text = 0xffff
+#else
 #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
 	.bootpg ADDR(.text) + 0x1000 :
 	{
@@ -69,12 +76,6 @@ SECTIONS
 #else
 #error unknown NAND controller
 #endif
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-	.bootpg ADDR(.text) - 0x1000 :
-	{
-		KEEP(*(.bootpg))
-	} :text = 0xffff
-#else
 	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
 		KEEP(*(.resetvec))
 	} = 0xffff
doc/README.SPL +1 -0
index 312a6a6..20d53fb 100644
@@ -62,6 +62,7 @@ CONFIG_SPL_FAT_SUPPORT (fs/fat/libfat.o)
 CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o)
 CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o)
 CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o)
+CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc/fsl_ifc.o)
 CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o)
 CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
 CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o)
drivers/mtd/nand/fsl_ifc_spl.c +24 -7
index 9de327b..6b43496 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
-static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#ifdef CONFIG_TPL_BUILD
+int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
+#else
+static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
+#endif
 {
 	struct fsl_ifc *ifc = IFC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
@@ -105,6 +109,7 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	int sram_addr;
 	int pg_no;
+	uchar *dst = vdst;
 
 	/* Get NAND Flash configuration */
 	csor = CONFIG_SYS_NAND_CSOR;
@@ -208,9 +213,20 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 			offs += page_size;
 		} while ((offs & (blk_size - 1)) && (pos < uboot_size));
 	}
+
+	return 0;
 }
 
 /*
+ * Defines a static function nand_load_image() here, because non-static makes
+ * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
+ */
+#ifndef CONFIG_TPL_BUILD
+#define nand_spl_load_image(offs, uboot_size, vdst) \
+	nand_load(offs, uboot_size, vdst)
+#endif
+
+/*
  * Main entrypoint for NAND Boot. It's necessary that SDRAM is already
  * configured and available since this code loads the main U-boot image
  * from NAND into SDRAM and starts from there.
@@ -221,16 +237,17 @@ void nand_boot(void)
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
-		  (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			    CONFIG_SYS_NAND_U_BOOT_SIZE,
+			    (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST);
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
+	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
 	/*
spl/Makefile +1 -0
index 1e88d74..4a0442b 100644
@@ -72,6 +72,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \
 	drivers/power/pmic/
 LIBS-$(if $(CONFIG_CMD_NAND),$(CONFIG_SPL_NAND_SUPPORT)) += drivers/mtd/nand/
+LIBS-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/
 LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/
 LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
Signature · 1 line
1.8.0
author
#27 lore raw

PATCH v5 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Using the TPL/SPL method to booting from 8k page NAND flash.
- Add 256kB size SRAM tlb for second step booting;
- Add spl.c for TPL image boot;
- Add spl_minimal.c for minimal SPL image;
- Add C29XPCIE_NAND configure;
- Modify C29XPCIE.h for nand config and enviroment;

---
changes for v2:
- seperate the public code and c29xpcie board code;
changes for v3:
- booting log simple to "SPL" "TPL"
- remove the 8k TLB from 0xffffe000 to 0xffffffff
- change the ddr tlb mapping condition
changes for v4:
- None.
changes for v5:
- code style change.

 board/freescale/c29xpcie/Makefile      |  15 ++++
 board/freescale/c29xpcie/cpld.c        |   2 +
 board/freescale/c29xpcie/spl.c         |  77 +++++++++++++++++++
 board/freescale/c29xpcie/spl_minimal.c |  63 ++++++++++++++++
 board/freescale/c29xpcie/tlb.c         |  13 +++-
 boards.cfg                             |   1 +
 include/configs/C29XPCIE.h             | 130 ++++++++++++++++++++++++++++++++-
 7 files changed, 295 insertions(+), 6 deletions(-)
 create mode 100644 board/freescale/c29xpcie/spl.c
 create mode 100644 board/freescale/c29xpcie/spl_minimal.c
board/freescale/c29xpcie/Makefile +15 -0
index 626d48a..818484a 100644
@@ -3,8 +3,23 @@
 #
 # SPDX-License-Identifier:	GPL-2.0+
 
+MINIMAL=
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+obj-y	+= spl_minimal.o tlb.o law.o
+else
+ifdef CONFIG_SPL_BUILD
+obj-y	+= spl.o
+endif
+
 obj-y	+= c29xpcie.o
 obj-y	+= cpld.o
 obj-y	+= ddr.o
 obj-y	+= law.o
 obj-y	+= tlb.o
+endif
board/freescale/c29xpcie/cpld.c +2 -0
index 5cbccff..37722da 100644
@@ -89,6 +89,7 @@ static void cpld_dump_regs(void)
 }
 #endif
 
+#ifndef CONFIG_SPL_BUILD
 int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int rc = 0;
@@ -129,3 +130,4 @@ U_BOOT_CMD(
 	"cpld_cmd dump - display the CPLD registers\n"
 #endif
 	);
+#endif
board/freescale/c29xpcie/spl.c new file +77 -0

77 lines not on this page · raw message

board/freescale/c29xpcie/spl_minimal.c new file +63 -0

63 lines not on this page · raw message

board/freescale/c29xpcie/tlb.c +11 -2
index 84844ee..c5abed0 100644
@@ -30,6 +30,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 0, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
 			0, 1, BOOKE_PAGESZ_64M, 1),
@@ -43,13 +44,14 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 3, BOOKE_PAGESZ_256K, 1),
 #endif
+#endif
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 4, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE,
@@ -61,7 +63,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 7, BOOKE_PAGESZ_256K, 1),
 
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || \
+		(defined(CONFIG_SPL) && !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,
@@ -71,6 +74,12 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_256M, 1),
 #endif
+
+#ifdef CONFIG_SYS_INIT_L2_ADDR
+	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
+		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
+		      0, 12, BOOKE_PAGESZ_256K, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +1 -0
index 93c3fd1..d26e041 100644
@@ -791,6 +791,7 @@ Active  powerpc     mpc85xx        -           freescale       bsc9132qds
 Active  powerpc     mpc85xx        -           freescale       bsc9132qds          BSC9132QDS_SPIFLASH_DDRCLK133        BSC9132QDS:BSC9132QDS,SPIFLASH,SYS_CLK_100_DDR_133                                                                                Naveen Burmi <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE                             C29XPCIE:C29XPCIE,36BIT                                                                                                           Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_SPIFLASH                    C29XPCIE:C29XPCIE,36BIT,SPIFLASH                                                                                                  Po Liu <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_NAND                        C29XPCIE:C29XPCIE,36BIT,NAND                                                                                                  Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS                              -                                                                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_NAND                         P3041DS:RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF80000                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_SDCARD                       P3041DS:RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF80000                                                                               -
include/configs/C29XPCIE.h +126 -4

184 lines not on this page · raw message

Signature · 1 line
1.8.0
#28 lore raw

PATCH v5 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

In reply to Po Liu

doc/README.SPL CONFIG_SPL_FAT_SUPPORT (fs/fat/libfat.o) · line 65

Quoted 9 lines · Po Liu
doc/README.SPL +1 -0
index 312a6a6..20d53fb 100644
@@ -62,6 +62,7 @@ CONFIG_SPL_FAT_SUPPORT (fs/fat/libfat.o)
 CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o)
 CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o)
 CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o)
+CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc/fsl_ifc.o)

This symbol is not specifically for fsl_ifc.o, it's for the entire drivers/misc directory (would have been drivers/misc/libmisc.o, but now they're all drivers/<foo>/built-in.o).

-Scott

author
#29 lore raw

PATCH v6 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

In reply to Po Liu

Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot.

- For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec.
- Use a clear function name for nand spl boot.
- Add CONFIG_SPL_DRIVERS_MISC_SUPPORT to compile the fsl_ifc.c in spl/Makefile;

---
changes for v2:
- seperate public code and c29xpcie board code
- add ifc support
changes for v3:
- remove the redundant plus
- ifc support use CONFIG_SPL_DRIVERS_MISC_SUPPORT
changes for v4:
- modify the nand_load function
- add comments in README.SPL
changes for v5:
-none
changes for v6:
- modify the readme file for the include lib file

 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++-------
 doc/README.SPL                          |  1 +
 drivers/mtd/nand/fsl_ifc_spl.c          | 31 ++++++++++++++++++++++++-------
 spl/Makefile                            |  1 +
 4 files changed, 34 insertions(+), 14 deletions(-)
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +8 -7
index bc13267..acaa093 100644
@@ -57,7 +57,14 @@ SECTIONS
 	. = ALIGN(8);
 	__init_begin = .;
 	__init_end = .;
-/* FIXME for non-NAND SPL */
+
+/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+	.bootpg ADDR(.text) - 0x1000 :
+	{
+		KEEP(*(.bootpg))
+	} :text = 0xffff
+#else
 #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
 	.bootpg ADDR(.text) + 0x1000 :
 	{
@@ -69,12 +76,6 @@ SECTIONS
 #else
 #error unknown NAND controller
 #endif
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-	.bootpg ADDR(.text) - 0x1000 :
-	{
-		KEEP(*(.bootpg))
-	} :text = 0xffff
-#else
 	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
 		KEEP(*(.resetvec))
 	} = 0xffff
doc/README.SPL +1 -0
index 312a6a6..b1bc3ca 100644
@@ -62,6 +62,7 @@ CONFIG_SPL_FAT_SUPPORT (fs/fat/libfat.o)
 CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o)
 CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o)
 CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o)
+CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc)
 CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o)
 CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
 CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o)
drivers/mtd/nand/fsl_ifc_spl.c +24 -7
index 9de327b..6b43496 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
-static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#ifdef CONFIG_TPL_BUILD
+int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
+#else
+static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
+#endif
 {
 	struct fsl_ifc *ifc = IFC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
@@ -105,6 +109,7 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	int sram_addr;
 	int pg_no;
+	uchar *dst = vdst;
 
 	/* Get NAND Flash configuration */
 	csor = CONFIG_SYS_NAND_CSOR;
@@ -208,9 +213,20 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 			offs += page_size;
 		} while ((offs & (blk_size - 1)) && (pos < uboot_size));
 	}
+
+	return 0;
 }
 
 /*
+ * Defines a static function nand_load_image() here, because non-static makes
+ * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
+ */
+#ifndef CONFIG_TPL_BUILD
+#define nand_spl_load_image(offs, uboot_size, vdst) \
+	nand_load(offs, uboot_size, vdst)
+#endif
+
+/*
  * Main entrypoint for NAND Boot. It's necessary that SDRAM is already
  * configured and available since this code loads the main U-boot image
  * from NAND into SDRAM and starts from there.
@@ -221,16 +237,17 @@ void nand_boot(void)
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
-		  (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
+	nand_spl_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+			    CONFIG_SYS_NAND_U_BOOT_SIZE,
+			    (uchar *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST);
+	nand_spl_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
-		  (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
+	nand_spl_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+			    (uchar *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
 	/*
spl/Makefile +1 -0
index 1e88d74..4a0442b 100644
@@ -72,6 +72,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \
 	drivers/power/pmic/
 LIBS-$(if $(CONFIG_CMD_NAND),$(CONFIG_SPL_NAND_SUPPORT)) += drivers/mtd/nand/
+LIBS-$(CONFIG_SPL_DRIVERS_MISC_SUPPORT) += drivers/misc/
 LIBS-$(CONFIG_SPL_ONENAND_SUPPORT) += drivers/mtd/onenand/
 LIBS-$(CONFIG_SPL_DMA_SUPPORT) += drivers/dma/
 LIBS-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/
Signature · 1 line
1.8.0
author
#30 lore raw

PATCH v6 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Using the TPL/SPL method to booting from 8k page NAND flash.
- Add 256kB size SRAM tlb for second step booting;
- Add spl.c for TPL image boot;
- Add spl_minimal.c for minimal SPL image;
- Add C29XPCIE_NAND configure;
- Modify C29XPCIE.h for nand config and enviroment;

---
changes for v2:
- seperate the public code and c29xpcie board code;
changes for v3:
- booting log simple to "SPL" "TPL"
- remove the 8k TLB from 0xffffe000 to 0xffffffff
- change the ddr tlb mapping condition
changes for v4:
- None.
changes for v5:
- code style change.
changes for v6:
- none

 board/freescale/c29xpcie/Makefile      |  15 ++++
 board/freescale/c29xpcie/cpld.c        |   2 +
 board/freescale/c29xpcie/spl.c         |  77 +++++++++++++++++++
 board/freescale/c29xpcie/spl_minimal.c |  63 ++++++++++++++++
 board/freescale/c29xpcie/tlb.c         |  13 +++-
 boards.cfg                             |   1 +
 include/configs/C29XPCIE.h             | 130 ++++++++++++++++++++++++++++++++-
 7 files changed, 295 insertions(+), 6 deletions(-)
 create mode 100644 board/freescale/c29xpcie/spl.c
 create mode 100644 board/freescale/c29xpcie/spl_minimal.c
board/freescale/c29xpcie/Makefile +15 -0
index 626d48a..818484a 100644
@@ -3,8 +3,23 @@
 #
 # SPDX-License-Identifier:	GPL-2.0+
 
+MINIMAL=
+ifdef CONFIG_SPL_BUILD
+ifdef CONFIG_SPL_INIT_MINIMAL
+MINIMAL=y
+endif
+endif
+
+ifdef MINIMAL
+obj-y	+= spl_minimal.o tlb.o law.o
+else
+ifdef CONFIG_SPL_BUILD
+obj-y	+= spl.o
+endif
+
 obj-y	+= c29xpcie.o
 obj-y	+= cpld.o
 obj-y	+= ddr.o
 obj-y	+= law.o
 obj-y	+= tlb.o
+endif
board/freescale/c29xpcie/cpld.c +2 -0
index 5cbccff..37722da 100644
@@ -89,6 +89,7 @@ static void cpld_dump_regs(void)
 }
 #endif
 
+#ifndef CONFIG_SPL_BUILD
 int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	int rc = 0;
@@ -129,3 +130,4 @@ U_BOOT_CMD(
 	"cpld_cmd dump - display the CPLD registers\n"
 #endif
 	);
+#endif
board/freescale/c29xpcie/spl.c new file +77 -0

77 lines not on this page · raw message

board/freescale/c29xpcie/spl_minimal.c new file +63 -0

63 lines not on this page · raw message

board/freescale/c29xpcie/tlb.c +11 -2
index 84844ee..c5abed0 100644
@@ -30,6 +30,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 0, BOOKE_PAGESZ_1M, 1),
 
+#ifndef CONFIG_SPL_BUILD
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
 			MAS3_SX|MAS3_SR, MAS2_W|MAS2_G,
 			0, 1, BOOKE_PAGESZ_64M, 1),
@@ -43,13 +44,14 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 3, BOOKE_PAGESZ_256K, 1),
 #endif
+#endif
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_CPLD_BASE, CONFIG_SYS_CPLD_BASE_PHYS,
 			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 4, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_NAND_BASE, CONFIG_SYS_NAND_BASE_PHYS,
-			MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 			0, 5, BOOKE_PAGESZ_64K, 1),
 
 	SET_TLB_ENTRY(1, CONFIG_SYS_PLATFORM_SRAM_BASE,
@@ -61,7 +63,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 7, BOOKE_PAGESZ_256K, 1),
 
-#ifdef CONFIG_SYS_RAMBOOT
+#if defined(CONFIG_SYS_RAMBOOT) || \
+		(defined(CONFIG_SPL) && !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,
@@ -71,6 +74,12 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
 			0, 9, BOOKE_PAGESZ_256M, 1),
 #endif
+
+#ifdef CONFIG_SYS_INIT_L2_ADDR
+	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
+		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
+		      0, 12, BOOKE_PAGESZ_256K, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
boards.cfg +1 -0
index 18faf09..d19e43a 100644
@@ -790,6 +790,7 @@ Active  powerpc     mpc85xx        -           freescale       bsc9132qds
 Active  powerpc     mpc85xx        -           freescale       bsc9132qds          BSC9132QDS_SPIFLASH_DDRCLK133        BSC9132QDS:BSC9132QDS,SPIFLASH,SYS_CLK_100_DDR_133                                                                                Naveen Burmi <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE                             C29XPCIE:C29XPCIE,36BIT                                                                                                           Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_SPIFLASH                    C29XPCIE:C29XPCIE,36BIT,SPIFLASH                                                                                                  Po Liu <[email protected]>
+Active  powerpc     mpc85xx        -           freescale       c29xpcie            C29XPCIE_NAND                        C29XPCIE:C29XPCIE,36BIT,NAND                                                                                                  Po Liu <[email protected]>
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS                              -                                                                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_NAND                         P3041DS:RAMBOOT_PBL,NAND,SYS_TEXT_BASE=0xFFF80000                                                                                 -
 Active  powerpc     mpc85xx        -           freescale       corenet_ds          P3041DS_SDCARD                       P3041DS:RAMBOOT_PBL,SDCARD,SYS_TEXT_BASE=0xFFF80000                                                                               -
include/configs/C29XPCIE.h +126 -4

184 lines not on this page · raw message

Signature · 1 line
1.8.0
#31 lore raw

PATCH v6 2/2 powerpc/c29xpcie: 8k page size NAND boot support base on TPL/SPL

Quoted 8 lines · Po Liu

Using the TPL/SPL method to booting from 8k page NAND flash.
- Add 256kB size SRAM tlb for second step booting;
- Add spl.c for TPL image boot;
- Add spl_minimal.c for minimal SPL image;
- Add C29XPCIE_NAND configure;
- Modify C29XPCIE.h for nand config and enviroment;

Quoted 13 lines

---
changes for v2:
- seperate the public code and c29xpcie board code;
changes for v3:
- booting log simple to "SPL" "TPL"
- remove the 8k TLB from 0xffffe000 to 0xffffffff
- change the ddr tlb mapping condition
changes for v4:
- None.
changes for v5:
- code style change.
changes for v6:
- none

Applied to u-boot-mpc85xx master branch. Awaiting upstream.

York

#32 lore raw

PATCH v6 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

In reply to Po Liu
Quoted 25 lines · Po Liu

Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot.

- For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec.
- Use a clear function name for nand spl boot.
- Add CONFIG_SPL_DRIVERS_MISC_SUPPORT to compile the fsl_ifc.c in spl/Makefile;

---
changes for v2:
- seperate public code and c29xpcie board code
- add ifc support
changes for v3:
- remove the redundant plus
- ifc support use CONFIG_SPL_DRIVERS_MISC_SUPPORT
changes for v4:
- modify the nand_load function
- add comments in README.SPL
changes for v5:
-none
changes for v6:
- modify the readme file for the include lib file

Quoted 5 lines
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++-------
 doc/README.SPL                          |  1 +
 drivers/mtd/nand/fsl_ifc_spl.c          | 31 ++++++++++++++++++++++++-------
 spl/Makefile                            |  1 +
 4 files changed, 34 insertions(+), 14 deletions(-)

-Scott

#33 lore raw

PATCH v6 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

Quoted 26 lines · Scott Wood
Quoted 25 lines · Po Liu

Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot.

- For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec.
- Use a clear function name for nand spl boot.
- Add CONFIG_SPL_DRIVERS_MISC_SUPPORT to compile the fsl_ifc.c in spl/Makefile;

---
changes for v2:
- seperate public code and c29xpcie board code
- add ifc support
changes for v3:
- remove the redundant plus
- ifc support use CONFIG_SPL_DRIVERS_MISC_SUPPORT
changes for v4:
- modify the nand_load function
- add comments in README.SPL
changes for v5:
-none
changes for v6:
- modify the readme file for the include lib file

Quoted 8 lines
Quoted 5 lines
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++-------
 doc/README.SPL                          |  1 +
 drivers/mtd/nand/fsl_ifc_spl.c          | 31 ++++++++++++++++++++++++-------
 spl/Makefile                            |  1 +
 4 files changed, 34 insertions(+), 14 deletions(-)

Applied to u-boot-mpc85xx master branch. Awaiting upstream.

York

#34 lore raw

PATCH v6 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

In reply to Po Liu
Quoted 81 lines · Po Liu

Using the TPL method for nand boot by sram was already supported. Here add some code for mpc85xx ifc nand boot.

- For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec.
- Use a clear function name for nand spl boot.
- Add CONFIG_SPL_DRIVERS_MISC_SUPPORT to compile the fsl_ifc.c in spl/Makefile;

---
changes for v2:
- seperate public code and c29xpcie board code
- add ifc support
changes for v3:
- remove the redundant plus
- ifc support use CONFIG_SPL_DRIVERS_MISC_SUPPORT
changes for v4:
- modify the nand_load function
- add comments in README.SPL
changes for v5:
-none
changes for v6:
- modify the readme file for the include lib file

  arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 15 ++++++++-------
  doc/README.SPL                          |  1 +
  drivers/mtd/nand/fsl_ifc_spl.c          | 31 ++++++++++++++++++++++++-------
  spl/Makefile                            |  1 +
  4 files changed, 34 insertions(+), 14 deletions(-)
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +8 -7
index bc13267..acaa093 100644
@@ -57,7 +57,14 @@ SECTIONS
  	. = ALIGN(8);
  	__init_begin = .;
  	__init_end = .;
-/* FIXME for non-NAND SPL */
+
+/* For ifc, elbc, esdhc, espi, all need the SPL without section .resetvec */
+#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
+	.bootpg ADDR(.text) - 0x1000 :
+	{
+		KEEP(*(.bootpg))
+	} :text = 0xffff
+#else
  #if defined(CONFIG_FSL_IFC) /* Restrict bootpg at 4K boundry for IFC */
  	.bootpg ADDR(.text) + 0x1000 :
  	{
@@ -69,12 +76,6 @@ SECTIONS
  #else
  #error unknown NAND controller
  #endif
-#ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
-	.bootpg ADDR(.text) - 0x1000 :
-	{
-		KEEP(*(.bootpg))
-	} :text = 0xffff
-#else
  	.resetvec ADDR(.text) + RESET_VECTOR_OFFSET : {
  		KEEP(*(.resetvec))
  	} = 0xffff
doc/README.SPL +1 -0
index 312a6a6..b1bc3ca 100644
@@ -62,6 +62,7 @@ CONFIG_SPL_FAT_SUPPORT (fs/fat/libfat.o)
  CONFIG_SPL_LIBGENERIC_SUPPORT (lib/libgeneric.o)
  CONFIG_SPL_POWER_SUPPORT (drivers/power/libpower.o)
  CONFIG_SPL_NAND_SUPPORT (drivers/mtd/nand/libnand.o)
+CONFIG_SPL_DRIVERS_MISC_SUPPORT (drivers/misc)
  CONFIG_SPL_DMA_SUPPORT (drivers/dma/libdma.o)
  CONFIG_SPL_POST_MEM_SUPPORT (post/drivers/memory.o)
  CONFIG_SPL_NAND_LOAD (drivers/mtd/nand/nand_spl_load.o)
drivers/mtd/nand/fsl_ifc_spl.c +0 -0
index 9de327b..6b43496 100644

drivers/mtd/nand/fsl_ifc_spl.c static inline int bad_block(uchar *marker, int port_size) · line 95

Quoted 9 lines
drivers/mtd/nand/fsl_ifc_spl.c +5 -1
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
  		return __raw_readw((u16 *)marker) != 0xffff;
  }
 
-static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#ifdef CONFIG_TPL_BUILD
+int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
+#else
+static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
+#endif

nand_load definition is

     static void nand_load(unsigned int offs, int uboot_size, uchar *dst);

have you checked the compilation warning for non TPL framework?

Regards,
Prabhakar

#35 lore raw

PATCH v6 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

Quoted 17 lines · Prabhakar Kushwaha
Quoted 5 lines · Po Liu
drivers/mtd/nand/fsl_ifc_spl.c +0 -0
index 9de327b..6b43496 100644

drivers/mtd/nand/fsl_ifc_spl.c static inline int bad_block(uchar *marker, int port_size) · line 95

Quoted 9 lines
drivers/mtd/nand/fsl_ifc_spl.c +5 -1
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
  		return __raw_readw((u16 *)marker) != 0xffff;
  }
 
-static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#ifdef CONFIG_TPL_BUILD
+int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
+#else
+static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
+#endif

nand_load definition is

Quoted 1 line
     static void nand_load(unsigned int offs, int uboot_size, uchar *dst);

Not anymore...

Quoted 1 line

have you checked the compilation warning for non TPL framework?

Are you seeing a warning?

-Scott

#36 lore raw

PATCH v6 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

Quoted 18 lines · Scott Wood
Quoted 9 lines · Prabhakar Kushwaha
Quoted 8 lines · Po Liu
drivers/mtd/nand/fsl_ifc_spl.c +0 -0
index 9de327b..6b43496 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
   		return __raw_readw((u16 *)marker) != 0xffff;
   }
 
Quoted 8 lines

drivers/mtd/nand/fsl_ifc_spl.c static inline int bad_block(uchar *marker, int port_size) · line 95

Quoted 6 lines
drivers/mtd/nand/fsl_ifc_spl.c +5 -1
-static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#ifdef CONFIG_TPL_BUILD
+int nand_spl_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
+#else
+static int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
+#endif

nand_load definition is

      static void nand_load(unsigned int offs, int uboot_size, uchar *dst);
Quoted 1 line

Not anymore...

Just confused with previous fsl_ifc_spl.c file. Actually this patch
is changing nand_load signature.

No warning. I checked for BSC9131RDB, P1010 NAND target.

Thanks,
Prabhakar

#37 lore raw

PATCH v2 1/2 powerpc:mpc85xx: Add ifc nand boot support for TPL/SPL

In reply to Po Liu
Quoted 17 lines · Po Liu
drivers/mtd/nand/fsl_ifc_spl.c +4 -0
index 9de327b..93303b4 100644
@@ -88,7 +88,11 @@ static inline int bad_block(uchar *marker, int port_size)
 		return __raw_readw((u16 *)marker) != 0xffff;
 }
 
+#ifdef CONFIG_TPL_BUILD
+void nand_spl_load_image(uint32_t offs, int uboot_size, void *vdst)
+#else
 static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#endif
 {
 	struct fsl_ifc *ifc = IFC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;

drivers/mtd/nand/fsl_ifc_spl.c static void nand_load(unsigned int offs, int uboot_size, uchar *dst) · line 114

Quoted 6 lines
drivers/mtd/nand/fsl_ifc_spl.c +3 -0
@@ -105,6 +109,9 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	int sram_addr;
 	int pg_no;
+#ifdef CONFIG_TPL_BUILD
+	char *dst = vdst;
+#endif

Use uchar to be consistent.

drivers/mtd/nand/fsl_ifc_spl.c static void nand_load(unsigned int offs, int uboot_size, uchar *dst) · line 224

Quoted 10 lines
drivers/mtd/nand/fsl_ifc_spl.c +4 -0
 	/* Get NAND Flash configuration */
 	csor = CONFIG_SYS_NAND_CSOR;
@@ -211,6 +218,15 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 }
 
 /*
++ * Defines a static function nand_load_image() here, because non-static makes
++ * the code too large for certain SPLs(minimal SPL, maximum size <= 4Kbytes)
++ */
+#ifndef CONFIG_TPL_BUILD

Too many pluses -- did you copy and paste from a patch?

spl/Makefile LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/ · line 82

Quoted 9 lines
spl/Makefile +1 -0
index 2a787af..908af35 100644
@@ -79,6 +79,7 @@ LIBS-$(CONFIG_SPL_LIBGENERIC_SUPPORT) += lib/
 LIBS-$(CONFIG_SPL_POWER_SUPPORT) += drivers/power/ \
 	drivers/power/pmic/
 LIBS-$(CONFIG_SPL_NAND_SUPPORT) += drivers/mtd/nand/
+LIBS-$(CONFIG_SPL_IFC_SUPPORT) += drivers/misc/

Make a CONFIG_SPL_DRIVERS_MISC_SUPPORT instead.

-Scott