Skip to contentSkip to conversation

powerpc: deleted unused symbol CONFIG_SPL_NAND_MINIMAL and enabled some functionality for common SPL

PATCH Superseded ying.zhang at freescale.com 3 participants 13 messages Jun 26, 2013 – Jul 1, 2013

Subsystems (5)

v6 of 11 Superseded Latest is v11 →

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/7 powerpc: deleted unused symbol CONFIG_SPL_NAND_MINIMAL and enabled some functionality for common SPL

From: Ying Zhang <[email protected]>

1. The symbol CONFIG_SPL_NAND_MINIMAL is unused, so deleted it.
2. Some functions were unused in the minimal SPL, but it is useful in the common SPL. So, enabled some functionality for common SPL.

---
Compared with the original version, Changed as below:
1. Split from "boot from SD card/SPI flash with SPL".
2. Split from "Add the symbol for the minimal SPL used to eliminate unused code"
3. Give up new symbol and delete the line
ifndef CONFIG_SPL_BUILD in common/env_common.c
4. Use !defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL) to replace to new symbols.
5. No change.

 arch/powerpc/cpu/mpc85xx/tlb.c |    3 ++-
 arch/powerpc/cpu/mpc8xxx/law.c |    6 ++++--
 include/configs/MPC8313ERDB.h  |    1 -
 include/configs/P1022DS.h      |    1 -
 include/configs/p1_p2_rdb_pc.h |    1 -
 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/cpu/mpc85xx/tlb.c +2 -1
index 0dff37f..b903d02 100644
@@ -55,7 +55,8 @@ void init_tlbs(void)
 	return ;
 }
 
-#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_NAND_SPL) && \
+	(!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL))
 void read_tlbcam_entry(int idx, u32 *valid, u32 *tsize, unsigned long *epn,
 		       phys_addr_t *rpn)
 {
arch/powerpc/cpu/mpc8xxx/law.c +4 -2
index 6f9d568..6c0a307 100644
@@ -92,7 +92,8 @@ void disable_law(u8 idx)
 	return;
 }
 
-#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_NAND_SPL) && \
+	(!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL))
 static int get_law_entry(u8 i, struct law_entry *e)
 {
 	u32 lawar;
@@ -122,7 +123,8 @@ int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 	return idx;
 }
 
-#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_SPL_BUILD)
+#if !defined(CONFIG_NAND_SPL) && \
+	(!defined(CONFIG_SPL_BUILD) || !defined(CONFIG_SPL_INIT_MINIMAL))
 int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id)
 {
 	u32 idx;
include/configs/MPC8313ERDB.h +0 -1
index 1d753e7..0c15195 100644
@@ -40,7 +40,6 @@
 #define CONFIG_SPL_INIT_MINIMAL
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_NAND_SUPPORT
-#define CONFIG_SPL_NAND_MINIMAL
 #define CONFIG_SPL_FLUSH_IMAGE
 #define CONFIG_SPL_TARGET		"u-boot-with-spl.bin"
 #define CONFIG_SPL_MPC83XX_WAIT_FOR_NAND
include/configs/P1022DS.h +0 -1
index 9c27182..bcbda30 100644
@@ -41,7 +41,6 @@
 #define CONFIG_SPL_INIT_MINIMAL
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_NAND_SUPPORT
-#define CONFIG_SPL_NAND_MINIMAL
 #define CONFIG_SPL_FLUSH_IMAGE
 #define CONFIG_SPL_TARGET              "u-boot-with-spl.bin"
 
include/configs/p1_p2_rdb_pc.h +0 -1
index 2fa5372..b35b966 100644
@@ -159,7 +159,6 @@
 #define CONFIG_SPL_INIT_MINIMAL
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_NAND_SUPPORT
-#define CONFIG_SPL_NAND_MINIMAL
 #define CONFIG_SPL_FLUSH_IMAGE
 #define CONFIG_SPL_TARGET		"u-boot-with-spl.bin"
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v6 2/7 spl: env_common.c: add new symbol CONFIG_SPL_ENV_IMPORT to contain function env_import

From: Ying Zhang <[email protected]>

The functionality env_import will be used in the SPL. They had been excluded by ifndef CONFIG_SPL_BUILD. Now, add new symbol CONFIG_SPL_ENV_IMPORT to contian the functionality env_import in SPL.

---
Compared with the original version, Changed as below:
1. Split from "boot from SD card/SPI flash with SPL".
2. Split from "spl: Make CONFIG_SPL_BUILD contain more functionality"
3. No change.
4. No change.
5. Add new symbol CONFIG_SPL_ENV_IMPORT

 README              |    3 +++
 common/env_common.c |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
README +3 -0
index 137e8cb..8a6c26c 100644
@@ -3046,6 +3046,9 @@ FIT uImage format:
 		It conflicts with SPL env from storage medium specified by
 		CONFIG_ENV_IS_xxx but CONFIG_ENV_IS_NOWHERE
 
+		CONFIG_SPL_ENV_IMPORT
+		Support for importing the environment in SPL.
+
 		CONFIG_SPL_PAD_TO
 		Image offset to which the SPL should be padded before appending
 		the SPL payload. By default, this is defined as
common/env_common.c +1 -1
index 906b41f..1a36660 100644
@@ -156,7 +156,7 @@ int set_default_vars(int nvars, char * const vars[])
 				H_NOCLEAR | H_INTERACTIVE, nvars, vars);
 }
 
