public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Haiying Wang <Haiying.Wang@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/7] powerpc/qe: supports loading QE firmware	from nand flash
Date: Tue, 17 Aug 2010 03:08:10 -0400	[thread overview]
Message-ID: <1282028890.2814.95.camel@localhost.localdomain> (raw)
In-Reply-To: <20100816104003.722211606A5@gemini.denx.de>

On Mon, 2010-16-08 at 12:40 +0200, Wolfgang Denk wrote:
> Dear Haiying Wang,
> 
> In message <1281947090.24612.23.camel@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.Wang@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 ();

  reply	other threads:[~2010-08-17  7:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-16  8:24 [U-Boot] [PATCH 6/7] powerpc/qe: supports loading QE firmware from nand flash Haiying Wang
2010-08-16 10:40 ` Wolfgang Denk
2010-08-17  7:08   ` Haiying Wang [this message]
2010-08-17  9:23     ` Wolfgang Denk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282028890.2814.95.camel@localhost.localdomain \
    --to=haiying.wang@freescale.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox