public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Grandegger <wg@grandegger.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] MPC8360ERDK: adapt NAND interface for the re-written FSL NAND UPM driver
Date: Mon, 02 Jun 2008 12:14:51 +0200	[thread overview]
Message-ID: <4843C81B.2000507@grandegger.com> (raw)

MPC8360ERDK: adapt NAND interface for the re-written FSL NAND UPM driver

This patch is based on the following patch sent a few minutes ago:
"[PATCH] NAND FSL UPM: driver re-write using the hwcontrol callback"
It is untested, of course. Anton, could you please give it a try.

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
 board/freescale/mpc8360erdk/nand.c |   29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

Index: u-boot/board/freescale/mpc8360erdk/nand.c
===================================================================
--- u-boot.orig/board/freescale/mpc8360erdk/nand.c
+++ u-boot/board/freescale/mpc8360erdk/nand.c
@@ -39,6 +39,28 @@ static const u32 upm_array[] = {
 	0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01, /* Words 60 to 63 */
 };
 
+static int upm_setup_done;
+
+static void upm_setup(struct fsl_upm *upm)
+{
+	int i;
+
+	/* write upm array */
+	out_be32(upm->mxmr, MxMR_OP_WARR);
+
+	for (i = 0; i < 64; i++) {
+		out_be32(upm->mdr, upm_array[i]);
+		out_8(upm->io_addr, 0x0);
+	}
+
+	/* normal operation */
+	out_be32(upm->mxmr, MxMR_OP_NORM);
+	while (in_be32(upm->mxmr) != MxMR_OP_NORM)
+		eieio();
+
+	upm_setup_done = 1;
+}
+
 static int dev_ready(void)
 {
 	if (in_be32(&im->qepio.ioport[4].pdat) & 0x00002000) {
@@ -52,10 +74,9 @@ static int dev_ready(void)
 
 static struct fsl_upm_nand fun = {
 	.upm = {
-		.array = upm_array,
 		.io_addr = (void *)CFG_NAND_BASE,
 	},
-	.width = 1,
+	.width = 8,
 	.upm_cmd_offset = 8,
 	.upm_addr_offset = 16,
 	.dev_ready = dev_ready,
@@ -68,5 +89,9 @@ int board_nand_init(struct nand_chip *na
 	fun.upm.mxmr = &im->lbus.mamr;
 	fun.upm.mdr = &im->lbus.mdr;
 	fun.upm.mar = &im->lbus.mar;
+
+	if (!upm_setup_done)
+		upm_setup(&fun.upm);
+
 	return fsl_upm_nand_init(nand, &fun);
 }

             reply	other threads:[~2008-06-02 10:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-02 10:14 Wolfgang Grandegger [this message]
2008-06-02 11:45 ` [U-Boot-Users] [PATCH] MPC8360ERDK: adapt NAND interface for the re-written FSL NAND UPM driver Anton Vorontsov
2008-06-02 12:59   ` Wolfgang Grandegger

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=4843C81B.2000507@grandegger.com \
    --to=wg@grandegger.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