Skip to contentSkip to conversation

Introduce the Tertiary Program loader

PATCH New Haiying.Wang at freescale.com 6 participants 22 messages Jan 28, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 3/8 Introduce the Tertiary Program loader

From: Haiying Wang <[email protected]>

TPL is introduced to enable a loader stub that boots out of some type of RAM, after being loaded by an SPL or similar platform-specific mechanism.

One example of using this tpl loader is to initialize the ddr through spd code in case the L2 SRAM size is not big enough to hold the final uboot image and the nand spl code needs to be limitated to 4K byte, then tpl code will load the final uboot image after ddr is initialized.

---
v3: remove TPL_BOOT, use HAS_TPL and IN_TPL

 Makefile |   15 ++++++++++++++-
 README   |   27 +++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletions(-)
Makefile +14 -1
index 0d1ea5d..ae5db69 100644
@@ -402,8 +402,19 @@ $(obj)u-boot.lds: $(LDSCRIPT)
 nand_spl:	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
 		$(MAKE) -C nand_spl/board/$(BOARDDIR) all
 
+tpl:		$(TIMESTAMP_FILE) $(VERSION_FILE) depend
+		$(MAKE) -C tpl/board/$(BOARDDIR) all
+
+NAND_SPL_OBJS-y += $(obj)nand_spl/u-boot-spl-16k.bin
+NAND_SPL_OBJS-$(CONFIG_HAS_TPL) += $(obj)tpl/u-boot-tpl.bin
+NAND_SPL_OBJS-y += $(obj)u-boot.bin
+
+ifeq ($(CONFIG_HAS_TPL),y)
+$(obj)u-boot-nand.bin:	nand_spl tpl $(obj)u-boot.bin
+else
 $(obj)u-boot-nand.bin:	nand_spl $(obj)u-boot.bin
-		cat $(obj)nand_spl/u-boot-spl-16k.bin $(obj)u-boot.bin > $(obj)u-boot-nand.bin
+endif
+		cat $(NAND_SPL_OBJS-y) > $(obj)u-boot-nand.bin
 
 onenand_ipl:	$(TIMESTAMP_FILE) $(VERSION_FILE) $(obj)include/autoconf.mk
 		$(MAKE) -C onenand_ipl/board/$(BOARDDIR) all
@@ -1221,6 +1232,7 @@ clean:
 	@rm -f $(obj)lib/asm-offsets.s
 	@rm -f $(obj)nand_spl/{u-boot.lds,u-boot-spl,u-boot-spl.map,System.map}
 	@rm -f $(obj)onenand_ipl/onenand-{ipl,ipl.bin,ipl.map}
+	@rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.map}
 	@rm -f $(ONENAND_BIN)
 	@rm -f $(obj)onenand_ipl/u-boot.lds
 	@rm -f $(TIMESTAMP_FILE) $(VERSION_FILE)
@@ -1245,6 +1257,7 @@ clobber:	clean
 	@rm -fr $(obj)include/generated
 	@[ ! -d $(obj)nand_spl ] || find $(obj)nand_spl -name "*" -type l -print | xargs rm -f
 	@[ ! -d $(obj)onenand_ipl ] || find $(obj)onenand_ipl -name "*" -type l -print | xargs rm -f
+	@[ ! -d $(obj)tpl ] || find $(obj)tpl -name "*" -type l -print | xargs rm -f
 
 ifeq ($(OBJTREE),$(SRCTREE))
 mrproper \
README +27 -0
index 755d17c..a37fdb1 100644
@@ -2124,6 +2124,33 @@ FIT uImage format:
 		Adds the MTD partitioning infrastructure from the Linux
 		kernel. Needed for UBI support.
 
+- NAND Boot Support
+		CONFIG_NAND_U_BOOT
+
+		Builds a U-Boot image that boots from NAND, prefixed by a small
+		loader stub (secondary program loader -- SPL) that loads the
+		rest of U-Boot into RAM.  This symbol will be set in all build
+		phases.
+
+		CONFIG_NAND_SPL
+
+		This is set by the build system when compiling code to go into
+		the SPL.  It is not set when building the code that the SPL
+		loads.
+
+- TPL Boot Support
+		CONFIG_HAS_TPL
+
+		Builds a U-Boot image that contains a loader stub (tertiary
+		program loader -- TPL) that boots out of some type of RAM,
+		after being loaded by an SPL or similar platform-specific
+		mechanism.  This symbol will be set in all build phases.
+
+		CONFIG_IN_TPL
+
+		This is set by the build system when compiling code to go into
+		the TPL.  It is not set when building the code that the TPL
+		loads, or when building the SPL.
 
 Modem Support:
 --------------
Signature · 1 line
1.7.3.1.50.g1e633
#1 lore raw

PATCH v3 4/8 powerpc/85xx: add TPL support

From: Haiying Wang <[email protected]>

---
v3: Use HAS_TPL and IN_TPL, change initdram for TPL, fix the inconsistent comments.

 arch/powerpc/cpu/mpc85xx/cpu.c           |    7 ++
 arch/powerpc/cpu/mpc85xx/cpu_init_nand.c |   22 ++++++-
 arch/powerpc/cpu/mpc85xx/start.S         |   12 ++--
 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds  |   99 ++++++++++++++++++++++++++++++
 4 files changed, 132 insertions(+), 8 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds
arch/powerpc/cpu/mpc85xx/cpu.c +7 -0
index 1aad2ba..e923547 100644
@@ -296,6 +296,12 @@ void mpc85xx_reginfo(void)
 #ifndef CONFIG_FSL_CORENET
 phys_size_t initdram(int board_type)
 {
+#if defined(CONFIG_HAS_TPL) && !defined(CONFIG_IN_TPL)
+	/* ddr has been initialized in tpl boot stage thus we only need
+	 * to get the ddr dram size for the final uboot.
+	 */
+	return fsl_ddr_sdram_size();
+#else
 	phys_size_t dram_size = 0;
 
 #if defined(CONFIG_SYS_FSL_ERRATUM_DDR_MSYNC_IN)
@@ -342,6 +348,7 @@ phys_size_t initdram(int board_type)
 
 	puts("DDR: ");
 	return dram_size;
+#endif /* CONFIG_HAS_TPL */
 }
 #endif
 