-#ifndef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_ENV_IMPORT)
 /*
  * Check if CRC is valid and (if yes) import the environment.
  * Note that "buf" may or may not be aligned.
Signature · 1 line
1.7.0.4
#2 lore raw

PATCH v6 3/7 powerpc/p1022ds: boot from SD Card with SPL

In reply to ying.zhang at freescale.com

From: Ying Zhang <[email protected]>

This patch introduces SPL to enable a loader stub that runs in the L2 SRAM, after being loaded by the code from the internal on-chip ROM. It loads the final uboot image into DDR, then jump to it to begin execution.

The SPL's size is sizeable, the maximum size must not exceed the size of L2 SRAM. It initializes the DDR through SPD code, and copys final uboot image to DDR. So there are two stage uboot images:
* spl_boot, 96KB size. The env variables are copied to L2 SRAM, so that ddr spd code can get the interleaving mode setting in env. It loads final uboot image from offset 96KB.
* final uboot image, size is variable depends on the functions enabled.

This patch is on top of the following patch:
1. common/Makefile: Add new symbol CONFIG_SPL_ENV_SUPPORT for environment in SPL.
2. Makefile: move the common makefile line to public area
3. powerpc/mpc85xx: support application without resetvec segment in the linker script.
4. powerpc/mpc85xx: modify the function clear_bss and the end address of the BSS
5. powerpc: spl: deleted unused symbol CONFIG_SPL_NAND_MINIMAL and enabled some functionality for common SPL
6. spl: env_common.c: add new symbol CONFIG_SPL_ENV_IMPORT to contain function env_import

---
Compared with the original version, Changed as below:
1. Split from "boot from SD card/SPI flash with SPL".
2. No change.
3. No change.
4. No change.
5. Add new symbol CONFIG_SPL_ENV_IMPORT for contain the functionality env_import.

 README                                             |    7 +
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds            |    5 +
 .../cpu/mpc8xxx/ddr/lc_common_dimm_params.c        |    4 +
 board/freescale/common/Makefile                    |    2 -
 board/freescale/p1022ds/Makefile                   |    3 +
 board/freescale/p1022ds/spl.c                      |  112 +++++++++++++++++
 board/freescale/p1022ds/tlb.c                      |    9 ++-
 doc/README.mpc85xx-sd-spi-boot                     |   81 ++++++++++++
 drivers/mmc/Makefile                               |    3 +
 drivers/mmc/fsl_esdhc_spl.c                        |  131 ++++++++++++++++++++
 drivers/mmc/mmc.c                                  |    2 +
 include/configs/P1022DS.h                          |   56 ++++++++-
 include/fsl_esdhc.h                                |    1 +
 spl/Makefile                                       |    3 +
 14 files changed, 409 insertions(+), 10 deletions(-)
 create mode 100644 board/freescale/p1022ds/spl.c
 create mode 100644 doc/README.mpc85xx-sd-spi-boot
 create mode 100644 drivers/mmc/fsl_esdhc_spl.c
README +7 -0
index 8a6c26c..b941a56 100644
@@ -2995,6 +2995,13 @@ FIT uImage format:
 		Support for NAND boot using simple NAND drivers that
 		expose the cmd_ctrl() interface.
 
+		CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+		Set for the SPL on PPC mpc8xxx targets, support for
+		arch/powerpc/cpu/mpc8xxx/ddr/libddr.o in SPL binary.
+
+		CONFIG_SPL_COMMON_INIT_DDR
+		Set for common ddr init with serial presence detect in
+		SPL binary.
 		CONFIG_SYS_NAND_5_ADDR_CYCLE, CONFIG_SYS_NAND_PAGE_COUNT,
 		CONFIG_SYS_NAND_PAGE_SIZE, CONFIG_SYS_NAND_OOBSIZE,
 		CONFIG_SYS_NAND_BLOCK_SIZE, CONFIG_SYS_NAND_BAD_BLOCK_POS,
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +5 -0
index 20284ed..8aeb1a0 100644
@@ -60,6 +60,11 @@ SECTIONS
 	}
 	_edata  =  .;
 
+	. = .;
+	__start___ex_table = .;
+	__ex_table : { *(__ex_table) }
+	__stop___ex_table = .;
+
 	. = ALIGN(8);
 	__init_begin = .;
 	__init_end = .;
arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c +4 -0
index e958e13..56128a7 100644
@@ -218,12 +218,16 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 		if (dimm_params[i].n_ranks) {
 			if (dimm_params[i].registered_dimm) {
 				temp1 = 1;
+#ifndef CONFIG_SPL_BUILD
 				printf("Detected RDIMM %s\n",
 					dimm_params[i].mpart);
+#endif
 			} else {
 				temp2 = 1;
+#ifndef CONFIG_SPL_BUILD
 				printf("Detected UDIMM %s\n",
 					dimm_params[i].mpart);
+#endif
 			}
 		}
 	}
board/freescale/common/Makefile +0 -2
index 37236d0..e991def 100644
@@ -61,9 +61,7 @@ COBJS-$(CONFIG_MPC8555CDS)	+= cds_pci_ft.o
 
 COBJS-$(CONFIG_MPC8536DS)	+= ics307_clk.o
 COBJS-$(CONFIG_MPC8572DS)	+= ics307_clk.o
-ifndef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_P1022DS)		+= ics307_clk.o
-endif
 COBJS-$(CONFIG_P2020DS)		+= ics307_clk.o
 COBJS-$(CONFIG_P3041DS)		+= ics307_clk.o
 COBJS-$(CONFIG_P4080DS)		+= ics307_clk.o
board/freescale/p1022ds/Makefile +3 -0
index 0eeef05..9746063 100644
@@ -24,6 +24,9 @@ ifdef MINIMAL
 COBJS-y        += spl_minimal.o tlb.o law.o
 
 else
+ifdef CONFIG_SPL_BUILD
+COBJS-y += spl.o
+endif
 COBJS-y	+= $(BOARD).o
 COBJS-y	+= ddr.o
 COBJS-y	+= law.o
board/freescale/p1022ds/spl.c new file +112 -0

112 lines not on this page · raw message

board/freescale/p1022ds/tlb.c +8 -1
index 3acc449..9b14c37 100644
@@ -74,7 +74,8 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 7, BOOKE_PAGESZ_4K, 1),
 
-#if defined(CONFIG_SYS_RAMBOOT) || defined(CONFIG_SPL)
+#if defined(CONFIG_SYS_RAMBOOT) || \
+	(defined(CONFIG_SPL) && !defined(CONFIG_SPL_COMMON_INIT_DDR))
 	/* **** - eSDHC/eSPI/NAND boot */
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
@@ -93,6 +94,12 @@ struct fsl_e_tlb_entry tlb_table[] = {
 			0, 10, BOOKE_PAGESZ_16K, 1),
 #endif
 
+#ifdef CONFIG_SYS_INIT_L2_ADDR
+	/* *I*G - L2SRAM */
+	SET_TLB_ENTRY(1, CONFIG_SYS_INIT_L2_ADDR, CONFIG_SYS_INIT_L2_ADDR_PHYS,
+			MAS3_SX|MAS3_SW|MAS3_SR, MAS2_G,
+			0, 11, BOOKE_PAGESZ_256K, 1)
+#endif
 };
 
 int num_tlb_entries = ARRAY_SIZE(tlb_table);
doc/README.mpc85xx-sd-spi-boot new file +81 -0

81 lines not on this page · raw message

drivers/mmc/Makefile +3 -0
index 24648a2..7e1628b 100644
@@ -48,6 +48,9 @@ COBJS-$(CONFIG_TEGRA_MMC) += tegra_mmc.o
 COBJS-$(CONFIG_DWMMC) += dw_mmc.o
 COBJS-$(CONFIG_EXYNOS_DWMMC) += exynos_dw_mmc.o
 COBJS-$(CONFIG_ZYNQ_SDHCI) += zynq_sdhci.o
+ifdef CONFIG_SPL_BUILD
+COBJS-$(CONFIG_SPL_MMC_BOOT) += fsl_esdhc_spl.o
+endif
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/mmc/fsl_esdhc_spl.c new file +131 -0

131 lines not on this page · raw message

drivers/mmc/mmc.c +2 -0
index 83d2df7..373d2bb 100644
@@ -1498,7 +1498,9 @@ int mmc_initialize(bd_t *bis)
 	if (board_mmc_init(bis) < 0)
 		cpu_mmc_init(bis);
 
+#ifndef CONFIG_SPL_BUILD
 	print_mmc_devices(',');
+#endif
 
 	do_preinit();
 	return 0;
include/configs/P1022DS.h +49 -7

81 lines not on this page · raw message

include/fsl_esdhc.h +1 -0
index 67d6057..b17c424 100644
@@ -198,5 +198,6 @@ void fdt_fixup_esdhc(void *blob, bd_t *bd);
 static inline int fsl_esdhc_mmc_init(bd_t *bis) { return -ENOSYS; }
 static inline void fdt_fixup_esdhc(void *blob, bd_t *bd) {}
 #endif /* CONFIG_FSL_ESDHC */
+void mmc_boot(void);
 
 #endif  /* __FSL_ESDHC_H__ */
spl/Makefile +3 -0
index 01873de..eef8c87 100644
@@ -51,6 +51,9 @@ LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
 endif
 ifeq ($(CPU),mpc85xx)
 LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
+ifdef CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+LIBS-y += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
+endif
 endif
 ifeq ($(CPU),mpc86xx)
 LIBS-y += arch/powerpc/cpu/mpc8xxx/lib8xxx.o
Signature · 1 line
1.7.0.4
#3 lore raw

PATCH v6 4/7 SPL : spi flash : support to start from eSPI with SPL

In reply to ying.zhang at freescale.com

From: Ying Zhang <[email protected]>

This patch introduces SPL to enable a loader stub that runs in the L2 SRAM, after being loaded by the code from the internal on-chip ROM. It loads the final uboot image into DDR, then jump to it to begin execution.

