Patchwork [U-Boot,3/4] powerpc/85xx: load ucode from nand flash before qe_init

login
register
mail settings
Submitter Haiying Wang
Date Feb. 7, 2011, 9:14 p.m.
Message ID <1297113256-7665-3-git-send-email-Haiying.Wang@freescale.com>
Download mbox | patch
Permalink /patch/82149/
State Accepted
Commit a7b1e1b706a78f9208cb4128be9692e97f58e5ac
Delegated to: Kumar Gala
Headers show

Comments

Haiying Wang - Feb. 7, 2011, 9:14 p.m.
From: Haiying Wang <Haiying.Wang@freescale.com>

In the case the QE's microcode is stored in nand flash, we need to load it from
NAND flash to ddr first then the qe_init can get the ucode correctly.

Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/cpu_init.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
Kumar Gala - Feb. 10, 2011, 6:13 a.m.
On Feb 7, 2011, at 3:14 PM, <Haiying.Wang@freescale.com> <Haiying.Wang@freescale.com> wrote:

> From: Haiying Wang <Haiying.Wang@freescale.com>
> 
> In the case the QE's microcode is stored in nand flash, we need to load it from
> NAND flash to ddr first then the qe_init can get the ucode correctly.
> 
> Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
> ---
> arch/powerpc/cpu/mpc85xx/cpu_init.c |   17 +++++++++++++++++
> 1 files changed, 17 insertions(+), 0 deletions(-)

applied to 85xx dev

- k

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 215b7b3..5642cd7 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -37,6 +37,10 @@ 
 #include <asm/fsl_law.h>
 #include <asm/fsl_serdes.h>
 #include "mp.h"
+#ifdef CONFIG_SYS_QE_FW_IN_NAND
+#include <nand.h>
+#include <errno.h>
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -448,6 +452,19 @@  void cpu_secondary_init_r(void)
 {
 #ifdef CONFIG_QE
 	uint qe_base = CONFIG_SYS_IMMR + 0x00080000; /* QE immr base */
+#ifdef CONFIG_SYS_QE_FW_IN_NAND
+	int ret;
+	size_t fw_length = CONFIG_SYS_QE_FW_LENGTH;
+
+	/* load QE firmware from NAND flash to DDR first */
+	ret = nand_read(&nand_info[0], (loff_t)CONFIG_SYS_QE_FW_IN_NAND,
+			&fw_length, (u_char *)CONFIG_SYS_QE_FW_ADDR);
+
+	if (ret && ret == -EUCLEAN) {
+		printf ("NAND read for QE firmware at offset %x failed %d\n",
+				CONFIG_SYS_QE_FW_IN_NAND, ret);
+	}
+#endif
 	qe_init(qe_base);
 	qe_reset();
 #endif