arch/powerpc/cpu/mpc85xx/cpu_init_nand.c +20 -2
index 8fb27ab..65c32d9 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Freescale Semiconductor, Inc.
+ * Copyright 2009 - 2011 Freescale Semiconductor, Inc.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -23,6 +23,8 @@
 #include <common.h>
 #include <asm/io.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 void cpu_init_f(void)
 {
 	fsl_lbc_t *lbc = LBC_BASE_ADDR;
@@ -40,7 +42,8 @@ void cpu_init_f(void)
 #error  CONFIG_NAND_BR_PRELIM, CONFIG_NAND_OR_PRELIM must be defined
 #endif
 
-#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR)
+#if defined(CONFIG_SYS_RAMBOOT) && defined(CONFIG_SYS_INIT_L2_ADDR) \
+	&& !defined(CONFIG_IN_TPL)
 	ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
 	char *l2srbar;
 	int i;
@@ -60,4 +63,19 @@ void cpu_init_f(void)
 	for (i = 0; i < CONFIG_SYS_L2_SIZE; i++)
 		l2srbar[i] = 0;
 #endif
+#ifdef CONFIG_IN_TPL
+	init_used_tlb_cams();
+#endif
+}
+
+#ifdef CONFIG_IN_TPL
+/*
+ * Because the primary cpu's info is enough for the 2nd stage,  we define the
+ * cpu number to 1 so as to keep code size for 2nd stage binary as small as
+ * possible.
+ */
+int cpu_numcores()
+{
+	return 1;
 }
+#endif /* CONFIG_IN_TPL */
arch/powerpc/cpu/mpc85xx/start.S +6 -6
index fa98af6..5496fc4 100644
@@ -58,12 +58,12 @@
 	GOT_ENTRY(_GOT2_TABLE_)
 	GOT_ENTRY(_FIXUP_TABLE_)
 
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_IN_TPL)
 	GOT_ENTRY(_start)
 	GOT_ENTRY(_start_of_vectors)
 	GOT_ENTRY(_end_of_vectors)
 	GOT_ENTRY(transfer_to_handler)
-#endif
+#endif /* !CONFIG_NAND_SPL && !CONFIG_IN_TPL*/
 
 	GOT_ENTRY(__init_end)
 	GOT_ENTRY(_end)
@@ -435,7 +435,7 @@ _start_cont:
 
 	/* NOTREACHED - board_init_f() does not return */
 
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_IN_TPL)
 	. = EXC_OFF_SYS_RESET
 	.globl	_start_of_vectors
 _start_of_vectors:
@@ -877,7 +877,7 @@ in32:
 in32r:
 	lwbrx	r3,r0,r3
 	blr
-#endif  /* !CONFIG_NAND_SPL */
+#endif  /* !CONFIG_NAND_SPL && !CONFIG_IN_TPL */
 
 /*------------------------------------------------------------------------------*/
 
@@ -1067,7 +1067,7 @@ clear_bss:
 	mr	r4,r10		/* Destination Address		*/
 	bl	board_init_r
 
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_IN_TPL)
 	/*
 	 * Copy exception vector code to low memory
 	 *
@@ -1207,4 +1207,4 @@ setup_ivors:
 
 #include "fixed_ivor.S"
 	blr
-#endif /* !CONFIG_NAND_SPL */
+#endif /* !CONFIG_NAND_SPL && !CONFIG_IN_TPL */
arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
1.7.3.1.50.g1e633
#2 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

In reply to Haiying.Wang at freescale.com

From: Haiying Wang <[email protected]>

Support P1021MDS board to boot from NAND flash (No NOR flash on this board). And because P1021 only has 256K L2 SRAM, which can not used for final uboot image, this patch also enables the TPL BOOT on P1021MDS so that DDR can be initialized in L2 SRAM through SPD code. So there are three stage uboot images:
* nand_spl, pad from 4KB size to 16KB, load tpl_boot from offset 16KB in NAND.
* tpl_boot, 112KB size. The env variables are copied to offset 128KB in L2 SRAM, so that ddr spd code can get the interleaving mode setting in env. It loads final uboot image from offset 128KB in NAND.
* final uboot image, size is variable depends on the functions enabled.

---
v3: use CONFIG_HAS_TPL and CONFIG_IN_TPL, update copyright year, remove pci.c, incoperate with the changes in upstream.

 MAINTAINERS                                   |    4 +
 board/freescale/p1021mds/Makefile             |   52 +++
 board/freescale/p1021mds/config.mk            |   31 ++
 board/freescale/p1021mds/ddr.c                |  107 +++++
 board/freescale/p1021mds/law.c                |   38 ++
 board/freescale/p1021mds/p1021mds.c           |  133 ++++++
 board/freescale/p1021mds/tlb.c                |  102 +++++
 boards.cfg                                    |    1 +
 include/configs/P1021MDS.h                    |  571 +++++++++++++++++++++++++
 nand_spl/board/freescale/p1021mds/Makefile    |  134 ++++++
 nand_spl/board/freescale/p1021mds/nand_boot.c |   69 +++
 nand_spl/nand_boot_fsl_elbc.c                 |    6 +-
 tpl/board/freescale/p1021mds/Makefile         |  256 +++++++++++
 tpl/board/freescale/p1021mds/tpl_boot.c       |   79 ++++
 14 files changed, 1582 insertions(+), 1 deletions(-)
 create mode 100644 board/freescale/p1021mds/Makefile
 create mode 100644 board/freescale/p1021mds/config.mk
 create mode 100644 board/freescale/p1021mds/ddr.c
 create mode 100644 board/freescale/p1021mds/law.c
 create mode 100644 board/freescale/p1021mds/p1021mds.c
 create mode 100644 board/freescale/p1021mds/tlb.c
 create mode 100644 include/configs/P1021MDS.h
 create mode 100644 nand_spl/board/freescale/p1021mds/Makefile
 create mode 100644 nand_spl/board/freescale/p1021mds/nand_boot.c
 create mode 100644 tpl/board/freescale/p1021mds/Makefile
 create mode 100644 tpl/board/freescale/p1021mds/tpl_boot.c
MAINTAINERS +4 -0
index edd1c5c..da1b2a3 100644
@@ -17,6 +17,10 @@
 #	Board		CPU						#
 #########################################################################
 
+Haiying Wang <[email protected]>
+
+	P1021MDS	P1021
+
 Poonam Aggrwal <[email protected]>
 
 	P2020RDB	P2020
board/freescale/p1021mds/Makefile new file +52 -0

52 lines not on this page · raw message