The SPL's size is sizeable, the maximum size must not exceed the size of L2 SRAM. It initializes the DDR through SPD code, and copys final uboot image to DDR. So there are two stage uboot images:
* spl_boot, 96KB size. The env variables are copied to L2 SRAM, so that ddr spd code can get the interleaving mode setting in env. It loads final uboot image from offset 96KB.
* final uboot image, size is variable depends on the functions enabled.

This patch is on top of the patch:
powerpc/p1022ds: boot from SD Card with SPL

---
Compared with the original version, Changed as below:
1. Split from "boot from SD card/SPI flash with SPL".
2. No change.
3. No change.
4. No change.
5. Split from "powerpc/p1022ds: boot from spi flash with SPL" this patch add the capability starting from eSPI with SPL.

 drivers/mtd/spi/Makefile       |    1 +
 drivers/mtd/spi/fsl_espi_spl.c |   78 ++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/spi/spi_flash.c    |    2 +
 3 files changed, 81 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mtd/spi/fsl_espi_spl.c
drivers/mtd/spi/Makefile +1 -0
index ecbb210..39e4e1d 100644
@@ -27,6 +27,7 @@ LIB	:= $(obj)libspi_flash.o
 
 ifdef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_SPL_SPI_LOAD)	+= spi_spl_load.o
+COBJS-$(CONFIG_SPL_SPI_BOOT)	+= fsl_espi_spl.o
 endif
 
 COBJS-$(CONFIG_SPI_FLASH)	+= spi_flash.o
drivers/mtd/spi/fsl_espi_spl.c new file +78 -0

78 lines not on this page · raw message

drivers/mtd/spi/spi_flash.c +2 -0
index 6a6fe37..e474f5c 100644
@@ -554,12 +554,14 @@ struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
 		goto err_manufacturer_probe;
 	}
 #endif
+#ifndef CONFIG_SPL_BUILD
 	printf("SF: Detected %s with page size ", flash->name);
 	print_size(flash->sector_size, ", total ");
 	print_size(flash->size, "");
 	if (flash->memory_map)
 		printf(", mapped at %p", flash->memory_map);
 	puts("\n");
+#endif
 #ifndef CONFIG_SPI_FLASH_BAR
 	if (flash->size > SPI_FLASH_16MB_BOUN) {
 		puts("SF: Warning - Only lower 16MiB accessible,");
Signature · 1 line
1.7.0.4
#4 lore raw

PATCH v6 5/7 powerpc : p1022ds : enable p1022ds to start from eSPI with SPL

In reply to ying.zhang at freescale.com

From: Ying Zhang <[email protected]>

enable p1022ds to start from eSPI with SPL.

This patch is on top of the patch:
SPL : spi flash : support to start from eSPI with SPL

---
Compared with the original version, Changed as below:
1. Split from "boot from SD card/SPI flash with SPL".
2. No change.
3. No change.
4. No change.
5. Split from "powerpc/p1022ds: boot from spi flash with SPL" this patch enable P1022DS to start from eSPI with SPL.

 board/freescale/p1022ds/spl.c |   12 ++++++++++--
 include/configs/P1022DS.h     |   37 ++++++++++++++++++++++++++++++-------
 2 files changed, 40 insertions(+), 9 deletions(-)
board/freescale/p1022ds/spl.c +10 -2
index 40f000f..a041e35 100644
@@ -21,13 +21,12 @@
 
 #include <common.h>
 #include <ns16550.h>
-#include <asm/fsl_law.h>
-#include <asm/fsl_ddr_sdram.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <i2c.h>
 #include "../common/ngpixis.h"
 #include <fsl_esdhc.h>
+#include <spi_flash.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -54,6 +53,11 @@ void board_init_f(ulong bootflag)
 	setbits_be32(&gur->pmuxcr,
 		in_be32(&gur->pmuxcr) | MPC85xx_PMUXCR_SD_DATA);
 
+#ifdef CONFIG_SPL_SPI_BOOT
+	/* Enable the SPI */
+	clrsetbits_8(&pixis->brdcfg0, PIXIS_ELBC_SPI_MASK, PIXIS_SPI);
+#endif
+
 	/* Read back the register to synchronize the write. */
 	in_be32(&gur->pmuxcr);
 
@@ -67,6 +71,8 @@ void board_init_f(ulong bootflag)
 			bus_clk / 16 / CONFIG_BAUDRATE);
 #ifdef CONFIG_SPL_MMC_BOOT
 	puts("\nSD boot...\n");
+#elif defined(CONFIG_SPL_SPI_BOOT)
+	puts("\nSPI Flash boot...\n");
 #endif
 
 	/* copy code to RAM and jump to it - this should not return */
@@ -108,5 +114,7 @@ void board_init_r(gd_t *gd, ulong dest_addr)
 
 #ifdef CONFIG_SPL_MMC_BOOT
 	mmc_boot();
+#elif defined(CONFIG_SPL_SPI_BOOT)
+	spi_boot();
 #endif
 }
include/configs/P1022DS.h +30 -7
index 0c6e0ec..9e012c4 100644
@@ -49,11 +49,34 @@
 #endif
 
 #ifdef CONFIG_SPIFLASH
-#define CONFIG_RAMBOOT_SPIFLASH
-#define CONFIG_SYS_RAMBOOT
-#define CONFIG_SYS_EXTRA_ENV_RELOC
-#define CONFIG_SYS_TEXT_BASE		0x11000000
-#define CONFIG_RESET_VECTOR_ADDRESS	0x1107fffc
+#define CONFIG_SPL
+#define CONFIG_SPL_MPC8XXX_INIT_DDR_SUPPORT
+#define CONFIG_SPL_ENV_SUPPORT
+#define CONFIG_SPL_ENV_IMPORT
+#define CONFIG_SPL_SERIAL_SUPPORT
+#define CONFIG_SPL_SPI_SUPPORT
+#define CONFIG_SPL_SPI_FLASH_SUPPORT
+#define CONFIG_SPL_SPI_FLASH_MINIMAL
+#define CONFIG_SPL_FLUSH_IMAGE
+#define CONFIG_SPL_TARGET		"u-boot-with-spl.bin"
+#define CONFIG_SPL_LIBGENERIC_SUPPORT
+#define CONFIG_SPL_LIBCOMMON_SUPPORT
+#define CONFIG_SPL_I2C_SUPPORT
+#define CONFIG_FSL_LAW                 /* Use common FSL init code */
+#define CONFIG_SYS_TEXT_BASE		0x11001000
+#define CONFIG_SPL_TEXT_BASE		0xf8f81000
+#define CONFIG_SPL_PAD_TO		0x18000
+#define CONFIG_SPL_MAX_SIZE		(96 * 1024)
+#define CONFIG_SYS_SPI_FLASH_U_BOOT_SIZE	(512 << 10)
+#define CONFIG_SYS_SPI_FLASH_U_BOOT_DST	(0x11000000)
+#define CONFIG_SYS_SPI_FLASH_U_BOOT_START	(0x11000000)
+#define CONFIG_SYS_SPI_FLASH_U_BOOT_OFFS	(96 << 10)
+#define CONFIG_SYS_MPC85XX_NO_RESETVEC
+#define CONFIG_SYS_LDSCRIPT	"arch/powerpc/cpu/mpc85xx/u-boot.lds"
+#define CONFIG_SPL_SPI_BOOT
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SPL_COMMON_INIT_DDR
+#endif
 #endif
 
 #define CONFIG_NAND_FSL_ELBC
@@ -319,7 +342,7 @@
  * Config the L2 Cache as L2 SRAM
 */
 #if defined(CONFIG_SPL_BUILD)
-#if defined(CONFIG_SDCARD)
+#if defined(CONFIG_SDCARD) || defined(CONFIG_SPIFLASH)
 #define CONFIG_SYS_INIT_L2_ADDR		0xf8f80000
 #define CONFIG_SYS_INIT_L2_ADDR_PHYS	CONFIG_SYS_INIT_L2_ADDR
 #define CONFIG_SYS_L2_SIZE		(256 << 10)
