Skip to contentSkip to conversation

powerpc/mpc85xx: Ignore FDT pointer for non-QEMU in cpu_init_early_f()

PATCH New York Sun 1 participant 5 messages Apr 30, 2014 PowerPC

lore
Share & tools
lore

York Sun

author
#0 lore raw

PATCH v2 1/5 powerpc/mpc85xx: Ignore FDT pointer for non-QEMU in cpu_init_early_f()

The pointer of device tree comes from r3 for QEMU. This is not the case for normal SoCs out of reset. Having gd->fdt_blob as 0 is important for other functions to detect the non-existence of device tree.

CC Alexander Graf <[email protected]>

---
Change log

v2: no change since v1

 arch/powerpc/cpu/mpc85xx/cpu_init_early.c |    2 ++
 1 file changed, 2 insertions(+)
arch/powerpc/cpu/mpc85xx/cpu_init_early.c +2 -0
index 998781b..47b712d 100644
@@ -102,11 +102,13 @@ void cpu_init_early_f(void *fdt)
 	for (i = 0; i < sizeof(gd_t); i++)
 		((char *)gd)[i] = 0;
 
+#ifdef CONFIG_QEMU_E500
 	/*
 	 * CONFIG_SYS_CCSRBAR_PHYS below may use gd->fdt_blob on ePAPR systems,
 	 * so we need to populate it before it accesses it.
 	 */
 	gd->fdt_blob = fdt;
+#endif
 
 	mas0 = MAS0_TLBSEL(1) | MAS0_ESEL(13);
 	mas1 = MAS1_VALID | MAS1_TID(0) | MAS1_TS | MAS1_TSIZE(BOOKE_PAGESZ_1M);
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v2 2/5 powerpc/freescale: Change the return value of mac_read_from_eeprom()

The return value has not been checked by its caller, until recent change of using generic board architecture. The error of this function is not critical enough to hang the system. Printing the warning message is enough to catch user's attention. U-boot should continue to boot to give user a chance to fix the EEPROM. Chaning the return value to 0 to avoid hanging in the board_init_r().

---
Change log

v2: no change since v1

 board/freescale/common/sys_eeprom.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
board/freescale/common/sys_eeprom.c +3 -3
index 9c18dd8..33a5a5a 100644
@@ -425,13 +425,13 @@ int mac_read_from_eeprom(void)
 
 	if (read_eeprom()) {
 		printf("Read failed.\n");
-		return -1;
+		return 0;
 	}
 
 	if (!is_valid) {
 		printf("Invalid ID (%02x %02x %02x %02x)\n",
 		       e.id[0], e.id[1], e.id[2], e.id[3]);
-		return -1;
+		return 0;
 	}
 
 #ifdef CONFIG_SYS_I2C_EEPROM_NXID
@@ -447,7 +447,7 @@ int mac_read_from_eeprom(void)
 	crcp = (void *)&e + crc_offset;
 	if (crc != be32_to_cpu(*crcp)) {
 		printf("CRC mismatch (%08x != %08x)\n", crc, be32_to_cpu(e.crc));
-		return -1;
+		return 0;
 	}
 
 #ifdef CONFIG_SYS_I2C_EEPROM_NXID
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH v2 3/5 powerpc/mpc85xx: Fix boot_flag for calling board_init_f()

In reply to York Sun

baord_init_f takes one argument, boot_flag. It has not been used for powerpc, until recently changing to use generic board architecture. The boot flag is added as a return value from cpu_init_f().

CC Alexander Graf <[email protected]>

---
Change log

v2: Instead of using gd->flag and setting boot_flag as 0, use a return value from cpu_init_f.

 arch/powerpc/cpu/mpc85xx/cpu_init.c    |    7 ++++---
 arch/powerpc/cpu/mpc85xx/spl_minimal.c |    4 +++-
 arch/powerpc/cpu/mpc85xx/start.S       |    2 +-
 include/common.h                       |    5 ++++-
 4 files changed, 12 insertions(+), 6 deletions(-)
arch/powerpc/cpu/mpc85xx/cpu_init.c +4 -3
index 36ef232..7f1a095 100644
@@ -368,12 +368,12 @@ void fsl_erratum_a007212_workaround(void)
 }
 #endif
 
