Skip to contentSkip to conversation

powerpc/85xx: add TPL_BOOT support

PATCH New Haiying.Wang at freescale.com 3 participants 5 messages Dec 1, 2010 – Jan 24, 2011 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/8 powerpc/85xx: add TPL_BOOT support

From: Haiying Wang <[email protected]>

---
Splitted from TPL patch to only address 85xx changes

 arch/powerpc/cpu/mpc85xx/cpu_init_nand.c |   34 ++++++++++-
 arch/powerpc/cpu/mpc85xx/start.S         |   12 ++--
 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds  |   99 ++++++++++++++++++++++++++++++
 3 files changed, 137 insertions(+), 8 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds
arch/powerpc/cpu/mpc85xx/cpu_init_nand.c +32 -2
index 8fb27ab..decedca 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Freescale Semiconductor, Inc.
+ * Copyright 2010 Freescale Semiconductor, Inc.
  *
  * See file CREDITS for list of people who contributed to this
  * project.
@@ -40,7 +40,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_TPL_BOOT)
 	ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
 	char *l2srbar;
 	int i;
@@ -60,4 +61,33 @@ void cpu_init_f(void)
 	for (i = 0; i < CONFIG_SYS_L2_SIZE; i++)
 		l2srbar[i] = 0;
 #endif
+#ifdef CONFIG_TPL_BOOT
+	init_used_tlb_cams();
+#endif
+}
+
+#ifdef CONFIG_TPL_BOOT
+/*
+ * 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;
+}
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/*
+ * Get timebase clock frequency
+ */
+unsigned long get_tbclk(void)
+{
+#ifdef CONFIG_FSL_CORENET
+	return (gd->bus_clk + 8) / 16;
+#else
+	return (gd->bus_clk + 4UL)/8UL;
+#endif
 }
+#endif /* CONFIG_TPL_BOOT */
arch/powerpc/cpu/mpc85xx/start.S +6 -6
index 945c1b8..12b0ebb 100644
@@ -58,12 +58,12 @@
 	GOT_ENTRY(_GOT2_TABLE_)
 	GOT_ENTRY(_FIXUP_TABLE_)
 
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_TPL_BOOT)
 	GOT_ENTRY(_start)
 	GOT_ENTRY(_start_of_vectors)
 	GOT_ENTRY(_end_of_vectors)
 	GOT_ENTRY(transfer_to_handler)
-#endif
+#endif /* !CONFIG_TPL_BOOT || !CONFIG_NAND_SPL*/
 
 	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_TPL_BOOT)
 	. = 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_TPL_BOOT */
 
 /*------------------------------------------------------------------------------*/
 
@@ -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_TPL_BOOT)
 	/*
 	 * 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_TPL_BOOT */
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
#1 lore raw

PATCH v2 4/8 powerpc/85xx: add TPL_BOOT support

Quoted 10 lines · On Dec 1, 2010, at 9:47 AM, <[email protected]>…

From: Haiying Wang <[email protected]>

---
Splitted from TPL patch to only address 85xx changes

arch/powerpc/cpu/mpc85xx/cpu_init_nand.c |   34 ++++++++++-
arch/powerpc/cpu/mpc85xx/start.S         |   12 ++--
arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds  |   99 ++++++++++++++++++++++++++++++
3 files changed, 137 insertions(+), 8 deletions(-)

create mode 100644 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds

Did you plan on review this patch?

- k

#2 lore raw

PATCH v2 4/8 powerpc/85xx: add TPL_BOOT support

In reply to Haiying.Wang at freescale.com

Dear Haiying.Wang at freescale.com,

Quoted 10 lines · In message <[email protected]> you…

From: Haiying Wang <[email protected]>

---
Splitted from TPL patch to only address 85xx changes

 arch/powerpc/cpu/mpc85xx/cpu_init_nand.c |   34 ++++++++++-
 arch/powerpc/cpu/mpc85xx/start.S         |   12 ++--
 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds  |   99 ++++++++++++++++++++++++++++++
 3 files changed, 137 insertions(+), 8 deletions(-)
 create mode 100644 arch/powerpc/cpu/mpc85xx/u-boot-tpl.lds

...

Quoted 2 lines

- * Copyright 2009 Freescale Semiconductor, Inc.
+ * Copyright 2010 Freescale Semiconductor, Inc.

You should not undo a previous copyright. I guess you mean:

Copyright 2009-2010 Freescale Semiconductor, Inc.

?

Quoted 1 line

+DECLARE_GLOBAL_DATA_PTR;

Please move this up to top of file.

arch/powerpc/cpu/mpc85xx/cpu_init_nand.c void cpu_init_f(void) · line 91