board/freescale/p1021mds/config.mk new file +31 -0
new file mode 100644
index 0000000..3888f61
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2010 - 2011 Freescale Semiconductor, Inc.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# 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
+#
+# p1021mds board
+#
+
+ifndef NAND_SPL
+ifndef IN_TPL
+ifeq ($(CONFIG_NAND), y)
+LDSCRIPT := $(TOPDIR)/$(CPUDIR)/u-boot-nand.lds
+endif
+endif
+endif
board/freescale/p1021mds/ddr.c new file +107 -0

107 lines not on this page · raw message

board/freescale/p1021mds/law.c new file +38 -0
new file mode 100644
index 0000000..d0be19e
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 - 2011 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 <asm/fsl_law.h>
+#include <asm/mmu.h>
+
+struct law_entry law_table[] = {
+#ifndef CONFIG_IN_TPL
+	SET_LAW(CONFIG_SYS_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
+	SET_LAW(CONFIG_SYS_PCIE1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_1),
+	SET_LAW(CONFIG_SYS_PCIE2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_2),
+	SET_LAW(CONFIG_SYS_PCIE2_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_2),
+	SET_LAW(CONFIG_SYS_BCSR_BASE_PHYS, LAW_SIZE_256K, LAW_TRGT_IF_LBC),
+#endif /* !CONFIG_IN_TPL */
+	SET_LAW(CONFIG_SYS_NAND_BASE_PHYS, LAW_SIZE_1M, LAW_TRGT_IF_LBC),
+};
+
+int num_law_entries = ARRAY_SIZE(law_table);
board/freescale/p1021mds/p1021mds.c new file +133 -0

133 lines not on this page · raw message

board/freescale/p1021mds/tlb.c new file +102 -0

102 lines not on this page · raw message

boards.cfg +1 -0
index eceacf6..0787a9a 100644
@@ -483,6 +483,7 @@ P1020RDB                     powerpc     mpc85xx     p1_p2_rdb           freesca
 P1020RDB_NAND                powerpc     mpc85xx     p1_p2_rdb           freescale      -           P1_P2_RDB:P1020RDB,NAND
 P1020RDB_SDCARD              powerpc     mpc85xx     p1_p2_rdb           freescale      -           P1_P2_RDB:P1020RDB,SDCARD
 P1020RDB_SPIFLASH            powerpc     mpc85xx     p1_p2_rdb           freescale      -           P1_P2_RDB:P1020,SPIFLASH
+P1021MDS_NAND		     powerpc     mpc85xx     p1021mds            freescale      -           P1021MDS:NAND
 P1022DS                      powerpc     mpc85xx     p1022ds             freescale
 P2010RDB                     powerpc     mpc85xx     p1_p2_rdb           freescale      -           P1_P2_RDB:P2010
 P2010RDB_NAND                powerpc     mpc85xx     p1_p2_rdb           freescale      -           P1_P2_RDB:P2010,NAND
include/configs/P1021MDS.h new file +571 -0

571 lines not on this page · raw message

nand_spl/board/freescale/p1021mds/Makefile new file +134 -0

134 lines not on this page · raw message

nand_spl/board/freescale/p1021mds/nand_boot.c new file +69 -0

69 lines not on this page · raw message

nand_spl/nand_boot_fsl_elbc.c +5 -1
index 9547d44..8b135bc 100644
@@ -4,7 +4,7 @@
  * (C) Copyright 2006-2008
  * Stefan Roese, DENX Software Engineering, sr at denx.de.
  *
- * Copyright (c) 2008 Freescale Semiconductor, Inc.
+ * Copyright (c) 2008-2011 Freescale Semiconductor, Inc.
  * Author: Scott Wood <[email protected]>
  *
  * This program is free software; you can redistribute it and/or
@@ -47,7 +47,11 @@ static void nand_wait(void)
 	}
 }
 
+#ifdef CONFIG_IN_TPL
+void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#else
 static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
