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] tegra: nand: make ONFI detection work
Date: Fri, 28 Sep 2012 17:35:01 -0500	[thread overview]
Message-ID: <1348871701.5580.23@snotra> (raw)
In-Reply-To: <1348847811-4091-1-git-send-email-dev@lynxeye.de> (from dev@lynxeye.de on Fri Sep 28 10:56:51 2012)

On 09/28/2012 10:56:51 AM, Lucas Stach wrote:
> Add the missing bits to the Tegra NAND driver to make ONFI detection  
> work
> properly.
> 
> Also add it to the Tegra default config, as it seems to be a  
> reasonable thing
> to have it available on all boards that use any kind of NAND.
> 
> Signed-off-by: Lucas Stach <dev@lynxeye.de>
> ---
>  drivers/mtd/nand/tegra_nand.c    | 36  
> ++++++++++++++++++++++++++++++++++++
>  include/configs/tegra20-common.h |  1 +
>  2 Dateien ge?ndert, 37 Zeilen hinzugef?gt(+)
> 
> diff --git a/drivers/mtd/nand/tegra_nand.c  
> b/drivers/mtd/nand/tegra_nand.c
> index 2c1b533..0d7ca5d 100644
> --- a/drivers/mtd/nand/tegra_nand.c
> +++ b/drivers/mtd/nand/tegra_nand.c
> @@ -219,6 +219,34 @@ static uint8_t read_byte(struct mtd_info *mtd)
>  }
> 
>  /**
> + * Read len bytes from the chip into a buffer
> + *
> + * @param mtd	MTD device structure
> + * @param buf	buffer to store data to
> + * @param len	number of bytes to read
> + *
> + * Read function for 8bit bus-width
> + */
> +static void read_buf(struct mtd_info *mtd, uint8_t *buf, int len)
> +{
> +	int i, s;
> +	unsigned int reg;
> +	struct nand_chip *chip = mtd->priv;
> +	struct nand_drv *info = (struct nand_drv *)chip->priv;
> +
> +	for (i = 0; i < len; i += 4) {
> +		s = (len - i) > 4 ? 4 : len - i;
> +		writel(CMD_PIO | CMD_RX | CMD_A_VALID | CMD_CE0 |
> +			((s - 1) << CMD_TRANS_SIZE_SHIFT) | CMD_GO,
> +			&info->reg->command);
> +		if (!nand_waitfor_cmd_completion(info->reg))
> +			printf("Command timeout during read_buf\n");
> +		reg = readl(&info->reg->resp);
> +		memcpy(buf + i, &reg, s);
> +	}
> +}

Out of curiousity, what is it about this that needed a custom  
read_buf() where you didn't need one before?

-Scott

  parent reply	other threads:[~2012-09-28 22:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-28 15:56 [U-Boot] [PATCH] tegra: nand: make ONFI detection work Lucas Stach
2012-09-28 20:31 ` Stephen Warren
2012-09-28 22:35 ` Scott Wood [this message]
2012-09-29 11:20   ` Lucas Stach

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=1348871701.5580.23@snotra \
    --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