On Mon, 2010-16-08 at 12:40 +0200, Wolfgang Denk wrote:
> Dear Haiying Wang,
> 
> In message <1281947090.24612.23.ca...@localhost.localdomain> you wrote:
> > and because some platforms need to load QE firmware from NAND flash(no NOR
> > flash), it makes qe_init to be called after nand_init.
> > 
> > Signed-off-by: Haiying Wang <haiying.w...@freescale.com>
> > ---
> >  arch/powerpc/cpu/mpc83xx/cpu_init.c |    8 --------
> >  arch/powerpc/cpu/mpc85xx/cpu_init.c |    8 --------
> >  arch/powerpc/lib/board.c            |   31 +++++++++++++++++++++++++++++++
> >  3 files changed, 31 insertions(+), 16 deletions(-)
> 
> Please do not throw such stuff into common code. Use board /
> architecture specific implementations instead (say, provide some
> misc_init_r() or so).
QE is not a misc feature for the SOCs with QE. It actually makes more
sense to enable it in cpu init code. But P1021 doesn't have ROM in QE,
and P1021mds doesn't have NOR flash on board, so I move this cpu feature
to board.c. How about re-spin this patch as:

---
 arch/powerpc/cpu/mpc85xx/cpu_init.c |    2 +-
 arch/powerpc/lib/board.c            |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c 
b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 1fbc0cc..1021575 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -369,7 +369,7 @@ int cpu_init_r(void)
 
        enable_cpc();
 
-#ifdef CONFIG_QE
+#if defined(CONFIG_QE) && !defined(CONFIG_SYS_QE_FW_IN_NAND)
        uint qe_base = CONFIG_SYS_IMMR + 0x00080000; /* QE immr base */
        qe_init(qe_base);
        qe_reset();
diff --git a/arch/powerpc/lib/board.c b/arch/powerpc/lib/board.c
index 0e00d86..aae6e23 100644
--- a/arch/powerpc/lib/board.c
+++ b/arch/powerpc/lib/board.c
@@ -783,6 +783,21 @@ void board_init_r (gd_t *id, ulong dest_addr)
        nand_init();            /* go init the NAND */
 #endif
 
+       /* QE needs to be initialized after nand_init because some boards have
+        * to save QE firmware in NAND flash.
+        */
+#if defined(CONFIG_QE) && defined(CONFIG_SYS_QE_FW_IN_NAND)
+#ifdef CONFIG_SYS_QE_FW_IN_NAND
+       /* 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",
+                       (loff_t)CONFIG_SYS_QE_FW_IN_NAND, ret);
+       }
+#endif /* CONFIG_QE && CONFIG_SYS_QE_FW_IN_NAND */
+
        /* relocate environment function pointers etc. */
        env_relocate ();



_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to