+#endif
 {
 	fsl_lbc_t *regs = LBC_BASE_ADDR;
 	uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
tpl/board/freescale/p1021mds/Makefile new file +256 -0

256 lines not on this page · raw message

tpl/board/freescale/p1021mds/tpl_boot.c new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
1.7.3.1.50.g1e633
#3 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

Quoted 31 lines
board/freescale/p1021mds/law.c new file +22 -0
new file mode 100644
index 0000000..d0be19e
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010 - 2011 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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
+ */
+

board/freescale/p1021mds/law.c line 32

Quoted 10 lines
board/freescale/p1021mds/law.c new file +10 -0
+#include <common.h>
+#include <asm/fsl_law.h>
+#include <asm/mmu.h>
+
+struct law_entry law_table[] = {
+#ifndef CONFIG_IN_TPL
+	SET_LAW(CONFIG_SYS_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
+	SET_LAW(CONFIG_SYS_PCIE1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_1),
+	SET_LAW(CONFIG_SYS_PCIE2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_2),
+	SET_LAW(CONFIG_SYS_PCIE2_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_2),

PCIe LAWs are now set by common code, you can remove these.

- k

#4 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

Quoted 10 lines · Kumar Gala

board/freescale/p1021mds/law.c line 32

Quoted 7 lines
board/freescale/p1021mds/law.c new file +7 -0
+
+struct law_entry law_table[] = {
+#ifndef CONFIG_IN_TPL
+	SET_LAW(CONFIG_SYS_PCIE1_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_1),
+	SET_LAW(CONFIG_SYS_PCIE1_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_1),
+	SET_LAW(CONFIG_SYS_PCIE2_MEM_PHYS, LAW_SIZE_512M, LAW_TRGT_IF_PCIE_2),
+	SET_LAW(CONFIG_SYS_PCIE2_IO_PHYS, LAW_SIZE_64K, LAW_TRGT_IF_PCIE_2),

PCIe LAWs are now set by common code, you can remove these.

Fixed it in v4 patch, thanks.

Haiying

#5 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

In reply to Haiying.Wang at freescale.com
Quoted 16 lines · On Thu, Jan 27, 2011 at 10:58 PM, <[email protected]> wrote:
(quoted diff) +16 -0
+/* These are used when DDR doesn't use SPD. ?*/
+#define CONFIG_SYS_SDRAM_SIZE ? ? ? ? ? 512 ? ? ? ? ? ?/* DDR is 512MB */
+#define CONFIG_SYS_DDR_CS0_BNDS ? ? ? ? 0x0000001F
+#define CONFIG_SYS_DDR_CS0_CONFIG ? ? ? 0x80014202
+#define CONFIG_SYS_DDR_CS0_CONFIG_2 ? ?0x00000000
+#define CONFIG_SYS_DDR_SDRAM_CFG ? ? ? 0x47000000
+#define CONFIG_SYS_DDR_SDRAM_CFG_2 ? ? 0x04401040
+#define CONFIG_SYS_DDR_ZQ_CNTL ? ? ? ? 0x89080600
+#define CONFIG_SYS_DDR_WRLVL_CNTL ? ? ?0x86559608
+#define CONFIG_SYS_DDR_CDR_1 ? ? ? ? ? 0x000eaa00
+#define CONFIG_SYS_DDR_CDR_2 ? ? ? ? ? 0x00000000
+#define CONFIG_SYS_DDR_OCD_CTRL ? ? ? ? 0x00000000
+#define CONFIG_SYS_DDR_OCD_STATUS ? ? ? 0x00000000
+#define CONFIG_SYS_DDR_CONTROL ? ? ? ? ?0x470c0000 ? ? ?/* Type = DDR3 */
+#define CONFIG_SYS_DDR_CONTROL_2 ? ? ? 0x04401050
+#define CONFIG_SYS_DDR_DATA_INIT ? ? ? ?0x1021babe

Review

Quoted 10 lines
(quoted diff) +10 -0
+#define CONFIG_SYS_DDR_TIMING_3 ? ? ? ? ? ? ? ?0x00010000
+#define CONFIG_SYS_DDR_TIMING_0 ? ? ? ? ? ? ? ?0x00330004
+#define CONFIG_SYS_DDR_TIMING_1 ? ? ? ? ? ? ? ?0x5d5bd746
+#define CONFIG_SYS_DDR_TIMING_2 ? ? ? ? ? ? ? ?0x0fa8c8cd
+#define CONFIG_SYS_DDR_SDRAM_MODE ? ? ?0x40461320
+#define CONFIG_SYS_DDR_SDRAM_MODE_2 ? ?0x8000C000
+#define CONFIG_SYS_DDR_SDRAM_INTERVAL ?0x0a280000
+#define CONFIG_SYS_DDR_SDRAM_CLK_CNTL ?0x03000000
+#define CONFIG_SYS_DDR_TIMING_4 ? ? ? ? ? ? ? ?0x00220001
+#define CONFIG_SYS_DDR_TIMING_5 ? ? ? ? ? ? ? ?0x03402400

Aren't static DDR configurations now handled in a board-specific source file? Look at board/freescale/corenet_ds/p4080ds_ddr.c

include/configs/P1021MDS.h line 426

Quoted 4 lines
include/configs/P1021MDS.h new file +4 -0
+#define CONFIG_ID_EEPROM
+#ifdef CONFIG_ID_EEPROM
+#define CONFIG_SYS_I2C_EEPROM_NXID
+#endif

No need for the #ifdef here. CONFIG_SYS_I2C_EEPROM_NXID is not used in any Makefile.

Quoted 1 line

+#define CONFIG_SYS_I2C_EEPROM_ADDR ? ? ?0x52

Not 0x57? That's where the NXID EEPROM almost always is.

nand_spl/board/freescale/p1021mds/nand_boot.c line 69

Quoted 13 lines
nand_spl/board/freescale/p1021mds/nand_boot.c new file +13 -0
+void putc(char c)
+{
+ ? ? ? if (c == '\n')
+ ? ? ? ? ? ? ? NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r');
+
+ ? ? ? NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c);
+}
+
+void puts(const char *str)
+{
+ ? ? ? while (*str)
+ ? ? ? ? ? ? ? putc(*str++);
+}

These look like functions that shouldn't be in board-specific code.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#6 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

Quoted 7 lines · On Fri, 28 Jan 2011 13:06:28 -0600 Timur Tabi <[email protected]> wrote:
Quoted 7 lines
nand_spl/board/freescale/p1021mds/nand_boot.c new file +7 -0
+void putc(char c)
+{
+ ? ? ? if (c == '\n')
+ ? ? ? ? ? ? ? NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r');
+
+ ? ? ? NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c);
+}
Quoted 8 lines

nand_spl/board/freescale/p1021mds/nand_boot.c line 69

Quoted 6 lines
nand_spl/board/freescale/p1021mds/nand_boot.c new file +6 -0
+
+void puts(const char *str)
+{
+ ? ? ? while (*str)
+ ? ? ? ? ? ? ? putc(*str++);
+}

These look like functions that shouldn't be in board-specific code.

That's been established practice in the SPL board files so far, though I suppose it could be factored out to its own file.

-Scott

#7 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

In reply to Timur Tabi
Quoted 23 lines · Timur Tabi
Quoted 21 lines · On Thu, Jan 27, 2011 at 10:58 PM, <[email protected]> wrote:
include/configs/P1021MDS.h new file +21 -0
+/* These are used when DDR doesn't use SPD.  */
+#define CONFIG_SYS_SDRAM_SIZE           512            /* DDR is 512MB */
+#define CONFIG_SYS_DDR_CS0_BNDS         0x0000001F
+#define CONFIG_SYS_DDR_CS0_CONFIG       0x80014202
+#define CONFIG_SYS_DDR_CS0_CONFIG_2    0x00000000
+#define CONFIG_SYS_DDR_SDRAM_CFG       0x47000000
+#define CONFIG_SYS_DDR_SDRAM_CFG_2     0x04401040
+#define CONFIG_SYS_DDR_ZQ_CNTL         0x89080600
+#define CONFIG_SYS_DDR_WRLVL_CNTL      0x86559608
+#define CONFIG_SYS_DDR_CDR_1           0x000eaa00
+#define CONFIG_SYS_DDR_CDR_2           0x00000000
+#define CONFIG_SYS_DDR_OCD_CTRL         0x00000000
+#define CONFIG_SYS_DDR_OCD_STATUS       0x00000000
+#define CONFIG_SYS_DDR_CONTROL          0x470c0000      /* Type = DDR3 */
+#define CONFIG_SYS_DDR_CONTROL_2       0x04401050
+#define CONFIG_SYS_DDR_DATA_INIT        0x1021babe
+#define CONFIG_SYS_DDR_TIMING_3                0x00010000
+#define CONFIG_SYS_DDR_TIMING_0                0x00330004
+#define CONFIG_SYS_DDR_TIMING_1                0x5d5bd746
+#define CONFIG_SYS_DDR_TIMING_2                0x0fa8c8cd
+#define CONFIG_SYS_DDR_SDRAM_MODE      0x40461320
Quoted 8 lines

include/configs/P1021MDS.h line 146

Quoted 5 lines
include/configs/P1021MDS.h new file +5 -0
+#define CONFIG_SYS_DDR_SDRAM_MODE_2    0x8000C000
+#define CONFIG_SYS_DDR_SDRAM_INTERVAL  0x0a280000
+#define CONFIG_SYS_DDR_SDRAM_CLK_CNTL  0x03000000
+#define CONFIG_SYS_DDR_TIMING_4                0x00220001
+#define CONFIG_SYS_DDR_TIMING_5                0x03402400

Aren't static DDR configurations now handled in a board-specific source file? Look at board/freescale/corenet_ds/p4080ds_ddr.c

yes, static ddr configurations are handled in board c file, but it doesn't matter to define those MACROs in header file. But anyway, I've remove static ddr setting from board file as Scott suggested, so I should remove above setting in header file.

Quoted 8 lines

include/configs/P1021MDS.h line 426

Quoted 5 lines
include/configs/P1021MDS.h new file +4 -0
+#define CONFIG_ID_EEPROM
+#ifdef CONFIG_ID_EEPROM
+#define CONFIG_SYS_I2C_EEPROM_NXID
+#endif

No need for the #ifdef here. CONFIG_SYS_I2C_EEPROM_NXID is not used in any Makefile.

OK.

Quoted 4 lines
Quoted 2 lines

+#define CONFIG_SYS_I2C_EEPROM_ADDR 0x52

Not 0x57? That's where the NXID EEPROM almost always is.

It is board specific value, isn't it? P1021MDS does use 0x52 for board eeprom.

Quoted 7 lines
Quoted 7 lines
nand_spl/board/freescale/p1021mds/nand_boot.c new file +7 -0
+void putc(char c)
+{
+       if (c == '\n')
+               NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, '\r');
+
+       NS16550_putc((NS16550_t)CONFIG_SYS_NS16550_COM1, c);
+}
Quoted 9 lines

nand_spl/board/freescale/p1021mds/nand_boot.c line 69

Quoted 6 lines
nand_spl/board/freescale/p1021mds/nand_boot.c new file +6 -0
+
+void puts(const char *str)
+{
+       while (*str)
+               putc(*str++);
+}

These look like functions that shouldn't be in board-specific code.

Scott replied you. I also think with partial linking, this can be factored out.

Haiying

#8 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

Quoted 4 lines · Haiying Wang
Quoted 3 lines
Quoted 3 lines

+#define CONFIG_SYS_I2C_EEPROM_ADDR 0x52

Not 0x57? That's where the NXID EEPROM almost always is.

It is board specific value, isn't it? P1021MDS does use 0x52 for board eeprom.

I just wanted you to be sure it wasn't a typo. Did you actual test reading and writing to the EEPROM with the 'mac' command?

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#9 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

Quoted 8 lines · Timur Tabi
Quoted 4 lines · Haiying Wang
Quoted 3 lines
Quoted 3 lines

+#define CONFIG_SYS_I2C_EEPROM_ADDR 0x52

Not 0x57? That's where the NXID EEPROM almost always is.

It is board specific value, isn't it? P1021MDS does use 0x52 for board eeprom.

I just wanted you to be sure it wasn't a typo. Did you actual test reading and writing to the EEPROM with the 'mac' command?

Yes, I did test and have used it for almost one year. :)

