public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/4] mtd/nand: Add ONFI support for FSL NAND controller
Date: Fri, 2 Dec 2011 12:45:09 -0600	[thread overview]
Message-ID: <4ED91CB5.9090206@freescale.com> (raw)
In-Reply-To: <1322817437-4955-4-git-send-email-Shengzhou.Liu@freescale.com>

On 12/02/2011 03:17 AM, Shengzhou Liu wrote:
> - fix NAND_CMD_READID command for ONFI detect.
>  - add NAND_CMD_PARAM command to read the ONFI parameter page.
> 
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
> ---
>  drivers/mtd/nand/fsl_elbc_nand.c |   16 +++++++++++++++-
>  1 files changed, 15 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
> index 4d1e527..476fdd3 100644
> --- a/drivers/mtd/nand/fsl_elbc_nand.c
> +++ b/drivers/mtd/nand/fsl_elbc_nand.c
> @@ -350,7 +350,7 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
>  		out_be32(&lbc->fbcr, 5);
>  		ctrl->read_bytes = 5;
>  		ctrl->use_mdr = 1;
> -		ctrl->mdr = 0;
> +		ctrl->mdr = column;
>  
>  		set_addr(mtd, 0, 0, 0);
>  		fsl_elbc_run_command(mtd);
> @@ -480,6 +480,20 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
>  		fsl_elbc_run_command(mtd);
>  		return;
>  
> +	case NAND_CMD_PARAM:
> +		dbg("fsl_elbc_cmdfunc: NAND_CMD_PARAM.\n");
> +		out_be32(&lbc->fir, (FIR_OP_CM0 << FIR_OP0_SHIFT) |
> +				    (FIR_OP_UA  << FIR_OP1_SHIFT) |
> +				    (FIR_OP_RBW << FIR_OP2_SHIFT));
> +		out_be32(&lbc->fcr, NAND_CMD_PARAM << FCR_CMD0_SHIFT);
> +		out_be32(&lbc->fbcr, 256);
> +		ctrl->read_bytes = 256;
> +		ctrl->use_mdr = 1;
> +		ctrl->mdr = column;
> +		set_addr(mtd, 0, 0, 0);
> +		fsl_elbc_run_command(mtd);
> +		return;

This could share code with NAND_CMD_READID -- always read 256 bytes
(we'll need to read more than 5 bytes for non-ONFI as well, when we pull
in the newer Linux NAND code), and use "command << FCR_CMD0_SHIFT" for FCR.

BTW, has anyone tested the eLBC driver with 16-bit NAND?  I think our
read_byte() implementation is not going to do the right thing here -- it
needs to read a 16-bit word when the chip is 16-bit, and discard the
upper half.

-Scott

  reply	other threads:[~2011-12-02 18:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02  9:17 [U-Boot] [PATCH 1/4] mtd/nand : Add function board_nand_init_tail() for some special NAND controllers Shengzhou Liu
2011-12-02  9:17 ` [U-Boot] [PATCH 2/4] mtd/nand: Fixup for support ONFI detect Shengzhou Liu
2011-12-02  9:17   ` [U-Boot] [PATCH 3/4] mtd/nand: remove CONFIG_SYS_NAND_ONFI_DETECTION to enable ONFI detection Shengzhou Liu
2011-12-02  9:17     ` [U-Boot] [PATCH 4/4] mtd/nand: Add ONFI support for FSL NAND controller Shengzhou Liu
2011-12-02 18:45       ` Scott Wood [this message]
     [not found]         ` <3F453DDFF675A64A89321A1F352810216B03B9@039-SN1MPN1-005.039d.mgd.msft.net>
2011-12-05 19:17           ` Scott Wood
2011-12-02 18:32   ` [U-Boot] [PATCH 2/4] mtd/nand: Fixup for support ONFI detect Scott Wood
     [not found]     ` <3F453DDFF675A64A89321A1F352810216B0393@039-SN1MPN1-005.039d.mgd.msft.net>
2011-12-05 19:20       ` Scott Wood
2011-12-04  9:04 ` [U-Boot] [PATCH 1/4] mtd/nand : Add function board_nand_init_tail() for some special NAND controllers Igor Grinberg

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=4ED91CB5.9090206@freescale.com \
    --to=scottwood@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