public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer
Date: Tue, 20 Jan 2009 08:40:04 +0100	[thread overview]
Message-ID: <200901200840.04367.sr@denx.de> (raw)
In-Reply-To: <4974D97F.3060907@grandegger.com>

Hi Wolfgang,

On Monday 19 January 2009, Wolfgang Grandegger wrote:
> >> Are they accessed as 2 NAND controllers, or 2 chips on one controller?
> >
> > 2 chips on one controller.
> >
> >> We can make it "#define NAND_MAX_CHIPS 2" if that's appropriate, but
> >> defining it to CONFIG_SYS_MAX_NAND_DEVICE doesn't seem to make sense.
> >
> > OK with me.
>
> NAND_MAX_CHIPS should be set to 1!
>
> NAND_MAX_CHIPS defines the number of NAND chips (or dies) *per* NAND
> device (or bank) meaning two or more identical NAND chips can be mapped
> to one device. So far this was not supported, because nand_scan() was
> always called with maxchips=1 in nand_init_chip:
>
> $ cat drivers/mtd/nand/nand.c:
> ...
> static void nand_init_chip(struct mtd_info *mtd, struct nand_chip *nand,
>                            ulong base_addr)
> {
>         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 (!mtd->name)
>                                 mtd->name = (char *)default_nand_name;
>                 } else
>                         mtd->name = NULL;
>         } else {
>                 mtd->name = NULL;
>                 mtd->size = 0;
>         }
> }
>
> Furthermore, the callback chip->select_chip() must be provided by the
> NAND driver to select the chips properly. It's seems not to be
> implemented for NDFC and therefore you do not have this choice.
> Therefore NAND_MAX_CHIPS should be set to 1 for the Bamboo.

The 4xx NDFC driver uses the board_nand_select_device() function to select the 
NAND chip (other platforms do it this way as well). IIRC, this function was 
already introduced with old legacy NAND driver. Could be that it is 
deprecated now and should be replaced with the ->select_device() function.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

  reply	other threads:[~2009-01-20  7:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-07 18:53 [U-Boot] [RFC/PATCH 1/4] Enable multi chip support in the NAND layer Wolfgang Grandegger
2009-01-15 22:17 ` 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 [this message]
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=200901200840.04367.sr@denx.de \
    --to=sr@denx.de \
    --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