Haiying

#10 lore raw

PATCH v3 8/8 p1021mds: add QE and UEC support

In reply to Haiying.Wang at freescale.com

From: Haiying Wang <[email protected]>

P1021 has some QE pins which need to be set in pmuxcr register before using QE functions. In this patch, pin QE0 and QE3 are set for UCC1 and UCC5 in Eth mode. QE9 and QE12 are set for MII management. QE12 needs to be released after MII access because QE12 pin is muxed with LBCTL signal.

P1021MDS has to load the microcode from NAND flash, this patch defines misc_init_r() for loading ucode and initializing qe.

---
v3: make changes in p1021mds.c and P1021MDS.h according to the changes in patch 5/8, update the copyright years.

 arch/powerpc/cpu/mpc85xx/speed.c      |    4 ++
 arch/powerpc/include/asm/immap_85xx.h |   13 +++++
 board/freescale/p1021mds/p1021mds.c   |   83 +++++++++++++++++++++++++++++++++
 drivers/qe/uec.c                      |   40 +++++++++++++++-
 include/configs/P1021MDS.h            |   47 ++++++++++++++++++
 5 files changed, 186 insertions(+), 1 deletions(-)
arch/powerpc/cpu/mpc85xx/speed.c +4 -0
index f2aa8d0..ae94ee8 100644
@@ -165,10 +165,14 @@ void get_sys_info (sys_info_t * sysInfo)
 #endif
 
 #ifdef CONFIG_QE
+#ifdef CONFIG_P1021
+	sysInfo->freqQE =  sysInfo->freqSystemBus;
+#else
 	qe_ratio = ((gur->porpllsr) & MPC85xx_PORPLLSR_QE_RATIO)
 			>> MPC85xx_PORPLLSR_QE_RATIO_SHIFT;
 	sysInfo->freqQE = qe_ratio * CONFIG_SYS_CLK_FREQ;
 #endif
+#endif
 
 #if defined(CONFIG_FSL_LBC)
 #if defined(CONFIG_SYS_LBC_LCRR)
arch/powerpc/include/asm/immap_85xx.h +13 -0
index 77e3629..9b7de6b 100644
@@ -1909,6 +1909,19 @@ typedef struct ccsr_gur {
 #define MPC85xx_PMUXCR_SD_DATA		0x80000000
 #define MPC85xx_PMUXCR_SDHC_CD		0x40000000
 #define MPC85xx_PMUXCR_SDHC_WP		0x20000000
+#define MPC85xx_PMUXCR_QE0             0x00008000
+#define MPC85xx_PMUXCR_QE1             0x00004000
+#define MPC85xx_PMUXCR_QE2             0x00002000
+#define MPC85xx_PMUXCR_QE3             0x00001000
+#define MPC85xx_PMUXCR_QE4             0x00000800
+#define MPC85xx_PMUXCR_QE5             0x00000400
+#define MPC85xx_PMUXCR_QE6             0x00000200
+#define MPC85xx_PMUXCR_QE7             0x00000100
+#define MPC85xx_PMUXCR_QE8             0x00000080
+#define MPC85xx_PMUXCR_QE9             0x00000040
+#define MPC85xx_PMUXCR_QE10            0x00000020
+#define MPC85xx_PMUXCR_QE11            0x00000010
+#define MPC85xx_PMUXCR_QE12            0x00000008
 	u32	pmuxcr2;	/* Alt. function signal multiplex control 2 */
 	u8	res6[8];
 	u32	devdisr;	/* Device disable control */
board/freescale/p1021mds/p1021mds.c +83 -0

104 lines not on this page · raw message

drivers/qe/uec.c +39 -1
index 282ab23..04d7987 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2010 Freescale Semiconductor, Inc.
+ * Copyright (C) 2006-2011 Freescale Semiconductor, Inc.
  *
  * Dave Liu <[email protected]>
  *
@@ -30,6 +30,9 @@
 #include "uec.h"
 #include "uec_phy.h"
 #include "miiphy.h"
+#ifdef CONFIG_P1021
+#define BCSR11_ENET_MICRST	0x20
+#endif
 
 /* Default UTBIPAR SMI address */
 #ifndef CONFIG_UTBIPAR_INIT_TBIPA
@@ -588,9 +591,25 @@ static void phy_change(struct eth_device *dev)
 {
 	uec_private_t	*uec = (uec_private_t *)dev->priv;
 
+#ifdef CONFIG_P1021
+	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+
+	/* QE9 and QE12 need to be set for enabling QE MII managment signals */
+	setbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_QE9);
+	setbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_QE12);
+#endif
+
 	/* Update the link, speed, duplex */
 	uec->mii_info->phyinfo->read_status(uec->mii_info);
 
