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] dfu, nand: before write a buffer to nand, erase the nand sectors
Date: Fri, 14 Jun 2013 17:19:45 -0500	[thread overview]
Message-ID: <1371248385.2996.19@snotra> (raw)
In-Reply-To: <1371205443-27690-1-git-send-email-hs@denx.de> (from hs@denx.de on Fri Jun 14 05:24:03 2013)

On 06/14/2013 05:24:03 AM, Heiko Schocher wrote:
> diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
> index 7dc89b2..6f9a934 100644
> --- a/drivers/dfu/dfu_nand.c
> +++ b/drivers/dfu/dfu_nand.c
> @@ -63,12 +63,25 @@ static int nand_block_op(enum dfu_nand_op op,  
> struct dfu_entity *dfu,
> 
>  	nand = &nand_info[nand_curr_device];
> 
> -	if (op == DFU_OP_READ)
> +	if (op == DFU_OP_READ) {
>  		ret = nand_read_skip_bad(nand, start, &count, &actual,
>  				lim, buf);
> -	else
> +	} else {
> +		nand_erase_options_t opts;
> +
> +		memset(&opts, 0, sizeof(opts));
> +		opts.offset = start;
> +		opts.length = count;
> +		adjust_size_for_badblocks(&opts.length, offset,
> +					  nand_curr_device);
> +		/* first erase */
> +		ret = nand_erase_opts(nand, &opts);
> +		if (ret)
> +			return ret;

You could use opts.spread instead of calling  
adjust_size_for_badblocks().  If you do want to use  
adjust_size_for_badblocks() -- say, to do bounds checking on the result  
-- please move it to nand_util.c, and pass in a pointer to nand_info_t  
instead of "int dev".

-Scott

  reply	other threads:[~2013-06-14 22:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-14 10:24 [U-Boot] [PATCH] dfu, nand: before write a buffer to nand, erase the nand sectors Heiko Schocher
2013-06-14 22:19 ` Scott Wood [this message]
2013-06-17  5:01 ` [U-Boot] [PATCH v2] " Heiko Schocher
2013-06-18  0:51   ` Scott Wood
2013-06-20  4:36     ` Heiko Schocher
2013-06-20 17:22       ` Scott Wood
2013-06-21  5:09   ` [U-Boot] [PATCH v3] " Heiko Schocher
2013-06-21 22:50     ` Scott Wood
2013-06-24 16:50     ` [U-Boot] [PATCH v4] " Heiko Schocher
2013-06-24 23:26       ` Scott Wood
2013-07-25  4:43       ` [U-Boot] [PATCH v5] dfu, nand, ubi: add partubi alt settings for updating ubi partition Heiko Schocher
2013-07-26 22:05         ` Scott Wood

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=1371248385.2996.19@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