@@ -564,7 +587,7 @@
 /*
  * Environment
  */
-#ifdef CONFIG_RAMBOOT_SPIFLASH
+#ifdef CONFIG_SPIFLASH
 #define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_ENV_SPI_BUS	0
 #define CONFIG_ENV_SPI_CS	0
Signature · 1 line
1.7.0.4
#5 lore raw

PATCH v6 6/7 nand: tpl : introduce the TPL based on the SPL

In reply to ying.zhang at freescale.com

From: Ying Zhang <[email protected]>

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can not be more than 4K. So, the SPL cannot initialize the DDR with the SPD code. This patch introduces TPL to enable a loader stub that runs in the L2 SRAM, after being loaded by the code from the SPL. It initializes the DDR with the SPD or other operations.

The TPL's size is sizeable, the maximum size must not exceed the size of L2 SRAM. It initializes the DDR through SPD code, and copys final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image,

This patch is on top of the patch:
SPL : spi flash : support to start from eSPI with SPL

---
Compared with the original version, Changed as below:
1. Split from "powerpc/p1022ds: nand: introduce the TPL based on the SPL".
2. No change.
3. No change.
4. No change.
5. Use ifdef to define "nand_load_image" to non-static for non-SPL

 Makefile                                           |   21 +++-
 README                                             |   57 +++++++-
 arch/powerpc/config.mk                             |    2 +
 .../cpu/mpc8xxx/ddr/lc_common_dimm_params.c        |    4 +-
 arch/powerpc/lib/Makefile                          |    2 +
 common/Makefile                                    |    9 +
 common/cmd_nvedit.c                                |    8 +-
 config.mk                                          |   32 ++++
 doc/README.TPL                                     |   69 +++++++++
 drivers/mtd/nand/Makefile                          |    7 +
 drivers/mtd/nand/fsl_elbc_spl.c                    |    5 +-
 drivers/serial/serial.c                            |    2 +-
 include/bootstage.h                                |    3 +-
 tpl/Makefile                                       |  161 ++++++++++++++++++++
 14 files changed, 368 insertions(+), 14 deletions(-)
 create mode 100644 doc/README.TPL
 create mode 100644 tpl/Makefile
Makefile +20 -1
index fdaddb9..0513e4d 100644
@@ -118,10 +118,11 @@ endif # ifneq ($(BUILD_DIR),)
 
 OBJTREE		:= $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
 SPLTREE		:= $(OBJTREE)/spl
+TPLTREE		:= $(OBJTREE)/tpl
 SRCTREE		:= $(CURDIR)
 TOPDIR		:= $(SRCTREE)
 LNDIR		:= $(OBJTREE)
-export	TOPDIR SRCTREE OBJTREE SPLTREE
+export	TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
 
 MKCONFIG	:= $(SRCTREE)/mkconfig
 export MKCONFIG
@@ -412,6 +413,7 @@ ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map
 ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin
 ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin
 ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin
+ALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
@@ -498,6 +500,18 @@ $(obj)u-boot-with-spl.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
 		rm $(obj)spl/u-boot-spl-pad.bin
 
+$(obj)u-boot-with-tpl.bin: $(obj)spl/u-boot-spl.bin $(obj)tpl/u-boot-tpl.bin \
+		$(obj)u-boot.bin
+		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
+			-I binary -O binary \
+			$(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl-pad.bin
+		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_PAD_TO) \
+			-I binary -O binary \
+			$(obj)tpl/u-boot-tpl.bin $(obj)tpl/u-boot-tpl-pad.bin
+		cat $(obj)spl/u-boot-spl-pad.bin $(obj)tpl/u-boot-tpl-pad.bin \
+			$(obj)u-boot.bin > $@
+		rm $(obj)spl/u-boot-spl-pad.bin $(obj)tpl/u-boot-tpl-pad.bin
+
 $(obj)u-boot-with-spl.imx: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(MAKE) -C $(SRCTREE)/arch/arm/imx-common \
 			$(OBJTREE)/u-boot-with-spl.imx
@@ -622,6 +636,9 @@ $(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
 $(obj)spl/u-boot-spl.bin:	$(SUBDIR_TOOLS) depend
 		$(MAKE) -C spl all
 
+$(obj)tpl/u-boot-tpl.bin:	$(SUBDIR_TOOLS) depend
+		$(MAKE) -C tpl all
+
 updater:
 		$(MAKE) -C tools/updater all
 
@@ -877,6 +894,8 @@ clobber:	tidy
 	@rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
 	@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
 	@rm -f $(obj)spl/u-boot-spl.lds
+	@rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map}
+	@rm -f $(obj)tpl/u-boot-tpl.lds
 	@rm -f $(obj)MLO MLO.byteswap
 	@rm -f $(obj)SPL
 	@rm -f $(obj)tools/xway-swap-bytes
README +53 -4

87 lines not on this page · raw message

arch/powerpc/config.mk +2 -0
index e32d2bf..aebb0aa 100644
@@ -48,5 +48,7 @@ endif
 
 # Only test once
 ifneq ($(CONFIG_SPL_BUILD),y)
+ifneq ($(CONFIG_TPL_BUILD),y)
 ALL-y += checkgcc4
 endif