+#ifdef CONFIG_P1021
+	/*
+	 * QE12 is muxed with LBCTL, it needs to be released for enabling
+	 * LBCTL signal for LBC usage.
+	 */
+	clrbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_QE12);
+#endif
+
 	/* Adjust the interface according to speed */
 	adjust_link(dev);
 }
@@ -1198,10 +1217,24 @@ static int uec_init(struct eth_device* dev, bd_t *bd)
 	uec_private_t		*uec;
 	int			err, i;
 	struct phy_info         *curphy;
+#ifdef CONFIG_P1021
+	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+#endif
 
 	uec = (uec_private_t *)dev->priv;
 
 	if (uec->the_first_run == 0) {
+#ifdef CONFIG_P1021
+	/* reset micrel phy for each UEC */
+	clrbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 11), BCSR11_ENET_MICRST);
+	udelay(200);
+	setbits_8((u8 *)(CONFIG_SYS_BCSR_BASE + 11), BCSR11_ENET_MICRST);
+
+	/* QE9 and QE12 need to be set for enabling QE MII managment signals */
+	setbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_QE9);
+	setbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_QE12);
+#endif
+
 		err = init_phy(dev);
 		if (err) {
 			printf("%s: Cannot initialize PHY, aborting.\n",
@@ -1228,6 +1261,11 @@ static int uec_init(struct eth_device* dev, bd_t *bd)
 			udelay(100000);
 		} while (1);
 
+#ifdef CONFIG_P1021
+		/* QE12 needs to be released for enabling LBCTL signal*/
+		clrbits_be32(&gur->pmuxcr, MPC85xx_PMUXCR_QE12);
+#endif
+
 		if (err || i <= 0)
 			printf("warning: %s: timeout on PHY link\n", dev->name);
 
include/configs/P1021MDS.h +47 -0

65 lines not on this page · raw message

Signature · 1 line
1.7.3.1.50.g1e633
#11 lore raw

PATCH 7/7 add gc-sections to TPL boot

In reply to Haiying.Wang at freescale.com

From: Haiying Wang <[email protected]>

---
 arch/powerpc/config.mk |    4 ++++
 config.mk              |    7 ++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)
arch/powerpc/config.mk +4 -0
index 64191c7..78e53c4 100644
@@ -27,7 +27,11 @@ STANDALONE_LOAD_ADDR = 0x40000
 LDFLAGS_u-boot = --gc-sections
 PLATFORM_RELFLAGS += -mrelocatable -ffunction-sections -fdata-sections
 PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__
+ifdef CONFIG_HAS_TPL
+PLATFORM_LDFLAGS  += -n --gc-sections
+else
 PLATFORM_LDFLAGS  += -n
+endif
 
 ifdef CONFIG_SYS_LDSCRIPT
 # need to strip off double quotes
config.mk +6 -1
index 5147c35..d7bb07f 100644
@@ -260,8 +260,13 @@ $(obj)%.s:	%.c
 #########################################################################
 
 # If the list of objects to link is empty, just create an empty built-in.o
+ifdef CONFIG_HAS_TPL
+cmd_link_o_target = $(if $(strip $1),\
+		      $(LD) -r -o $@ $1,\
+		      rm -f $@; $(AR) rcs $@ )
+else
 cmd_link_o_target = $(if $(strip $1),\
 		      $(LD) $(LDFLAGS) -r -o $@ $1,\
 		      rm -f $@; $(AR) rcs $@ )
-
+endif
 #########################################################################
Signature · 1 line
1.7.3.1.50.g1e633
#12 lore raw

PATCH 7/7 add gc-sections to TPL boot

Quoted 7 lines · On Thu, 27 Jan 2011 23:58:10 -0500 <[email protected]> wrote:

From: Haiying Wang <[email protected]>

---
 arch/powerpc/config.mk |    4 ++++
 config.mk              |    7 ++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

I see patch 3/8, 4/8, 5/8, and 7/7. Where are the rest?

Quoted 8 lines
config.mk +0 -0
index 5147c35..d7bb07f 100644
@@ -260,8 +260,13 @@ $(obj)%.s:	%.c
 #########################################################################
 
 # If the list of objects to link is empty, just create an empty built-in.o

config.mk $(obj)%.s: %.c · line 271

Quoted 10 lines
config.mk +6 -1
+ifdef CONFIG_HAS_TPL
+cmd_link_o_target = $(if $(strip $1),\
+		      $(LD) -r -o $@ $1,\
+		      rm -f $@; $(AR) rcs $@ )
+else
 cmd_link_o_target = $(if $(strip $1),\
 		      $(LD) $(LDFLAGS) -r -o $@ $1,\
 		      rm -f $@; $(AR) rcs $@ )
-
+endif

What's going on here?

-Scott

#13 lore raw

PATCH 7/7 add gc-sections to TPL boot

Quoted 5 lines · Scott Wood
Quoted 2 lines · On Thu, 27 Jan 2011 23:58:10 -0500 <[email protected]> wrote:

From: Haiying Wang <[email protected]>

Quoted 7 lines
Quoted 5 lines
---
 arch/powerpc/config.mk |    4 ++++
 config.mk              |    7 ++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

I see patch 3/8, 4/8, 5/8, and 7/7. Where are the rest?

