From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 4/5] mpc83xx: MPC8360E-RDK: add support for NAND
Date: Thu, 17 Jan 2008 15:40:09 +0300 [thread overview]
Message-ID: <20080117124009.GA3971@localhost.localdomain> (raw)
In-Reply-To: <20080116123102.d13303bc.kim.phillips@freescale.com>
On Wed, Jan 16, 2008 at 12:31:02PM -0600, Kim Phillips wrote:
> On Wed, 9 Jan 2008 20:57:58 +0300
> Anton Vorontsov <avorontsov@ru.mvista.com> wrote:
>
> >
> > Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> > ---
> > board/freescale/mpc8360erdk/Makefile | 2 +-
> > board/freescale/mpc8360erdk/nand.c | 73 ++++++++++++++++++++++++++++++++++
> > include/configs/MPC8360ERDK.h | 24 +++++++++++
> > 3 files changed, 98 insertions(+), 1 deletions(-)
> > create mode 100644 board/freescale/mpc8360erdk/nand.c
> >
> Hello Anton, since WD pulled the upm nand driver, I assumed this would
> apply, but it fails to build:
You're trying to apply v1. I've sent v2 driver & RDK support
on Monday 14. Ok, let's duplicate it. ;-)
- - - -
Date: Mon, 14 Jan 2008 23:09:45 +0300
Message-ID: <20080114200945.GB24168@localhost.localdomain>
From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: Kim Phillips <kim.phillips@freescale.com>
Cc: Peter Barada <peterb@logicpd.com>, Stefan Roese <sr@denx.de>, u-boot-users at lists.sourceforge.net
Subject: [U-Boot-Users] [PATCH v2 2/2] mpc83xx: MPC8360E-RDK: add support for NAND
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
board/freescale/mpc8360erdk/Makefile | 2 +-
board/freescale/mpc8360erdk/nand.c | 75 ++++++++++++++++++++++++++++++++++
include/configs/MPC8360ERDK.h | 24 +++++++++++
3 files changed, 100 insertions(+), 1 deletions(-)
create mode 100644 board/freescale/mpc8360erdk/nand.c
diff --git a/board/freescale/mpc8360erdk/Makefile b/board/freescale/mpc8360erdk/Makefile
index acc9544..97ae11d 100644
--- a/board/freescale/mpc8360erdk/Makefile
+++ b/board/freescale/mpc8360erdk/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(BOARD).a
-COBJS := $(BOARD).o
+COBJS := $(BOARD).o nand.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS))
diff --git a/board/freescale/mpc8360erdk/nand.c b/board/freescale/mpc8360erdk/nand.c
new file mode 100644
index 0000000..7c06a3f
--- /dev/null
+++ b/board/freescale/mpc8360erdk/nand.c
@@ -0,0 +1,75 @@
+/*
+ * MPC8360E-RDK support for the NAND on FSL UPM
+ *
+ * Copyright (C) 2007 MontaVista Software, Inc.
+ * Anton Vorontsov <avorontsov@ru.mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#include <config.h>
+
+#if defined(CONFIG_CMD_NAND)
+#include <common.h>
+#include <asm/io.h>
+#include <asm/immap_83xx.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/fsl_upm.h>
+#include <nand.h>
+
+static struct immap *im = (struct immap *)CFG_IMMR;
+
+static const u32 upm_array[] = {
+ 0x0ff03c30, 0x0ff03c30, 0x0ff03c34, 0x0ff33c30, /* Words 0 to 3 */
+ 0xfff33c31, 0xfffffc30, 0xfffffc30, 0xfffffc30, /* Words 4 to 7 */
+ 0x0faf3c30, 0x0faf3c30, 0x0faf3c30, 0x0fff3c34, /* Words 8 to 11 */
+ 0xffff3c31, 0xfffffc30, 0xfffffc30, 0xfffffc30, /* Words 12 to 15 */
+ 0x0fa3fc30, 0x0fa3fc30, 0x0fa3fc30, 0x0ff3fc34, /* Words 16 to 19 */
+ 0xfff3fc31, 0xfffffc30, 0xfffffc30, 0xfffffc30, /* Words 20 to 23 */
+ 0x0ff33c30, 0x0fa33c30, 0x0fa33c34, 0x0ff33c30, /* Words 24 to 27 */
+ 0xfff33c31, 0xfff0fc30, 0xfff0fc30, 0xfff0fc30, /* Words 28 to 31 */
+ 0xfff3fc30, 0xfff3fc30, 0xfff6fc30, 0xfffcfc30, /* Words 32 to 35 */
+ 0xfffcfc30, 0xfffcfc30, 0xfffcfc30, 0xfffcfc30, /* Words 36 to 39 */
+ 0xfffcfc30, 0xfffcfc30, 0xfffcfc30, 0xfffcfc30, /* Words 40 to 43 */
+ 0xfffdfc30, 0xfffffc30, 0xfffffc30, 0xfffffc31, /* Words 44 to 47 */
+ 0xfffffc30, 0xfffffc00, 0xfffffc00, 0xfffffc00, /* Words 48 to 51 */
+ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc00, /* Words 52 to 55 */
+ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01, /* Words 56 to 59 */
+ 0xfffffc00, 0xfffffc00, 0xfffffc00, 0xfffffc01, /* Words 60 to 63 */
+};
+
+static int dev_ready(void)
+{
+ if (in_be32(&im->qepio.ioport[4].pdat) & 0x00002000) {
+ debug("nand ready\n");
+ return 1;
+ }
+
+ debug("nand busy\n");
+ return 0;
+}
+
+static struct fsl_upm_nand fun = {
+ .upm = {
+ .array = upm_array,
+ .io_addr = (void *)CFG_NAND_BASE,
+ },
+ .width = 1,
+ .upm_cmd_offset = 8,
+ .upm_addr_offset = 16,
+ .dev_ready = dev_ready,
+ .wait_pattern = 1,
+ .chip_delay = 50,
+};
+
+int board_nand_init(struct nand_chip *nand)
+{
+ fun.upm.mxmr = &im->lbus.mamr;
+ fun.upm.mdr = &im->lbus.mdr;
+ fun.upm.mar = &im->lbus.mar;
+ return fsl_upm_nand_init(nand, &fun);
+}
+#endif /* CONFIG_CMD_NAND */
diff --git a/include/configs/MPC8360ERDK.h b/include/configs/MPC8360ERDK.h
index e6d0c5e..b258d91 100644
--- a/include/configs/MPC8360ERDK.h
+++ b/include/configs/MPC8360ERDK.h
@@ -186,6 +186,11 @@
* NAND flash on the local bus
*/
#define CFG_NAND_BASE 0x60000000
+#define CONFIG_CMD_NAND 1
+#define CONFIG_NAND_FSL_UPM 1
+#define CFG_MAX_NAND_DEVICE 1
+#define NAND_MAX_CHIPS 1
+#define CONFIG_MTD_NAND_VERIFY_WRITE
#define CFG_LBLAWBAR1_PRELIM CFG_NAND_BASE
#define CFG_LBLAWAR1_PRELIM 0x8000001b /* Access window size 4K */
@@ -514,23 +519,42 @@
"fdtfile=dtb\0"\
"fsfile=fs\0"\
"ubootfile=u-boot.bin\0"\
+ "mtdparts=mtdparts=60000000.nand-flash:4096k(kernel),128k(dtb),-(rootfs)\0"\
"setbootargs=setenv bootargs console=$consoledev,$baudrate "\
"$mtdparts panic=1\0"\
"adddhcpargs=setenv bootargs $bootargs ip=on\0"\
"addnfsargs=setenv bootargs $bootargs ip=$ipaddr:$serverip:"\
"$gatewayip:$netmask:$hostname:$netdev:off "\
"root=/dev/nfs rw nfsroot=$serverip:$rootpath\0"\
+ "addnandargs=setenv bootargs $bootargs root=/dev/mtdblock3 "\
+ "rootfstype=jffs2 rw\0"\
"tftp_get_uboot=tftp 100000 $ubootfile\0"\
"tftp_get_kernel=tftp $loadaddr $bootfile\0"\
"tftp_get_dtb=tftp $fdtaddr $fdtfile\0"\
"tftp_get_fs=tftp c00000 $fsfile\0"\
+ "nand_erase_kernel=nand erase 0 400000\0"\
+ "nand_erase_dtb=nand erase 400000 20000\0"\
+ "nand_erase_fs=nand erase 420000 3be0000\0"\
+ "nand_write_kernel=nand write.jffs2 $loadaddr 0 400000\0"\
+ "nand_write_dtb=nand write.jffs2 $fdtaddr 400000 20000\0"\
+ "nand_write_fs=nand write.jffs2 c00000 420000 $filesize\0"\
+ "nand_read_kernel=nand read.jffs2 $loadaddr 0 400000\0"\
+ "nand_read_dtb=nand read.jffs2 $fdtaddr 400000 20000\0"\
"nor_reflash=protect off ff800000 ff87ffff ; erase ff800000 ff87ffff ; "\
"cp.b 100000 ff800000 $filesize\0"\
+ "nand_reflash_kernel=run tftp_get_kernel nand_erase_kernel "\
+ "nand_write_kernel\0"\
+ "nand_reflash_dtb=run tftp_get_dtb nand_erase_dtb nand_write_dtb\0"\
+ "nand_reflash_fs=run tftp_get_fs nand_erase_fs nand_write_fs\0"\
+ "nand_reflash=run nand_reflash_kernel nand_reflash_dtb "\
+ "nand_reflash_fs\0"\
"boot_m=bootm $loadaddr - $fdtaddr\0"\
"dhcpboot=run setbootargs adddhcpargs tftp_get_kernel tftp_get_dtb "\
"boot_m\0"\
"nfsboot=run setbootargs addnfsargs tftp_get_kernel tftp_get_dtb "\
"boot_m\0"\
+ "nandboot=run setbootargs addnandargs nand_read_kernel nand_read_dtb "\
+ "boot_m\0"\
""
#define CONFIG_BOOTCOMMAND "run dhcpboot"
--
1.5.2.2
next prev parent reply other threads:[~2008-01-17 12:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-09 17:50 [U-Boot-Users] [PATCH v2 0/5] mpc83xx: MPC8360E-RDK related patches Anton Vorontsov
2008-01-09 17:57 ` [U-Boot-Users] [PATCH 1/5] mpc83xx: add "fsl, qe" compatible fixups Anton Vorontsov
2008-01-09 17:57 ` [U-Boot-Users] [PATCH 2/5] mpc83xx: add support for the MPC8360E-RDK Anton Vorontsov
2008-01-09 17:57 ` [U-Boot-Users] [PATCH 3/5] nand: FSL UPM NAND driver Anton Vorontsov
2008-01-10 17:31 ` Stefan Roese
2008-01-14 20:06 ` Anton Vorontsov
2008-01-14 20:09 ` [U-Boot-Users] [PATCH v2 1/2] " Anton Vorontsov
2008-01-16 13:16 ` Stefan Roese
2008-01-14 20:09 ` [U-Boot-Users] [PATCH v2 2/2] mpc83xx: MPC8360E-RDK: add support for NAND Anton Vorontsov
2008-01-14 20:09 ` [U-Boot-Users] [PATCH] nand: fsl_upm: convert to updated MTD NAND infrastructure Anton Vorontsov
2008-01-16 13:19 ` Stefan Roese
2008-01-15 8:41 ` [U-Boot-Users] [PATCH 3/5] nand: FSL UPM NAND driver Stefan Roese
2008-01-09 17:57 ` [U-Boot-Users] [PATCH 4/5] mpc83xx: MPC8360E-RDK: add support for NAND Anton Vorontsov
2008-01-16 18:31 ` Kim Phillips
2008-01-17 12:40 ` Anton Vorontsov [this message]
2008-01-09 17:58 ` [U-Boot-Users] [PATCH 5/5] mpc83xx: UEC: add support for Broadcom BCM5481 Gigabit PHY Anton Vorontsov
2008-01-10 20:41 ` Ben Warren
2008-01-10 21:10 ` Peter Barada
2008-01-11 5:26 ` Ben Warren
2008-01-11 4:00 ` [U-Boot-Users] [PATCH v2 0/5] mpc83xx: MPC8360E-RDK related patches Kim Phillips
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=20080117124009.GA3971@localhost.localdomain \
--to=avorontsov@ru.mvista.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