+endif
arch/powerpc/cpu/mpc8xxx/ddr/lc_common_dimm_params.c +2 -2
index 56128a7..e46100a 100644
@@ -218,13 +218,13 @@ compute_lowest_common_dimm_parameters(const dimm_params_t *dimm_params,
 		if (dimm_params[i].n_ranks) {
 			if (dimm_params[i].registered_dimm) {
 				temp1 = 1;
-#ifndef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
 				printf("Detected RDIMM %s\n",
 					dimm_params[i].mpart);
 #endif
 			} else {
 				temp2 = 1;
-#ifndef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
 				printf("Detected UDIMM %s\n",
 					dimm_params[i].mpart);
 #endif
arch/powerpc/lib/Makefile +2 -0
index 59c723b..c61eb06 100644
@@ -59,10 +59,12 @@ SOBJS-y	+= reloc.o
 
 COBJS-$(CONFIG_BAT_RW) += bat_rw.o
 ifndef CONFIG_SPL_BUILD
+ifndef CONFIG_TPL_BUILD
 ifndef CONFIG_SYS_GENERIC_BOARD
 COBJS-y	+= board.o
 endif
 endif
+endif
 COBJS-y	+= bootm.o
 COBJS-y	+= cache.o
 COBJS-y	+= extable.o
common/Makefile +9 -0
index 3581603..b797e0c 100644
@@ -27,6 +27,7 @@ LIB	= $(obj)libcommon.o
 
 # core
 ifndef CONFIG_SPL_BUILD
+ifndef CONFIG_TPL_BUILD
 COBJS-y += main.o
 COBJS-y += command.o
 COBJS-y += exports.o
@@ -204,6 +205,7 @@ COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
 COBJS-$(CONFIG_CMD_DFU) += cmd_dfu.o
 COBJS-$(CONFIG_CMD_GPT) += cmd_gpt.o
 endif
+endif
 
 ifdef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
@@ -223,6 +225,13 @@ else
 COBJS-y += env_nowhere.o
 endif
 endif
+
+ifdef CONFIG_TPL_BUILD
+COBJS-$(CONFIG_SYS_ENV_SUPPORT) += env_attr.o
+COBJS-$(CONFIG_SYS_ENV_SUPPORT) += env_flags.o
+COBJS-$(CONFIG_SYS_ENV_SUPPORT) += env_callback.o
+endif
+
 # core command
 COBJS-y += cmd_nvedit.o
 #environment
common/cmd_nvedit.c +4 -4
index 2478c95..d91a2ef 100644
@@ -87,7 +87,7 @@ int get_env_id(void)
 	return env_id;
 }
 
-#ifndef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
 /*
  * Command interface: print one or all environment variables
  *
@@ -356,7 +356,7 @@ ulong getenv_hex(const char *varname, ulong default_val)
 	return value;
 }
 
-#ifndef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
 static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	if (argc < 2)
@@ -700,7 +700,7 @@ ulong getenv_ulong(const char *name, int base, ulong default_val)
 	return str ? simple_strtoul(str, NULL, base) : default_val;
 }
 
-#ifndef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
 #if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
 static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
 		       char * const argv[])
@@ -741,7 +741,7 @@ int envmatch(uchar *s1, int i2)
 	return -1;
 }
 
-#ifndef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
 static int do_env_default(cmd_tbl_t *cmdtp, int __flag,
 			  int argc, char * const argv[])
 {
config.mk +32 -0
index ddf350e..f2938f1 100644
@@ -41,8 +41,12 @@ ifneq ($(OBJTREE),$(SRCTREE))
 ifeq ($(CONFIG_SPL_BUILD),y)
 obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
 else
+ifeq ($(CONFIG_TPL_BUILD),y)
+obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/)
+else
 obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/)
 endif
+endif
 src := $(if $(dir),$(SRCTREE)/$(dir)/,$(SRCTREE)/)
 
 $(shell mkdir -p $(obj))
@@ -53,8 +57,14 @@ obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/)
 
 $(shell mkdir -p $(obj))
 else
+ifeq ($(CONFIG_TPL_BUILD),y)
+obj := $(if $(dir),$(TPLTREE)/$(dir)/,$(TPLTREE)/)
+
+$(shell mkdir -p $(obj))
+else
 obj :=
 endif
+endif
 src :=
 endif
 
@@ -210,6 +220,11 @@ CPPFLAGS += -ffunction-sections -fdata-sections
 LDFLAGS_FINAL += --gc-sections
 endif
 
+ifeq ($(CONFIG_TPL_BUILD),y)
+CPPFLAGS += -ffunction-sections -fdata-sections
+LDFLAGS_FINAL += --gc-sections
+endif
+
 ifneq ($(CONFIG_SYS_TEXT_BASE),)
 CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE)
 endif
@@ -218,10 +233,18 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),)
 CPPFLAGS += -DCONFIG_SPL_TEXT_BASE=$(CONFIG_SPL_TEXT_BASE)
 endif
 
+ifneq ($(CONFIG_TPL_TEXT_BASE),)
+CPPFLAGS += -DCONFIG_TPL_TEXT_BASE=$(CONFIG_TPL_TEXT_BASE)
+endif
+
 ifneq ($(CONFIG_SPL_PAD_TO),)
 CPPFLAGS += -DCONFIG_SPL_PAD_TO=$(CONFIG_SPL_PAD_TO)
 endif
 
+ifneq ($(CONFIG_SYS_PAD_TO),)
+CPPFLAGS += -DCONFIG_SYS_PAD_TO=$(CONFIG_SYS_PAD_TO)
+endif
+
 ifneq ($(CONFIG_UBOOT_PAD_TO),)
 CPPFLAGS += -DCONFIG_UBOOT_PAD_TO=$(CONFIG_UBOOT_PAD_TO)
 endif
@@ -230,6 +253,10 @@ ifeq ($(CONFIG_SPL_BUILD),y)
 CPPFLAGS += -DCONFIG_SPL_BUILD
 endif
 
+ifeq ($(CONFIG_TPL_BUILD),y)
+CPPFLAGS += -DCONFIG_TPL_BUILD
+endif
+
 # Does this architecture support generic board init?
 ifeq ($(__HAVE_ARCH_GENERIC_BOARD),)
 ifneq ($(CONFIG_SYS_GENERIC_BOARD),)
@@ -294,6 +321,11 @@ ifneq ($(CONFIG_SPL_TEXT_BASE),)
 LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE)
 endif
 
+LDFLAGS_u-boot-tpl += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL)
+ifneq ($(CONFIG_TPL_TEXT_BASE),)
+LDFLAGS_u-boot-tpl += -Ttext $(CONFIG_TPL_TEXT_BASE)
+endif
+
 # Linus' kernel sanity checking tool
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
                   -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
doc/README.TPL new file +69 -0

69 lines not on this page · raw message

drivers/mtd/nand/Makefile +7 -0
index bb81e84..5113642 100644
@@ -42,6 +42,7 @@ COBJS-$(CONFIG_SPL_NAND_BASE) += nand_base.o
 
 else # not spl
 
+ifndef CONFIG_TPL_BUILD
 NORMAL_DRIVERS=y
 
 COBJS-y += nand.o
@@ -51,6 +52,7 @@ COBJS-y += nand_util.o
 COBJS-y += nand_ecc.o
 COBJS-y += nand_base.o
 
+endif
 endif # not spl
 
 ifdef NORMAL_DRIVERS
@@ -82,9 +84,14 @@ COBJS-$(CONFIG_NAND_DOCG4) += docg4.o
 
 else  # minimal SPL drivers
 
+ifdef CONFIG_SPL_BUILD
 COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o
 COBJS-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_spl.o
 COBJS-$(CONFIG_NAND_MXC) += mxc_nand_spl.o
+endif
+ifdef CONFIG_TPL_BUILD
+COBJS-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o
+endif
 
 endif # drivers
 endif # nand
drivers/mtd/nand/fsl_elbc_spl.c +4 -1
index 50ff4fe..ab208fd 100644
@@ -47,7 +47,10 @@ static void nand_wait(void)
 	}
 }
 
-static int nand_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
+#ifdef CONFIG_SPL_BUILD
+static
+#endif
+int nand_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
 {
 	fsl_lbc_t *regs = LBC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
drivers/serial/serial.c +1 -1
index daa8003..81aca81 100644
@@ -371,7 +371,7 @@ static struct serial_device *get_current(void)
 
 	/* We must have a console device */
 	if (!dev) {
-#ifdef CONFIG_SPL_BUILD
+#if defined(CONFIG_SPL_BUILD) || defined(CONFIG_TPL_BUILD)
 		puts("Cannot find console\n");
 		hang();
 #else
include/bootstage.h +2 -1
index ef07a87..1e8c492 100644
@@ -220,7 +220,8 @@ enum bootstage_id {
  */
 ulong timer_get_boot_us(void);
 
-#if !defined(CONFIG_SPL_BUILD) && !defined(USE_HOSTCC)
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \
+	!defined(USE_HOSTCC)
 /*
  * Board code can implement show_boot_progress() if needed.
  *
tpl/Makefile new file +161 -0

161 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#6 lore raw

PATCH v6 6/7 nand: tpl : introduce the TPL based on the SPL

Quoted 12 lines · ying.zhang at freescale.com

From: Ying Zhang <[email protected]>

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that runs in the
L2 SRAM, after being loaded by the code from the SPL. It initializes the
DDR with the SPD or other operations.

Quoted 3 lines

The TPL's size is sizeable, the maximum size must not exceed the size of L2
SRAM.

Using L2 SRAM for this is an implementation detail, and not appropriate for a description of the generic TPL infrastructure. For example, on newer QorIQ chips you'd be using CPC (L3) SRAM.

Quoted 6 lines

It initializes the DDR through SPD code, and copys final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image,

This patch is on top of the patch:
SPL : spi flash : support to start from eSPI with SPL

You don't need to mention a dependency on an earlier patch in the same patchset (and when you do need to mention a dependency, it should be below the --- line so it doesn't go into the git history). OTOH, you do need to mention the dependency on the patch to have a separate autoconf.mk.

Quoted 75 lines

---
Compared with the original version, Changed as below:
1. Split from "powerpc/p1022ds: nand: introduce the TPL based on the SPL".
2. No change.
3. No change.
4. No change.
5. Use ifdef to define "nand_load_image" to non-static for non-SPL

 Makefile                                           |   21 +++-
 README                                             |   57 +++++++-
 arch/powerpc/config.mk                             |    2 +
 .../cpu/mpc8xxx/ddr/lc_common_dimm_params.c        |    4 +-
 arch/powerpc/lib/Makefile                          |    2 +
 common/Makefile                                    |    9 +
 common/cmd_nvedit.c                                |    8 +-
 config.mk                                          |   32 ++++
 doc/README.TPL                                     |   69 +++++++++
 drivers/mtd/nand/Makefile                          |    7 +
 drivers/mtd/nand/fsl_elbc_spl.c                    |    5 +-
 drivers/serial/serial.c                            |    2 +-
 include/bootstage.h                                |    3 +-
 tpl/Makefile                                       |  161  
++++++++++++++++++++
 14 files changed, 368 insertions(+), 14 deletions(-)
 create mode 100644 doc/README.TPL
 create mode 100644 tpl/Makefile
Makefile +2 -1
index fdaddb9..0513e4d 100644
@@ -118,10 +118,11 @@ endif # ifneq ($(BUILD_DIR),)
 
 OBJTREE		:= $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR))
 SPLTREE		:= $(OBJTREE)/spl
+TPLTREE		:= $(OBJTREE)/tpl
 SRCTREE		:= $(CURDIR)
 TOPDIR		:= $(SRCTREE)
 LNDIR		:= $(OBJTREE)
-export	TOPDIR SRCTREE OBJTREE SPLTREE
+export	TOPDIR SRCTREE OBJTREE SPLTREE TPLTREE
 
 MKCONFIG	:= $(SRCTREE)/mkconfig
 export MKCONFIG
@@ -412,6 +413,7 @@ ALL-y += $(obj)u-boot.srec $(obj)u-boot.bin  

$(obj)System.map
ALL-$(CONFIG_NAND_U_BOOT) += $(obj)u-boot-nand.bin ALL-$(CONFIG_ONENAND_U_BOOT) += $(obj)u-boot-onenand.bin ALL-$(CONFIG_SPL) += $(obj)spl/u-boot-spl.bin

Makefile +1 -0
+ALL-$(CONFIG_TPL) += $(obj)tpl/u-boot-tpl.bin
 ALL-$(CONFIG_OF_SEPARATE) += $(obj)u-boot.dtb $(obj)u-boot-dtb.bin
 ifneq ($(CONFIG_SPL_TARGET),)
 ALL-$(CONFIG_SPL) += $(obj)$(subst ",,$(CONFIG_SPL_TARGET))
@@ -498,6 +500,18 @@ $(obj)u-boot-with-spl.bin:  

$(obj)spl/u-boot-spl.bin $(obj)u-boot.bin

Makefile +1 -0
 		cat $(obj)spl/u-boot-spl-pad.bin $(obj)u-boot.bin > $@
 		rm $(obj)spl/u-boot-spl-pad.bin
 
+$(obj)u-boot-with-tpl.bin: $(obj)spl/u-boot-spl.bin  

$(obj)tpl/u-boot-tpl.bin \

Makefile +4 -0
+		$(obj)u-boot.bin
+		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SPL_PAD_TO) \
+			-I binary -O binary \
+			$(obj)spl/u-boot-spl.bin  

$(obj)spl/u-boot-spl-pad.bin

Makefile +3 -0
+		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_PAD_TO) \
+			-I binary -O binary \
+			$(obj)tpl/u-boot-tpl.bin  

$(obj)tpl/u-boot-tpl-pad.bin

Makefile +1 -0
+		cat $(obj)spl/u-boot-spl-pad.bin  

$(obj)tpl/u-boot-tpl-pad.bin \

Makefile +2 -0
+			$(obj)u-boot.bin > $@
+		rm $(obj)spl/u-boot-spl-pad.bin  
Quoted 1 line

$(obj)tpl/u-boot-tpl-pad.bin

Can we do this with less duplication? Ideally u-boot-with-tpl.bin would be just TPL and the main U-Boot, and then we'd feed that into the u-boot-with-spl.bin rule. Or even call the same code twice (pattern rule, make function, etc).

Quoted 15 lines
Makefile +2 -0
@@ -877,6 +894,8 @@ clobber:	tidy
 	@rm -f  
 $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
 	@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
 	@rm -f $(obj)spl/u-boot-spl.lds
+	@rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map}
+	@rm -f $(obj)tpl/u-boot-tpl.lds
 	@rm -f $(obj)MLO MLO.byteswap
 	@rm -f $(obj)SPL
Makefile +0 -0
 	@rm -f $(obj)tools/xway-swap-bytes
README +0 -0
index b941a56..0c20253 100644

README FIT uImage format: · line 3004

Quoted 8 lines
README +2 -2
@@ -2999,9 +2999,10 @@ FIT uImage format:
 		Set for the SPL on PPC mpc8xxx targets, support for
 		arch/powerpc/cpu/mpc8xxx/ddr/libddr.o in SPL binary.
 
-		CONFIG_SPL_COMMON_INIT_DDR
+		CONFIG_COMMON_INIT_DDR
 		Set for common ddr init with serial presence detect in
-		SPL binary.
+		SPL binary or TPL binary.

Please keep SPL in the name of these. Consider TPL as a type of SPL. Changing the name just causes a lot of churn, and it is confusing because you end up with a name that looks like it applies to the main U-Boot, when it actually applies just to SPL/TPL.

Quoted 11 lines
README +11 -0
+- CONFIG_SYS_MPC8XXX_INIT_DDR_SUPPORT
+		Set for the SPL on PPC mpc8xxx targets, support for
+		arch/powerpc/cpu/mpc8xxx/ddr/libddr.o.
+
+- CONFIG_SYS_ENV_SUPPORT
+		Support for the environment operating.
+
+- CONFIG_SYS_SERIAL_SUPPORT
+		Support for drivers/serial/libserial.o.
+
+- CONFIG_SYS_LIBGENERIC_SUPPORT

README Low Level (hardware related) configuration options: · line 4153

Quoted 10 lines
README +10 -0
+		Support for lib/libgeneric.o.
+
+- CONFIG_SYS_LIBCOMMON_SUPPORT
+		Support for common/libcommon.o.
+
+- CONFIG_SYS_I2C_SUPPORT
+		Support for drivers/i2c/libi2c.o.
+
+- CONFIG_SYS_NAND_SUPPORT
+		Support for drivers/mtd/nand/libnand.o.

Likewise, except here you seem to still be duplicating the SPL defines rather than renaming them. Also, CONFIG_SYS_ is generally used to describe the hardware or similar, not to indicate which parts of the source code to enable.

Quoted 15 lines
tpl/Makefile new file +4 -0
new file mode 100644
index 0000000..bb947e5
@@ -0,0 +1,161 @@
+#
+# Copyright 2013 Freescale Semiconductor, Inc.
+#
+# This program is free software; you can redistribute it and/or  

modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)

tpl/Makefile line 11

Quoted 5 lines
tpl/Makefile new file +5 -0
+# any later version.
+#
+
+CONFIG_TPL_BUILD := y
+export CONFIG_TPL_BUILD

Please find a way to reuse spl/Makefile by invoking it twice.

-Scott

#7 lore raw

PATCH v6 6/7 nand: tpl : introduce the TPL based on the SPL

-----Original Message-----
From: Wood Scott-B07421
Sent: Thursday, June 27, 2013 6:33 AM
To: Zhang Ying-B40530
Cc: u-boot at lists.denx.de; afleming at gmail.com; Xie Xiaobo-R63061; Zhang Ying-B40530
Subject: Re: [PATCH 6/7 v6] nand: tpl : introduce the TPL based on the SPL

Quoted 12 lines · ying.zhang at freescale.com

From: Ying Zhang <[email protected]>

Due to the nand SPL on some board(e.g. P1022DS)has a size limit, it can
not be more than 4K. So, the SPL cannot initialize the DDR with the SPD
code. This patch introduces TPL to enable a loader stub that runs in the
L2 SRAM, after being loaded by the code from the SPL. It initializes the
DDR with the SPD or other operations.

Quoted 3 lines

The TPL's size is sizeable, the maximum size must not exceed the size of L2
SRAM.

Using L2 SRAM for this is an implementation detail, and not appropriate for a description of the generic TPL infrastructure. For example, on newer QorIQ chips you'd be using CPC (L3) SRAM.

Quoted 6 lines

It initializes the DDR through SPD code, and copys final uboot image to DDR. So there are three stage uboot images:
* spl_boot, * tpl_boot, * final uboot image,

This patch is on top of the patch:
SPL : spi flash : support to start from eSPI with SPL

You don't need to mention a dependency on an earlier patch in the same patchset (and when you do need to mention a dependency, it should be below the --- line so it doesn't go into the git history). OTOH, you do need to mention the dependency on the patch to have a separate autoconf.mk.
[Zhang Ying]
I want to know when the patch that creates a separate autoconf.mk can be merged?
My patch need to be verified on the basis of it.

#8 lore raw

PATCH v6 6/7 nand: tpl : introduce the TPL based on the SPL

Quoted 9 lines · On 06/28/2013 02:57:55 AM, Zhang Ying-B40530 wrote:

You don't need to mention a dependency on an earlier patch in the same patchset (and when you do need to mention a dependency, it should be below the --- line so it doesn't go into the git history). OTOH, you do need to mention the dependency on the patch to have a separate autoconf.mk.
[Zhang Ying]
I want to know when the patch that creates a separate autoconf.mk can be merged?
My patch need to be verified on the basis of it.

You could include it as the first patch in your series (be sure to leave the authorship intact).

-Scott

#9 lore raw

PATCH v6 6/7 nand: tpl : introduce the TPL based on the SPL

I haven't subscribe the mail list and I didn't find the patch "creates a separate autoconf.mk". Can you tell me where I can find it? Thanks.

-----Original Message-----
From: Wood Scott-B07421
Sent: Saturday, June 29, 2013 3:40 AM
To: Zhang Ying-B40530
Cc: Wood Scott-B07421; u-boot at lists.denx.de; afleming at gmail.com; Xie Xiaobo-R63061
Subject: Re: [PATCH 6/7 v6] nand: tpl : introduce the TPL based on the SPL

Quoted 9 lines · On 06/28/2013 02:57:55 AM, Zhang Ying-B40530 wrote:

You don't need to mention a dependency on an earlier patch in the same patchset (and when you do need to mention a dependency, it should be below the --- line so it doesn't go into the git history). OTOH, you do need to mention the dependency on the patch to have a separate autoconf.mk.
[Zhang Ying]
I want to know when the patch that creates a separate autoconf.mk can be merged?
My patch need to be verified on the basis of it.

You could include it as the first patch in your series (be sure to leave the authorship intact).

-Scott

#10 lore raw

PATCH v6 6/7 nand: tpl : introduce the TPL based on the SPL

Quoted 3 lines · On 07/01/2013 03:48:16 AM, Zhang Ying-B40530 wrote:

I haven't subscribe the mail list and I didn't find the patch "creates a separate autoconf.mk". Can you tell me where I can find it? Thanks.

Search in http://patchwork.ozlabs.org/project/uboot/list/

-Scott

#11 lore raw

PATCH v6 7/7 powerpc: p1022ds: support TPL on the P1022DS

In reply to ying.zhang at freescale.com

From: Ying Zhang <[email protected]>

Support TPL on the P1022DS.
The TPL's size is sizeable, the maximum size must not exceed the size of L2 SRAM. It initializes the DDR through SPD code, and copys final uboot image to DDR. So there are three stage uboot images:
* spl_boot, 4KB size, pad to 128K byte.
* tpl_boot, 88K size, pad to 128K size. The env variables are copied to L2 SRAM, so that ddr SPD code can get the interleaving mode setting in env. It loads final uboot image from offset 256KB.
* final uboot image, size is variable depends on the functions enabled.

This patch is on top of the patch:
nand: tpl : introduce the TPL based on the SPL

---
Compared with the original version, Changed as below:
1. Split from "powerpc/p1022ds: nand: introduce the TPL based on the SPL".
2. No change.
3. No change.
4. No change.
5. Change functionality nand_load_image to nand_load, it is called in TPL.

 Makefile                                |    3 +-
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds |    4 +
 board/freescale/p1022ds/Makefile        |    3 +
 board/freescale/p1022ds/spl_minimal.c   |   57 ++---------------
 board/freescale/p1022ds/tlb.c           |    4 +-
 board/freescale/p1022ds/tpl.c           |  102 +++++++++++++++++++++++++++++++
 drivers/mtd/nand/fsl_elbc_spl.c         |    8 +-
 include/configs/P1022DS.h               |   77 ++++++++++++++++++-----
 8 files changed, 184 insertions(+), 74 deletions(-)
 create mode 100644 board/freescale/p1022ds/tpl.c
Makefile +2 -1
index 0513e4d..a3c7282 100644
@@ -895,7 +895,7 @@ clobber:	tidy
 	@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
 	@rm -f $(obj)spl/u-boot-spl.lds
 	@rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map}
-	@rm -f $(obj)tpl/u-boot-tpl.lds
+	@rm -f $(obj)tpl/u-boot-spl.lds
 	@rm -f $(obj)MLO MLO.byteswap
 	@rm -f $(obj)SPL
 	@rm -f $(obj)tools/xway-swap-bytes
@@ -906,6 +906,7 @@ clobber:	tidy
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
 	@rm -f $(obj)dts/*.tmp
 	@rm -f $(obj)spl/u-boot-spl{,-pad}.ais
+	@rm -f $(obj)tpl/u-boot-tpl{,-pad}.ais
 
 mrproper \
 distclean:	clobber unconfig
arch/powerpc/cpu/mpc85xx/u-boot-spl.lds +4 -0
index 8aeb1a0..3167d2d 100644
@@ -35,7 +35,11 @@ PHDRS
 #endif
 SECTIONS
 {
+#ifdef CONFIG_SPL_BUILD
 	. = CONFIG_SPL_TEXT_BASE;
+#else
+	. = CONFIG_TPL_TEXT_BASE;
+#endif
 	.text : {
 		*(.text*)
 	}
board/freescale/p1022ds/Makefile +3 -0
index 9746063..58f224e 100644
@@ -27,6 +27,9 @@ else
 ifdef CONFIG_SPL_BUILD
 COBJS-y += spl.o
 endif
+ifdef CONFIG_TPL_BUILD
+COBJS-y += tpl.o
+endif
 COBJS-y	+= $(BOARD).o
 COBJS-y	+= ddr.o
 COBJS-y	+= law.o
board/freescale/p1022ds/spl_minimal.c +7 -50

83 lines not on this page · raw message

board/freescale/p1022ds/tlb.c +2 -2
index 9b14c37..aed8b86 100644
@@ -41,7 +41,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I|MAS2_G,
 		      0, 1, BOOKE_PAGESZ_1M, 1),
 
-#ifndef CONFIG_SPL_BUILD
+#if !defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD)
 	/* W**G* - Flash/promjet, localbus */
 	/* This will be changed to *I*G* after relocation to RAM. */
 	SET_TLB_ENTRY(1, CONFIG_SYS_FLASH_BASE, CONFIG_SYS_FLASH_BASE_PHYS,
@@ -75,7 +75,7 @@ struct fsl_e_tlb_entry tlb_table[] = {
 		      0, 7, BOOKE_PAGESZ_4K, 1),
 
 #if defined(CONFIG_SYS_RAMBOOT) || \
-	(defined(CONFIG_SPL) && !defined(CONFIG_SPL_COMMON_INIT_DDR))
+	(defined(CONFIG_SPL) && !defined(CONFIG_COMMON_INIT_DDR))
 	/* **** - eSDHC/eSPI/NAND boot */
 	SET_TLB_ENTRY(1, CONFIG_SYS_DDR_SDRAM_BASE, CONFIG_SYS_DDR_SDRAM_BASE,
 			MAS3_SX|MAS3_SW|MAS3_SR, 0,
board/freescale/p1022ds/tpl.c new file +102 -0

102 lines not on this page · raw message

drivers/mtd/nand/fsl_elbc_spl.c +4 -4
index ab208fd..8924e2d 100644
@@ -50,7 +50,7 @@ static void nand_wait(void)
 #ifdef CONFIG_SPL_BUILD
 static
 #endif
-int nand_load_image(uint32_t offs, unsigned int uboot_size, void *vdst)
+int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
 {
 	fsl_lbc_t *regs = LBC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
@@ -140,16 +140,16 @@ void nand_boot(void)
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	nand_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+	nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS,
 			CONFIG_SYS_NAND_U_BOOT_SIZE,
 			(void *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST
-	nand_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
 			(void *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+	nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
 			(void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif
include/configs/P1022DS.h +60 -17

131 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#12 lore raw

PATCH v6 7/7 powerpc: p1022ds: support TPL on the P1022DS

Makefile clobber: tidy · line 898

Quoted 10 lines · ying.zhang at freescale.com
Makefile +1 -1
index 0513e4d..a3c7282 100644
@@ -895,7 +895,7 @@ clobber:	tidy
 	@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
 	@rm -f $(obj)spl/u-boot-spl.lds
 	@rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map}
-	@rm -f $(obj)tpl/u-boot-tpl.lds
+	@rm -f $(obj)tpl/u-boot-spl.lds

Huh?

Makefile clobber: tidy · line 909

Quoted 9 lines
Makefile +0 -0
 	@rm -f $(obj)MLO MLO.byteswap
 	@rm -f $(obj)SPL
 	@rm -f $(obj)tools/xway-swap-bytes
@@ -906,6 +906,7 @@ clobber:	tidy
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type  

l -print | xargs rm -f

Makefile +1 -0
 	@rm -f $(obj)dts/*.tmp
 	@rm -f $(obj)spl/u-boot-spl{,-pad}.ais
+	@rm -f $(obj)tpl/u-boot-tpl{,-pad}.ais

Is there ever a TPL that ends in .ais?

Quoted 100 lines
board/freescale/p1022ds/tpl.c new file +59 -0
new file mode 100644
index 0000000..628b9e8
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ *
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#include <common.h>
+#include <ns16550.h>
+#include <malloc.h>
+#include <i2c.h>
+#include <nand.h>
+#include "../common/ngpixis.h"
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const u32 sysclk_tbl[] = {
+	66666000, 7499900, 83332500, 8999900,
+	99999000, 11111000, 12499800, 13333200
+};
+
+ulong get_effective_memsize(void)
+{
+	return CONFIG_SYS_L2_SIZE;
+}
+
+void board_init_f(ulong bootflag)
+{
+	int px_spd;
+	u32 plat_ratio, sys_clk, bus_clk;
+	ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
+
+	console_init_f();
+	/* Set pmuxcr to allow both i2c1 and i2c2 */
+	setbits_be32(&gur->pmuxcr, in_be32(&gur->pmuxcr) | 0x1000);
+	setbits_be32(&gur->pmuxcr,
+		in_be32(&gur->pmuxcr) | MPC85xx_PMUXCR_SD_DATA);
+
+	/* Read back the register to synchronize the write. */
+	in_be32(&gur->pmuxcr);
+
+	/* initialize selected port with appropriate baud rate */
+	px_spd = in_8((unsigned char *)(PIXIS_BASE + PIXIS_SPD));
+	sys_clk = sysclk_tbl[px_spd & PIXIS_SPD_SYSCLK_MASK];
+	plat_ratio = in_be32(&gur->porpllsr) &  

MPC85xx_PORPLLSR_PLAT_RATIO;

board/freescale/p1022ds/tpl.c new file +33 -0
+	bus_clk = sys_clk * plat_ratio / 2;
+
+	NS16550_init((NS16550_t)CONFIG_SYS_NS16550_COM1,
+			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_SYS_NAND_U_BOOT_RELOC_SP, 0,
+			CONFIG_SYS_NAND_U_BOOT_RELOC);
+}
+
+void board_init_r(gd_t *gd, ulong dest_addr)
+{
+	/* Pointer is writable since we allocated a register for it */
+	gd = (gd_t *)CONFIG_SYS_GD_ADDR;
+	bd_t *bd;
+
+	memset(gd, 0, sizeof(gd_t));
+	bd = (bd_t *)(CONFIG_SYS_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_SYS_RELOC_MALLOC_ADDR, \
+			CONFIG_SYS_RELOC_MALLOC_SIZE);
+	/* relocate environment function pointers etc. */
+	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+		(uchar *)CONFIG_ENV_ADDR);
+

board/freescale/p1022ds/tpl.c line 102

Quoted 10 lines
board/freescale/p1022ds/tpl.c new file +10 -0
+	gd->env_addr  = (ulong)(CONFIG_ENV_ADDR);
+	gd->env_valid = 1;
+
+	i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
+	gd->ram_size = initdram(0);
+	puts("Tertiary program loader running in sram...");
+
+	nand_boot();
+}

This looks a lot like board/freescale/p1022ds/spl.c. Find a way to share them.

Don't hardcode that it's NAND boot.

Quoted 25 lines
drivers/mtd/nand/fsl_elbc_spl.c +1 -1
index ab208fd..8924e2d 100644
@@ -50,7 +50,7 @@ static void nand_wait(void)
 #ifdef CONFIG_SPL_BUILD
 static
 #endif
-int nand_load_image(uint32_t offs, unsigned int uboot_size, void  
 *vdst)
+int nand_load(uint32_t offs, unsigned int uboot_size, void *vdst)
 {
 	fsl_lbc_t *regs = LBC_BASE_ADDR;
drivers/mtd/nand/fsl_elbc_spl.c +1 -1
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
@@ -140,16 +140,16 @@ void nand_boot(void)
 	/*
 	 * Load U-Boot image from NAND into RAM
 	 */
-	nand_load_image(CONFIG_SYS_NAND_U_BOOT_OFFS,
+	nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS,
 			CONFIG_SYS_NAND_U_BOOT_SIZE,
 			(void *)CONFIG_SYS_NAND_U_BOOT_DST);
 
 #ifdef CONFIG_NAND_ENV_DST

drivers/mtd/nand/fsl_elbc_spl.c void nand_boot(void) · line 155

Quoted 10 lines
drivers/mtd/nand/fsl_elbc_spl.c +2 -2
-	nand_load_image(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
+	nand_load(CONFIG_ENV_OFFSET, CONFIG_ENV_SIZE,
 			(void *)CONFIG_NAND_ENV_DST);
 
 #ifdef CONFIG_ENV_OFFSET_REDUND
-	nand_load_image(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
+	nand_load(CONFIG_ENV_OFFSET_REDUND, CONFIG_ENV_SIZE,
 			(void *)CONFIG_NAND_ENV_DST + CONFIG_ENV_SIZE);
 #endif
 #endif

Why?

-Scott