Sorry, patch 7/7 is a wrong number here. I kept the patch # as 3/8/, 4/8, 5/8, 8/8 to be consistent with the order in the patchset(v2) I submitted in last December. I thought it would be clearer to compare them with v2 version and review. Patch 1/8,2/8 have been applied by Kumar, patch 6/8, 7/8 remain the same as v2 version. This patch, is a new patch because that TPL still needs --gc-sections in linker option to do partial link.

If it is preferable to have new whole set of patch, I can reorder them from 3/8-8/8 plus this one to submit.

Quoted 7 lines
Quoted 7 lines
config.mk +0 -0
index 5147c35..d7bb07f 100644
@@ -260,8 +260,13 @@ $(obj)%.s:	%.c
 #########################################################################
 
Quoted 14 lines

config.mk $(obj)%.s: %.c · line 271

Quoted 11 lines
config.mk +6 -1
 # If the list of objects to link is empty, just create an empty built-in.o
+ifdef CONFIG_HAS_TPL
+cmd_link_o_target = $(if $(strip $1),\
+		      $(LD) -r -o $@ $1,\
+		      rm -f $@; $(AR) rcs $@ )
+else
 cmd_link_o_target = $(if $(strip $1),\
 		      $(LD) $(LDFLAGS) -r -o $@ $1,\
 		      rm -f $@; $(AR) rcs $@ )
-
+endif

What's going on here?

For CONFIG_HAS_TPL, LDFLAGS has --gc-sections now, passing it to cmd_link_o_target here will fail in linking stage:
"
powerpc-none-linux-gnuspe-ld: gc-sections requires either an entry or an undefined symbol
"

Haiying

#14 lore raw

PATCH 7/7 add gc-sections to TPL boot

Le 28/01/2011 19:08, Haiying Wang a ?crit :

Quoted 11 lines
Quoted 1 line

I see patch 3/8, 4/8, 5/8, and 7/7. Where are the rest?

Sorry, patch 7/7 is a wrong number here. I kept the patch # as 3/8/, 4/8, 5/8, 8/8 to be consistent with the order in the patchset(v2) I submitted in last December. I thought it would be clearer to compare them with v2 version and review. Patch 1/8,2/8 have been applied by Kumar, patch 6/8, 7/8 remain the same as v2 version. This patch, is a new patch because that TPL still needs --gc-sections in linker option to do partial link.

If it is preferable to have new whole set of patch, I can reorder them from 3/8-8/8 plus this one to submit.

I would suggest to simply number patches from 1 to N for each version even if that means the same patch gets numbered differently across versions, because readers of a given version may not have read the previous one. A patchset should be self-sufficient and self-consistent IMO.

Amicalement,

Signature · 1 line
Albert.
#15 lore raw

PATCH 7/7 add gc-sections to TPL boot

In reply to Haiying Wang
Quoted 21 lines · On Fri, 28 Jan 2011 13:08:30 -0500 Haiying Wang <[email protected]>…
Quoted 5 lines · Scott Wood
Quoted 2 lines · On Thu, 27 Jan 2011 23:58:10 -0500 <[email protected]> wrote:

From: Haiying Wang <[email protected]>

Quoted 7 lines
Quoted 5 lines
---
 arch/powerpc/config.mk |    4 ++++
 config.mk              |    7 ++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

I see patch 3/8, 4/8, 5/8, and 7/7. Where are the rest?

Sorry, patch 7/7 is a wrong number here. I kept the patch # as 3/8/, 4/8, 5/8, 8/8 to be consistent with the order in the patchset(v2) I submitted in last December. I thought it would be clearer to compare them with v2 version and review. Patch 1/8,2/8 have been applied by Kumar, patch 6/8, 7/8 remain the same as v2 version. This patch, is a new patch because that TPL still needs --gc-sections in linker option to do partial link.

Quoted 2 lines

If it is preferable to have new whole set of patch, I can reorder them from 3/8-8/8 plus this one to submit.

Just produce a new complete patchset of what still needs to be applied. Don't preserve the numbering.

Quoted 21 lines
Quoted 7 lines
Quoted 7 lines
config.mk +0 -0
index 5147c35..d7bb07f 100644
@@ -260,8 +260,13 @@ $(obj)%.s:	%.c
 #########################################################################
 
Quoted 14 lines

config.mk $(obj)%.s: %.c · line 271

Quoted 11 lines
config.mk +6 -1
 # If the list of objects to link is empty, just create an empty built-in.o
+ifdef CONFIG_HAS_TPL
+cmd_link_o_target = $(if $(strip $1),\
+		      $(LD) -r -o $@ $1,\
+		      rm -f $@; $(AR) rcs $@ )
+else
 cmd_link_o_target = $(if $(strip $1),\
 		      $(LD) $(LDFLAGS) -r -o $@ $1,\
 		      rm -f $@; $(AR) rcs $@ )
-
+endif

What's going on here?

Quoted 6 lines

For CONFIG_HAS_TPL, LDFLAGS has --gc-sections now, passing it to cmd_link_o_target here will fail in linking stage:
"
powerpc-none-linux-gnuspe-ld: gc-sections requires either an entry or an undefined symbol
"

I think --gc-sections should go in LDFLAGS_u-boot instead.

In any case, I don't think we want different behavior here based on whether we have TPL. Either LDFLAGS is used in partial linking, or it's not.

-Scott

#16 lore raw

PATCH 7/7 add gc-sections to TPL boot

Quoted 21 lines · Scott Wood
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines
config.mk +0 -0
index 5147c35..d7bb07f 100644
@@ -260,8 +260,13 @@ $(obj)%.s:	%.c
 #########################################################################
 
 # If the list of objects to link is empty, just create an empty built-in.o

config.mk $(obj)%.s: %.c · line 271

Quoted 10 lines
config.mk +6 -1
+ifdef CONFIG_HAS_TPL
+cmd_link_o_target = $(if $(strip $1),\
+		      $(LD) -r -o $@ $1,\
+		      rm -f $@; $(AR) rcs $@ )
+else
 cmd_link_o_target = $(if $(strip $1),\
 		      $(LD) $(LDFLAGS) -r -o $@ $1,\
 		      rm -f $@; $(AR) rcs $@ )
-
+endif

What's going on here?

Quoted 8 lines
Quoted 6 lines

For CONFIG_HAS_TPL, LDFLAGS has --gc-sections now, passing it to cmd_link_o_target here will fail in linking stage:
"
powerpc-none-linux-gnuspe-ld: gc-sections requires either an entry or an undefined symbol
"