Quoted 7 lines
arch/powerpc/cpu/mpc85xx/cpu_init_nand.c +7 -0
+unsigned long get_tbclk(void)
+{
+#ifdef CONFIG_FSL_CORENET
+	return (gd->bus_clk + 8) / 16;
+#else
+	return (gd->bus_clk + 4UL)/8UL;
+#endif

This looks inconsistent. Either this should be "... +8UL) / 16UL" or "... + 4) / 8;"

arch/powerpc/cpu/mpc85xx/start.S line 66

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/start.S +2 -2
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_TPL_BOOT)
 	GOT_ENTRY(_start)
 	GOT_ENTRY(_start_of_vectors)
 	GOT_ENTRY(_end_of_vectors)
 	GOT_ENTRY(transfer_to_handler)
-#endif
+#endif /* !CONFIG_TPL_BOOT || !CONFIG_NAND_SPL*/

Should that be

   #endif /* !CONFIG_TPL_BOOT && !CONFIG_NAND_SPL*/

instead?

And can we please make this consistent, i. e. as you do in the following:

Quoted 1 line

+#endif /* !CONFIG_NAND_SPL && !CONFIG_TPL_BOOT */

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The price of curiosity is a terminal experience.
                         - Terry Pratchett, _The Dark Side of the Sun_
#3 lore raw

PATCH v2 4/8 powerpc/85xx: add TPL_BOOT support

Quoted 5 lines · Wolfgang Denk

You should not undo a previous copyright. I guess you mean:

Copyright 2009-2010 Freescale Semiconductor, Inc.

?

Yes. Sorry about it.

Quoted 3 lines
Quoted 1 line

+DECLARE_GLOBAL_DATA_PTR;

Please move this up to top of file.

OK.

Quoted 10 lines

arch/powerpc/cpu/mpc85xx/cpu_init_nand.c void cpu_init_f(void) · line 91

Quoted 7 lines
arch/powerpc/cpu/mpc85xx/cpu_init_nand.c +7 -0
+unsigned long get_tbclk(void)
+{
+#ifdef CONFIG_FSL_CORENET
+	return (gd->bus_clk + 8) / 16;
+#else
+	return (gd->bus_clk + 4UL)/8UL;
+#endif

This looks inconsistent. Either this should be "... +8UL) / 16UL" or "... + 4) / 8;"

This part was copied from arch/powerpc/cpu/mpc85xx/cpu.c, just want too reduce the image size without including that file(cpu.c). Will fix it.

Quoted 11 lines

arch/powerpc/cpu/mpc85xx/start.S line 66

Quoted 8 lines
arch/powerpc/cpu/mpc85xx/start.S +2 -2
-#ifndef CONFIG_NAND_SPL
+#if !defined(CONFIG_NAND_SPL) && !defined(CONFIG_TPL_BOOT)
 	GOT_ENTRY(_start)
 	GOT_ENTRY(_start_of_vectors)
 	GOT_ENTRY(_end_of_vectors)
 	GOT_ENTRY(transfer_to_handler)
-#endif
+#endif /* !CONFIG_TPL_BOOT || !CONFIG_NAND_SPL*/

Should that be

Quoted 3 lines
   #endif /* !CONFIG_TPL_BOOT && !CONFIG_NAND_SPL*/

instead?

Yes. Thanks for pointing out.

Quoted 5 lines

And can we please make this consistent, i. e. as you do in the following:

Quoted 1 line

+#endif /* !CONFIG_NAND_SPL && !CONFIG_TPL_BOOT */

OK.

Thanks.

Haiying

#4 lore raw

PATCH v2 4/8 powerpc/85xx: add TPL_BOOT support

Dear Haiying Wang,

Quoted 10 lines · In message <1295840749.2196.3.camel@haiying-laptop> you wrote:
Quoted 9 lines

arch/powerpc/cpu/mpc85xx/cpu_init_nand.c void cpu_init_f(void) · line 91

Quoted 6 lines
arch/powerpc/cpu/mpc85xx/cpu_init_nand.c +5 -0
+#ifdef CONFIG_FSL_CORENET
+	return (gd->bus_clk + 8) / 16;
+#else
+	return (gd->bus_clk + 4UL)/8UL;
+#endif

This looks inconsistent. Either this should be "... +8UL) / 16UL" or "... + 4) / 8;"

This part was copied from arch/powerpc/cpu/mpc85xx/cpu.c, just want too reduce the image size without including that file(cpu.c). Will fix it.

Instead of copying, can we please move it to some common code?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is wrong always, everywhere and for everyone to  believe  anything
upon  insufficient  evidence.  - W. K. Clifford, British philosopher,
circa 1876