From: Wolfgang Grandegger <wg@grandegger.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer
Date: Wed, 07 Jan 2009 19:53:45 +0100 [thread overview]
Message-ID: <4964FA39.3010902@grandegger.com> (raw)
This patch adds support for NAND_MAX_CHIPS to the MTD NAND layer.
Multi-chip devices are then displayed as shown:
Device 0: 2x NAND 512MiB 3,3V 8-bit, sector size 128 KiB
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
common/cmd_nand.c | 10 +++++++++-
drivers/mtd/nand/nand.c | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
Index: u-boot/common/cmd_nand.c
===================================================================
--- u-boot.orig/common/cmd_nand.c
+++ u-boot/common/cmd_nand.c
@@ -191,10 +191,18 @@ int do_nand(cmd_tbl_t * cmdtp, int flag,
putc('\n');
for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
- if (nand_info[i].name)
+ if (nand_info[i].name) {
+#if NAND_MAX_CHIPS > 1
+ struct nand_chip *chip = nand_info[i].priv;
+ printf("Device %d: %dx %s, sector size %u KiB\n",
+ i, chip->numchips, nand_info[i].name,
+ nand_info[i].erasesize >> 10);
+#else
printf("Device %d: %s, sector size %u KiB\n",
i, nand_info[i].name,
nand_info[i].erasesize >> 10);
+#endif
+ }
}
return 0;
}
Index: u-boot/drivers/mtd/nand/nand.c
===================================================================
--- u-boot.orig/drivers/mtd/nand/nand.c
+++ u-boot/drivers/mtd/nand/nand.c
@@ -28,6 +28,10 @@
#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
#endif
+#ifndef NAND_MAX_CHIPS
+#define NAND_MAX_CHIPS 1
+#endif
+
int nand_curr_device = -1;
nand_info_t nand_info[CONFIG_SYS_MAX_NAND_DEVICE];
@@ -41,11 +45,15 @@ extern int board_nand_init(struct nand_c
static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
ulong base_addr)
{
+ int maxchips = NAND_MAX_CHIPS;
+
+ if (maxchips < 1)
+ maxchips = 1;
mtd->priv = nand;
nand->IO_ADDR_R = nand->IO_ADDR_W = (void __iomem *)base_addr;
if (board_nand_init(nand) == 0) {
- if (nand_scan(mtd, 1) == 0) {
+ if (nand_scan(mtd, maxchips) == 0) {
if (!mtd->name)
mtd->name = (char *)default_nand_name;
} else
next reply other threads:[~2009-01-07 18:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-07 18:53 Wolfgang Grandegger [this message]
2009-01-15 22:17 ` [U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer Scott Wood
2009-01-16 7:59 ` Wolfgang Grandegger
2009-01-16 8:22 ` Wolfgang Denk
2009-01-16 17:15 ` Wolfgang Grandegger
2009-01-19 16:12 ` Stefan Roese
2009-01-19 17:08 ` Scott Wood
2009-01-19 17:21 ` Stefan Roese
2009-01-19 19:50 ` Wolfgang Grandegger
2009-01-20 7:40 ` Stefan Roese
2009-01-20 8:36 ` 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=4964FA39.3010902@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