From: "Markus Klotzbücher" <mk@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fw_env: add NAND support
Date: Wed, 3 Sep 2008 13:51:50 +0200 [thread overview]
Message-ID: <20080903115150.GA12440@lisa> (raw)
In-Reply-To: <Pine.LNX.4.64.0809021840240.9447@axis700.grange>
Dear Guennadi,
On Tue, Sep 02, 2008 at 07:05:29PM +0200, Guennadi Liakhovetski wrote:
> +static int flash_flag_obsolete (int dev, int fd, off_t offset)
> +{
> + struct mtd_info_user mtdinfo;
> + int rc;
> +
> + rc = ioctl (fd, MEMGETINFO, &mtdinfo);
> + if (rc < 0) {
> + perror ("Cannot get MTD information");
> + return -1;
> + }
> +
> + if (mtdinfo.type == MTD_NANDFLASH) {
> + /*
> + * No luck on NAND - we could save the erase, but have to write
> + * a whole erase block anyway
> + */
> + rc = __flash_write_buf (dev, fd, &obsolete_flag,
> + sizeof (obsolete_flag), offset,
> + &mtdinfo);
Hmmm, what exactly are you doing here? IIRC environment in NAND was
implemented slightly differently than NOR in that it reused the
obsolete flag as a serial number. This number is incremented for every
write so the env with the higher number is always the current one
(besides the corner case where the number overflows, see
env_nand.c). This way the obsoleting can be completly avoided.
I can't see this in your patch?
Best regards
Markus
P.S.: As mentioned before this mechanism of course could save the
"obsoleting" operation in NOR too...
--
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")
next prev parent reply other threads:[~2008-09-03 11:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-02 17:05 [U-Boot] [PATCH] fw_env: add NAND support Guennadi Liakhovetski
2008-09-02 20:32 ` Wolfgang Denk
2008-09-02 21:18 ` Guennadi Liakhovetski
2008-09-02 22:29 ` Guennadi Liakhovetski
2008-09-02 22:45 ` Wolfgang Denk
2008-09-03 9:19 ` Guennadi Liakhovetski
2008-09-03 13:23 ` Wolfgang Denk
2008-09-03 14:00 ` Guennadi Liakhovetski
2008-09-03 11:19 ` Guennadi Liakhovetski
2008-09-03 11:51 ` Markus Klotzbücher [this message]
2008-09-03 13:25 ` Wolfgang Denk
2008-09-03 14:26 ` Guennadi Liakhovetski
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=20080903115150.GA12440@lisa \
--to=mk@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