-void cpu_init_f (void)
+ulong cpu_init_f(void)
 {
+	ulong flag = 0;
 	extern void m8560_cpm_reset (void);
 #ifdef CONFIG_SYS_DCSRBAR_PHYS
 	ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
-	gd = (gd_t *)(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
 #endif
 #if defined(CONFIG_SECURE_BOOT)
 	struct law_entry law;
@@ -442,13 +442,14 @@ void cpu_init_f (void)
 #ifdef CONFIG_DEEP_SLEEP
 	/* disable the console if boot from deep sleep */
 	if (in_be32(&gur->scrtsr[0]) & (1 << 3))
-		gd->flags |= GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE;
+		flag = GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE;
 #endif
 #endif
 #ifdef CONFIG_SYS_FSL_ERRATUM_A007212
 	fsl_erratum_a007212_workaround();
 #endif
 
+	return flag;
 }
 
 /* Implement a dummy function for those platforms w/o SERDES */
arch/powerpc/cpu/mpc85xx/spl_minimal.c +3 -1
index 9e4c6c9..cc45f71 100644
@@ -12,7 +12,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void cpu_init_f(void)
+ulong cpu_init_f(void)
 {
 #ifdef CONFIG_SYS_INIT_L2_ADDR
 	ccsr_l2cache_t *l2cache = (void *)CONFIG_SYS_MPC85xx_L2_ADDR;
@@ -27,6 +27,8 @@ void cpu_init_f(void)
 	out_be32(&l2cache->l2ctl,
 		(MPC85xx_L2CTL_L2E | MPC85xx_L2CTL_L2SRAM_ENTIRE));
 #endif
+
+	return 0;
 }
 
 #ifndef CONFIG_SYS_FSL_TBCLK_DIV
arch/powerpc/cpu/mpc85xx/start.S +1 -1
index 0e3c86a..7658893 100644
@@ -1158,7 +1158,7 @@ _start_cont:
 	mtmsr	r3
 	isync
 
-	bl	cpu_init_f
+	bl	cpu_init_f	/* return boot_flag for calling board_init_f */
 	bl	board_init_f
 	isync
 
include/common.h +4 -1
index 5fb0bb2..626bce3 100644
@@ -729,9 +729,12 @@ void	get_sys_info  ( sys_info_t * );
 #if defined(CONFIG_8xx) || defined(CONFIG_MPC8260)
 void	cpu_init_f    (volatile immap_t *immr);
 #endif
-#if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MCF52x2) ||defined(CONFIG_MPC86xx)
+#if defined(CONFIG_4xx) || defined(CONFIG_MCF52x2) || defined(CONFIG_MPC86xx)
 void	cpu_init_f    (void);
 #endif
+#ifdef CONFIG_MPC85xx
+ulong cpu_init_f(void);
+#endif
 
 int	cpu_init_r    (void);
 #if defined(CONFIG_MPC8260)
Signature · 1 line
1.7.9.5
author
#3 lore raw

PATCH v2 4/5 powerpc/mpc86xx: Fix boot_flag for calling board_init_f()

In reply to York Sun

The argument boot_flag of board_inti_f() hasn't been used for powerpc until recent changing to use generic board. Set it to 0 as a proper value.

---
change log

v2: This is a new change.

 arch/powerpc/cpu/mpc86xx/start.S |    1 +
 1 file changed, 1 insertion(+)
arch/powerpc/cpu/mpc86xx/start.S +1 -0
index e33672a..ec5f4a7 100644
@@ -273,6 +273,7 @@ diag_done:
 /*	bl	l2cache_enable */
 
 	/* run 1st part of board init code (from Flash)	  */
+	li	r3, 0		/* clear boot_flag for calling board_init_f */
 	bl	board_init_f
 	sync
 
Signature · 1 line
1.7.9.5
author
#4 lore raw

PATCH v2 5/5 powerpc/freescale: Convert selected boards to generic board architecture

In reply to York Sun

This patch converts the following boards to use generic board: MPC8536DS, MPC8572DS, MPC8641HPCN, p1_p2_rdb_pc, corenet_ds, t4qds, B4860QDS. It has been tested on NOR boot on MPC8536DS, MPC8572DS, P1021RDB, P4080DS, P5020DS, P5040DS, P3041DS, T4240QDS, B4860QDS.

CC Ying Zhang <[email protected]>
CC Prabhakar Kushwaha <[email protected]>
CC Haijun.Zhang <[email protected]>
CC Scott Wood <[email protected]>
CC Shaohui Xie <[email protected]>

---
Chang log

v2: no chance since v1. Verified v2 set on MPC8536DS, MPC8641HPCN, P4080DS.

 include/configs/B4860QDS.h     |    3 +++
 include/configs/MPC8536DS.h    |    2 ++
 include/configs/MPC8572DS.h    |    3 +++
 include/configs/MPC8641HPCN.h  |    3 +++
 include/configs/corenet_ds.h   |    3 +++
 include/configs/p1_p2_rdb_pc.h |    3 +++
 include/configs/t4qds.h        |    2 ++
 7 files changed, 19 insertions(+)
include/configs/B4860QDS.h +3 -0
index df371b7..e0c08dc 100644
@@ -7,6 +7,9 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
+
 /*
  * B4860 QDS board configuration file
  */
include/configs/MPC8536DS.h +2 -0
index f15e162..72f5fde 100644
@@ -11,6 +11,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
 #include "../board/freescale/common/ics307_clk.h"
 
 #ifdef CONFIG_36BIT
include/configs/MPC8572DS.h +3 -0
index 3a30feb..48ae9d4 100644
@@ -11,6 +11,9 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
+
 #include "../board/freescale/common/ics307_clk.h"
 
 #ifdef CONFIG_36BIT
include/configs/MPC8641HPCN.h +3 -0
index 7443ace..a0d7d52 100644
@@ -16,6 +16,9 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
+
 /* High Level Configuration Options */
 #define CONFIG_MPC8641		1	/* MPC8641 specific */
 #define CONFIG_MPC8641HPCN	1	/* MPC8641HPCN board specific */
include/configs/corenet_ds.h +3 -0
index db6b9be..c8b7c2d 100644
@@ -10,6 +10,9 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
+
 #include "../board/freescale/common/ics307_clk.h"
 
 #ifdef CONFIG_RAMBOOT_PBL
include/configs/p1_p2_rdb_pc.h +3 -0
index e745945..56b638e 100644
@@ -10,6 +10,9 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
+
 #ifdef CONFIG_36BIT
 #define CONFIG_PHYS_64BIT
 #endif
include/configs/t4qds.h +2 -0
index 36bc529..75609b9 100644
@@ -10,6 +10,8 @@
 #ifndef __T4QDS_H
 #define __T4QDS_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
 #define CONFIG_CMD_REGINFO
 
 /* High Level Configuration Options */
Signature · 1 line
1.7.9.5