I think --gc-sections should go in LDFLAGS_u-boot instead.

LDFLAGS_u-boot has --gc-sections already, I did not change it. I only add --gc-sections to PLATFORM_LDFLAGS in arch/powerpc/config.mk under "ifdef CONFIG_HAS_TPL"

Quoted 3 lines

In any case, I don't think we want different behavior here based on whether we have TPL. Either LDFLAGS is used in partial linking, or it's not.

I don't understand why LDFLAGS was added here in patch
http://lists.denx.de/pipermail/u-boot/2011-January/084705.html

It says "LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target)." But without this changing, the partial linking worked well before. Please correct me if I am wrong.

So if someone can confirm LDFLAGS is not necessary to be added in cmd_link_o_target, I prefer not add it here.

Thanks.

Haiying

#17 lore raw

PATCH 7/7 add gc-sections to TPL boot

Quoted 3 lines · On Fri, 28 Jan 2011 13:46:06 -0500 Haiying Wang <[email protected]>…
Quoted 1 line · Scott Wood

I think --gc-sections should go in LDFLAGS_u-boot instead.

LDFLAGS_u-boot has --gc-sections already, I did not change it.

It looks like LDFLAGS_u-boot may not be suitable for building SPL/TPL images. Since TPL is new, and we don't have to worry about breaking any existing boards, just unconditionally use --gc-sections when linking the final TPL image. Or, if we want a way for boards/cpus to add ld options that things like TPL use, introduce LDFLAGS_FINAL that holds ld parameters used for final link of any image, with LDFLAGS_u-boot holding things like text addresses and linker scripts with values that only apply to the main image.

I'd prefer the latter approach, as we could make use of it in SPL as well, which does have existing boards to worry about.

Quoted 6 lines
Quoted 3 lines

In any case, I don't think we want different behavior here based on whether we have TPL. Either LDFLAGS is used in partial linking, or it's not.

I don't understand why LDFLAGS was added here in patch
http://lists.denx.de/pipermail/u-boot/2011-January/084705.html

Quoted 6 lines

It says "LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target)." But without this changing, the partial linking worked well before. Please correct me if I am wrong.

So if someone can confirm LDFLAGS is not necessary to be added in cmd_link_o_target, I prefer not add it here.

Whether leaving out -n during partial link worked for you or not, LDFLAGS is supposed to be used by partial links (that distinction is why LDFLAGS_u-boot was created). So don't put things in LDFPLAGS that break partial links.

-Scott

#18 lore raw

PATCH 7/7 add gc-sections to TPL boot

In reply to Haiying Wang
Quoted 6 lines · Haiying Wang
Quoted 3 lines

In any case, I don't think we want different behavior here based on whether we have TPL. Either LDFLAGS is used in partial linking, or it's not.

I don't understand why LDFLAGS was added here in patch
http://lists.denx.de/pipermail/u-boot/2011-January/084705.html

Quoted 6 lines

It says "LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target)." But without this changing, the partial linking worked well before. Please correct me if I am wrong.

So if someone can confirm LDFLAGS is not necessary to be added in cmd_link_o_target, I prefer not add it here.

BTW, I doubt removing --gc-sections for PLATFORM_FLAGS by patch
http://lists.denx.de/pipermail/u-boot/2011-January/084705.html may have the risk of building failure for nand_spl, as we encountered the message "NAND bootstrap too big" before

For example, the size for MPC8572DS_NAND_config before applying patch:

text data bss dec hex filename
3320 520 0 3840 f00 nand_spl/u-boot-spl

After applying that patch:
text data bss dec hex filename
3476 520 0 3996 f9c nand_spl/u-boot-spl

Once 8572 support is getting bigger as that in BSP, the error message will be triggered.

Haiying

#19 lore raw

PATCH 7/7 add gc-sections to TPL boot

Quoted 11 lines · On Fri, 28 Jan 2011 14:07:09 -0500 Haiying Wang <[email protected]>…
Quoted 10 lines · Haiying Wang
Quoted 3 lines

In any case, I don't think we want different behavior here based on whether we have TPL. Either LDFLAGS is used in partial linking, or it's not.

I don't understand why LDFLAGS was added here in patch
http://lists.denx.de/pipermail/u-boot/2011-January/084705.html

It says "LDFLAGS sets necessary option by partial linking (use in cmd_link_o_target)." But without this changing, the partial linking worked well before. Please correct me if I am wrong.

Quoted 7 lines
Quoted 2 lines

So if someone can confirm LDFLAGS is not necessary to be added in cmd_link_o_target, I prefer not add it here.

BTW, I doubt removing --gc-sections for PLATFORM_FLAGS by patch
http://lists.denx.de/pipermail/u-boot/2011-January/084705.html may have the risk of building failure for nand_spl, as we encountered the message "NAND bootstrap too big" before

Yes, I saw that as well -- we need gc-sections. It just can't go in LDFLAGS.

-Scott

A message that is not in the archive (sent off-list or not yet received): [email protected] om

#21 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

Quoted 12 lines · Haiying.Wang at freescale.com

From: Haiying Wang <[email protected]>

Support P1021MDS board to boot from NAND flash (No NOR flash on this board). And because P1021 only has 256K L2 SRAM, which can not used for final uboot image, this patch also enables the TPL BOOT on P1021MDS so that DDR can be initialized in L2 SRAM through SPD code. So there are three stage uboot images:
* nand_spl, pad from 4KB size to 16KB, load tpl_boot from offset 16KB in NAND.
* tpl_boot, 112KB size. The env variables are copied to offset 128KB in L2 SRAM, so that ddr spd code can get the interleaving mode setting in env. It loads final uboot image from offset 128KB in NAND.
* final uboot image, size is variable depends on the functions enabled.

I'm not questioning the patch, I'm just trying to understand.

Review

Quoted 3 lines
(quoted diff) +3 -0
+#define CONFIG_MP                      /* Multiprocessor support */
+
+#define CONFIG_PCI                     /* Disable PCI/PCIE */

Shouldn't that be "Enable" PCI?

bye Fabi

#22 lore raw

PATCH v3 5/8 P1021: add P1021MDS board support

Quoted 8 lines · Fabian Cenedese

I'm not questioning the patch, I'm just trying to understand.

Review

Quoted 3 lines
(quoted diff) +3 -0
+#define CONFIG_MP                      /* Multiprocessor support */
+
+#define CONFIG_PCI                     /* Disable PCI/PCIE */

Shouldn't that be "Enable" PCI?

Yes, you are right. Thanks for pointing out.

Haiying