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] Pad data length for nand write
Date: Tue, 17 Feb 2009 15:16:57 -0600	[thread overview]
Message-ID: <499B2949.80505@freescale.com> (raw)
In-Reply-To: <499B23E8.30607@siconix.com>

Derek Ou wrote:
> This routine is copied from nand_write_opts() at nand_util.c of v1.3.4.  

v1.3.4 had its own buffer; it did not use the caller's.

> It maybe better
> to pad data length and data buffer in do_nand() at cmd_nand.c.

Or pass a flag to nand_write_skip_bad().

   But I
> don't see real
> difference.  I didn't allocate a new buffer since the data length is 
> defined in the command
> arguments and I have no knowledge of a safe location and large enough 
> memory space
> to store data.

You can define a static array for holding one page, as v1.3.4 did.  The 
space after the caller's buffer is *not* a safe location.

> Maybe we should implement, like Wolfgang said, a "+length" syntax in the 
> "nand write"
> command to indicates "round up to the next page boundary". 

Sounds good.  If we do that, we should do similarly with "nand erase". 
It currently (sometimes) warns and rounds up if you give it a 
non-block-aligned size.

> In this 
> case, do_nand()
> can assume that it's safe to write pass memory address (add + length) 
> and Flash offset
> (off + length).

No, it will *not* assume that it's safe to write to any memory of the 
caller's.  It will allocate its own buffer.

-Scott

  reply	other threads:[~2009-02-17 21:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-17 17:15 [U-Boot] [PATCH] Pad data length for nand write Derek Ou
2009-02-17 17:15 ` Derek Ou
2009-02-17 18:51   ` Scott Wood
2009-02-17 20:54     ` Derek Ou
2009-02-17 21:16       ` Scott Wood [this message]
2009-02-17 21:37         ` Derek Ou
2009-02-17 17:55 ` Mike Frysinger
2009-02-17 18:37   ` Derek Ou
2009-02-17 18:41     ` Scott Wood
2009-02-17 20:22     ` Wolfgang Denk

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=499B2949.80505@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