All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/4] introduce nand write.trimffs
@ 2011-05-19 16:49 Ben Gardiner
  2011-05-19 16:49 ` [U-Boot] [PATCH 1/4] [v2] nand_base: trivial: fix comment read/write comment Ben Gardiner
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Ben Gardiner @ 2011-05-19 16:49 UTC (permalink / raw)
  To: u-boot

This series adds a nand write variant which implements the procedure
reccomended in the UBI FAQ [1] of dropping trailing pages of eraseblocks
containing entirely 0xff's.

[1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo

Changes since v1:
 * renamed to 'trimffs' from 'ubi'
 * wrapped the new feature in #ifdefs
 * don't make it default for jffs -- patch dropped
 * attribution of the drop_ffs() function from mtd-utils to Artem

Ben Gardiner (4):
  [v2] nand_base: trivial: fix comment read/write comment
  [v2] nand_util: convert nand_write_skip_bad() to flags
  [v2] nand_util: drop trailing all-0xff pages if requested
  [v2] cmd_nand: add nand write.trimffs command

 common/cmd_nand.c            |   22 +++++++++++++++++++-
 drivers/mtd/nand/nand_base.c |    2 +-
 drivers/mtd/nand/nand_util.c |   43 +++++++++++++++++++++++++++++++++++------
 include/nand.h               |    7 +++++-
 4 files changed, 63 insertions(+), 11 deletions(-)

-- 
1.7.4.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 1/4] [v2] nand_base: trivial: fix comment read/write comment
  2011-05-19 16:49 [U-Boot] [PATCH v2 0/4] introduce nand write.trimffs Ben Gardiner
@ 2011-05-19 16:49 ` Ben Gardiner
  2011-05-24 12:36   ` Detlev Zundel
  2011-05-19 16:49 ` [U-Boot] [PATCH 2/4] [v2] nand_util: convert nand_write_skip_bad() to flags Ben Gardiner
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Ben Gardiner @ 2011-05-19 16:49 UTC (permalink / raw)
  To: u-boot

Replace an incorrect 'read' with 'write' in a comment.

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>

---
Changes since v1:
 * rebased to HEAD of git://git.denx.de/u-boot-nand-flash.git : ff7b4a0
   ("env_nand: zero-initialize variable nand_erase_options")

---
 drivers/mtd/nand/nand_base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 52f8575..1a95a91 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1950,7 +1950,7 @@ static int nand_write(struct mtd_info *mtd, loff_t to, size_t len,
 	struct nand_chip *chip = mtd->priv;
 	int ret;
 
-	/* Do not allow reads past end of device */
+	/* Do not allow writes past end of device */
 	if ((to + len) > mtd->size)
 		return -EINVAL;
 	if (!len)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 2/4] [v2] nand_util: convert nand_write_skip_bad() to flags
  2011-05-19 16:49 [U-Boot] [PATCH v2 0/4] introduce nand write.trimffs Ben Gardiner
  2011-05-19 16:49 ` [U-Boot] [PATCH 1/4] [v2] nand_base: trivial: fix comment read/write comment Ben Gardiner
@ 2011-05-19 16:49 ` Ben Gardiner
  2011-05-24 13:17   ` Detlev Zundel
  2011-05-19 16:49 ` [U-Boot] [PATCH 3/4] [v2] nand_util: drop trailing all-0xff pages if requested Ben Gardiner
  2011-05-19 16:49 ` [U-Boot] [PATCH 4/4] [v2] cmd_nand: add nand write.trimffs command Ben Gardiner
  3 siblings, 1 reply; 11+ messages in thread
From: Ben Gardiner @ 2011-05-19 16:49 UTC (permalink / raw)
  To: u-boot

In a future commit the behaviour of nand_write_skip_bad()
will be further extended.

Convert the only flag currently passed to the nand_write_
skip_bad() function to a bitfield of only one allocated
member. This should avoid an explosion of int's at the
end of the parameter list or the ambiguous calls like

nand_write_skip_bad(info, offset, len, buf, 0, 1, 1);
nand_write_skip_bad(info, offset, len, buf, 0, 1, 0);

Instead there will be:

nand_write_skip_bad(info, offset, len, buf, WITH_YAFFS_OOB |
			WITH_OTHER);

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Detlev Zundel <dzu@denx.de>

---
Changes since v1:
 * rebased to HEAD of git://git.denx.de/u-boot-nand-flash.git : ff7b4a0
   ("env_nand: zero-initialize variable nand_erase_options")
 * renamed the flag from WITH_OOB to WITH_YAFFS_OOB (Detlev Zundel)
 * introduce 'WITH_DEFAULTS' flag defined as 0 so as to convert also
   the remaining nand_write_skip_bad() call (Detlev Zundel)

---
 common/cmd_nand.c            |    6 ++++--
 drivers/mtd/nand/nand_util.c |    8 ++++----
 include/nand.h               |    6 +++++-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 7bd37de..cb752c1 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -574,14 +574,16 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 							 (u_char *)addr);
 			else
 				ret = nand_write_skip_bad(nand, off, &rwsize,
-							  (u_char *)addr, 0);
+							  (u_char *)addr,
+							  WITH_DEFAULTS);
 #ifdef CONFIG_CMD_NAND_YAFFS
 		} else if (!strcmp(s, ".yaffs")) {
 			if (read) {
 				printf("Unknown nand command suffix '%s'.\n", s);
 				return 1;
 			}
-			ret = nand_write_skip_bad(nand, off, &rwsize, (u_char *)addr, 1);
+			ret = nand_write_skip_bad(nand, off, &rwsize,
+						(u_char *)addr, WITH_YAFFS_OOB);
 #endif
 		} else if (!strcmp(s, ".oob")) {
 			/* out-of-band data */
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 5a6f7ae..03ccd02 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -448,11 +448,11 @@ static int check_skip_len(nand_info_t *nand, loff_t offset, size_t length)
  * @param offset	offset in flash
  * @param length	buffer length
  * @param buffer        buffer to read from
- * @param withoob	whether write with yaffs format
+ * @param flags		flags mmofying the behaviour of the write to NAND
  * @return		0 in case of success
  */
 int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
-			u_char *buffer, int withoob)
+			u_char *buffer, int flags)
 {
 	int rval = 0, blocksize;
 	size_t left_to_write = *length;
@@ -460,7 +460,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 	int need_skip;
 
 #ifdef CONFIG_CMD_NAND_YAFFS
-	if (withoob) {
+	if (flags & WITH_YAFFS_OOB) {
 		int pages;
 		pages = nand->erasesize / nand->writesize;
 		blocksize = (pages * nand->oobsize) + nand->erasesize;
@@ -529,7 +529,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 			write_size = blocksize - block_offset;
 
 #ifdef CONFIG_CMD_NAND_YAFFS
-		if (withoob) {
+		if (flags & WITH_YAFFS_OOB) {
 			int page, pages;
 			size_t pagesize = nand->writesize;
 			size_t pagesize_oob = pagesize + nand->oobsize;
diff --git a/include/nand.h b/include/nand.h
index 7459bd0..95b83a0 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -114,8 +114,12 @@ typedef struct nand_erase_options nand_erase_options_t;
 
 int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 		       u_char *buffer);
+
+#define WITH_YAFFS_OOB	(1 << 0) /* whether write with yaffs format */
+#define WITH_DEFAULTS	0
+
 int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
-			u_char *buffer, int withoob);
+			u_char *buffer, int flags);
 int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts);
 
 #define NAND_LOCK_STATUS_TIGHT	0x01
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/4] [v2] nand_util: drop trailing all-0xff pages if requested
  2011-05-19 16:49 [U-Boot] [PATCH v2 0/4] introduce nand write.trimffs Ben Gardiner
  2011-05-19 16:49 ` [U-Boot] [PATCH 1/4] [v2] nand_base: trivial: fix comment read/write comment Ben Gardiner
  2011-05-19 16:49 ` [U-Boot] [PATCH 2/4] [v2] nand_util: convert nand_write_skip_bad() to flags Ben Gardiner
@ 2011-05-19 16:49 ` Ben Gardiner
  2011-05-24 13:23   ` Detlev Zundel
  2011-05-19 16:49 ` [U-Boot] [PATCH 4/4] [v2] cmd_nand: add nand write.trimffs command Ben Gardiner
  3 siblings, 1 reply; 11+ messages in thread
From: Ben Gardiner @ 2011-05-19 16:49 UTC (permalink / raw)
  To: u-boot

Add a flag to nand_read_skip_bad() such that if true, any trailing
pages in an eraseblock whose contents are entirely 0xff will be
dropped.

The implementation is via a new drop_ffs() function which is
based on the function of the same name from the ubiformat
utility by Artem Bityutskiy.

This is as-per the reccomendations of the UBI FAQ [1]

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Artem Bityutskiy <dedekind1@gmail.com>

[1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo

---

This behaviour was found to fix both UBI and JFFS2 images written to
cleanly erased NAND partitions on da850evm.

Changes since v1:
 * rebased to HEAD of git://git.denx.de/u-boot-nand-flash.git : ff7b4a0
   ("env_nand: zero-initialize variable nand_erase_options")
 * wrap the new functionality in a CONFIG_CMD_NAND_TRIMFFS ifdef to
   reduce size impact of new feature

---
 drivers/mtd/nand/nand_util.c |   32 +++++++++++++++++++++++++++++---
 include/nand.h               |    1 +
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 03ccd02..2bfe743 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -436,6 +436,24 @@ static int check_skip_len(nand_info_t *nand, loff_t offset, size_t length)
 	return ret;
 }
 
+#ifdef CONFIG_CMD_NAND_TRIMFFS
+static size_t drop_ffs(const nand_info_t *nand, const u_char *buf,
+			const size_t *len)
+{
+	size_t i, l = *len;
+
+	for (i = l - 1; i >= 0; i--)
+		if (((const uint8_t *)buf)[i] != 0xFF)
+			break;
+
+	/* The resulting length must be aligned to the minimum flash I/O size */
+	l = i + 1;
+	l = (l + nand->writesize - 1) / nand->writesize;
+	l *=  nand->writesize;
+	return l;
+}
+#endif
+
 /**
  * nand_write_skip_bad:
  *
@@ -499,7 +517,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 		return -EINVAL;
 	}
 
-	if (!need_skip) {
+	if (!need_skip && !(flags & WITH_DROP_FFS)) {
 		rval = nand_write (nand, offset, length, buffer);
 		if (rval == 0)
 			return 0;
@@ -512,7 +530,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 
 	while (left_to_write > 0) {
 		size_t block_offset = offset & (nand->erasesize - 1);
-		size_t write_size;
+		size_t write_size, truncated_write_size;
 
 		WATCHDOG_RESET ();
 
@@ -558,7 +576,15 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 		else
 #endif
 		{
-			rval = nand_write (nand, offset, &write_size, p_buffer);
+			truncated_write_size = write_size;
+#ifdef CONFIG_CMD_NAND_TRIMFFS
+			if (flags & WITH_DROP_FFS)
+				truncated_write_size = drop_ffs(nand, p_buffer,
+						&write_size);
+#endif
+
+			rval = nand_write(nand, offset, &truncated_write_size,
+					p_buffer);
 			offset += write_size;
 			p_buffer += write_size;
 		}
diff --git a/include/nand.h b/include/nand.h
index 95b83a0..a5368e2 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -116,6 +116,7 @@ int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 		       u_char *buffer);
 
 #define WITH_YAFFS_OOB	(1 << 0) /* whether write with yaffs format */
+#define WITH_DROP_FFS	(1 << 1) /* drop trailing all-0xff pages */
 #define WITH_DEFAULTS	0
 
 int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 4/4] [v2] cmd_nand: add nand write.trimffs command
  2011-05-19 16:49 [U-Boot] [PATCH v2 0/4] introduce nand write.trimffs Ben Gardiner
                   ` (2 preceding siblings ...)
  2011-05-19 16:49 ` [U-Boot] [PATCH 3/4] [v2] nand_util: drop trailing all-0xff pages if requested Ben Gardiner
@ 2011-05-19 16:49 ` Ben Gardiner
  2011-05-24 13:22   ` Detlev Zundel
  3 siblings, 1 reply; 11+ messages in thread
From: Ben Gardiner @ 2011-05-19 16:49 UTC (permalink / raw)
  To: u-boot

Add another nand write. variant, trimffs. This command will request of
nand_write_skip_bad() that all trailing all-0xff pages will be
dropped from eraseblocks when they are written to flash as-per the
reccommended behaviour of the UBI FAQ [1].

The function that implements this timming is the drop_ffs() function
by Artem Bityutskiy, ported from the mtd-utils tree.

[1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo

Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
CC: Artem Bityutskiy <dedekind1@gmail.com>
CC: Detlev Zundel <dzu@denx.de>

---

Detlev,
I did not do any erased-state checks since the implicit assumption
in other nand commands is that the user is required to do their
own erasing beforehand.

Changes since v1:
 * rebased to HEAD of git://git.denx.de/u-boot-nand-flash.git : ff7b4a0
   ("env_nand: zero-initialize variable nand_erase_options")
 * renamed the command variant to '.trimffs' from '.ubi' (Detlev Zundel)
 * added attribution to mtd-utils and Artem Bityutskiy in both the source
   comments and commit message
 * wrapped the new command in a new ifdef, CONFIG_CMD_NAND_TRIMFFS, to
   reduce the size impact of this new feature

---
 common/cmd_nand.c            |   16 ++++++++++++++++
 drivers/mtd/nand/nand_util.c |    3 +++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index cb752c1..51d726c 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -576,6 +576,16 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 				ret = nand_write_skip_bad(nand, off, &rwsize,
 							  (u_char *)addr,
 							  WITH_DEFAULTS);
+#ifdef CONFIG_CMD_NAND_TRIMFFS
+		} else if (!strcmp(s, ".trimffs")) {
+			if (read) {
+				printf("Unknown nand command suffix '%s'\n", s);
+				return 1;
+			}
+			ret = nand_write_skip_bad(nand, off, &rwsize,
+						(u_char *)addr,
+						WITH_DROP_FFS);
+#endif
 #ifdef CONFIG_CMD_NAND_YAFFS
 		} else if (!strcmp(s, ".yaffs")) {
 			if (read) {
@@ -690,6 +700,12 @@ U_BOOT_CMD(
 	"nand write - addr off|partition size\n"
 	"    read/write 'size' bytes starting at offset 'off'\n"
 	"    to/from memory address 'addr', skipping bad blocks.\n"
+#ifdef CONFIG_CMD_NAND_TRIMFFS
+	"nand write.trimffs - addr off|partition size\n"
+	"    write 'size' bytes starting at offset 'off' from memory address\n"
+	"    'addr', skipping bad blocks and dropping any pages at the end\n"
+	"    of eraseblocks that contain only 0xFF\n"
+#endif
 #ifdef CONFIG_CMD_NAND_YAFFS
 	"nand write.yaffs - addr off|partition size\n"
 	"    write 'size' bytes starting at offset 'off' with yaffs format\n"
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 2bfe743..357f332 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -11,6 +11,9 @@
  *		nandwrite.c by Steven J. Hill (sjhill at realitydiluted.com)
  *			       and Thomas Gleixner (tglx at linutronix.de)
  *
+ * Copyright (C) 2008 Nokia Corporation: drop_ffs() function by
+ * Artem Bityutskiy <dedekind1@gmail.com> from mtd-utils
+ *
  * See file CREDITS for list of people who contributed to this
  * project.
  *
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 1/4] [v2] nand_base: trivial: fix comment read/write comment
  2011-05-19 16:49 ` [U-Boot] [PATCH 1/4] [v2] nand_base: trivial: fix comment read/write comment Ben Gardiner
@ 2011-05-24 12:36   ` Detlev Zundel
  0 siblings, 0 replies; 11+ messages in thread
From: Detlev Zundel @ 2011-05-24 12:36 UTC (permalink / raw)
  To: u-boot

Hi Ben,

> Replace an incorrect 'read' with 'write' in a comment.
>
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>

Acked-by: Detlev Zundel <dzu@denx.de>

-- 
Whenever you find yourself on the side of the majority it is
time to pause and reflect.
                                                -- Mark Twain
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 2/4] [v2] nand_util: convert nand_write_skip_bad() to flags
  2011-05-19 16:49 ` [U-Boot] [PATCH 2/4] [v2] nand_util: convert nand_write_skip_bad() to flags Ben Gardiner
@ 2011-05-24 13:17   ` Detlev Zundel
  2011-05-24 13:27     ` Ben Gardiner
  0 siblings, 1 reply; 11+ messages in thread
From: Detlev Zundel @ 2011-05-24 13:17 UTC (permalink / raw)
  To: u-boot

Hi Ben,

> In a future commit the behaviour of nand_write_skip_bad()
> will be further extended.
>
> Convert the only flag currently passed to the nand_write_
> skip_bad() function to a bitfield of only one allocated
> member. This should avoid an explosion of int's at the
> end of the parameter list or the ambiguous calls like
>
> nand_write_skip_bad(info, offset, len, buf, 0, 1, 1);
> nand_write_skip_bad(info, offset, len, buf, 0, 1, 0);
>
> Instead there will be:
>
> nand_write_skip_bad(info, offset, len, buf, WITH_YAFFS_OOB |
> 			WITH_OTHER);
>
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Detlev Zundel <dzu@denx.de>
>
> ---
> Changes since v1:
>  * rebased to HEAD of git://git.denx.de/u-boot-nand-flash.git : ff7b4a0
>    ("env_nand: zero-initialize variable nand_erase_options")
>  * renamed the flag from WITH_OOB to WITH_YAFFS_OOB (Detlev Zundel)
>  * introduce 'WITH_DEFAULTS' flag defined as 0 so as to convert also
>    the remaining nand_write_skip_bad() call (Detlev Zundel)

I don't remember requesting this change - and rereading my mails I
cannot find anything either.  Actually I consider this define to be
overkill.  What I was asking for was to change all occurrences of the
function call - a 0 for flags is ok with me.

If you remove that again, you can add my

Acked-by: Detlev Zundel <dzu@denx.de>

Cheers
  Detlev

-- 
I've been examining the existing [linux]  kernel configuration system, and I
have about concluded that the best favor we could do everybody involved with
it is to take it out behind the barn and shoot it through the head.
                           -- Eric S. Raymond on linux-kbuild Mar 2000
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 4/4] [v2] cmd_nand: add nand write.trimffs command
  2011-05-19 16:49 ` [U-Boot] [PATCH 4/4] [v2] cmd_nand: add nand write.trimffs command Ben Gardiner
@ 2011-05-24 13:22   ` Detlev Zundel
  2011-05-24 13:30     ` Ben Gardiner
  0 siblings, 1 reply; 11+ messages in thread
From: Detlev Zundel @ 2011-05-24 13:22 UTC (permalink / raw)
  To: u-boot

Hi Ben,

> Add another nand write. variant, trimffs. This command will request of
> nand_write_skip_bad() that all trailing all-0xff pages will be
> dropped from eraseblocks when they are written to flash as-per the
> reccommended behaviour of the UBI FAQ [1].
>
> The function that implements this timming is the drop_ffs() function
> by Artem Bityutskiy, ported from the mtd-utils tree.
>
> [1] http://www.linux-mtd.infradead.org/doc/ubi.html#L_flasher_algo
>
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Artem Bityutskiy <dedekind1@gmail.com>
> CC: Detlev Zundel <dzu@denx.de>
>
> ---
>
> Detlev,
> I did not do any erased-state checks since the implicit assumption
> in other nand commands is that the user is required to do their
> own erasing beforehand.

Yes, I have come to the same conclusion.

I have another request though - please add the new command to
doc/README.nand.  Thanks!

Cheers
  Detlev

-- 
Modern technique has made it possible for leisure, within limits, to be not
the prerogative of small privileged classes, but a right evenly distributed
throughout the community.  The morality of  work is the morality of slaves,
and the modern world has no need of slavery.            -- Bertrand Russell
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 3/4] [v2] nand_util: drop trailing all-0xff pages if requested
  2011-05-19 16:49 ` [U-Boot] [PATCH 3/4] [v2] nand_util: drop trailing all-0xff pages if requested Ben Gardiner
@ 2011-05-24 13:23   ` Detlev Zundel
  0 siblings, 0 replies; 11+ messages in thread
From: Detlev Zundel @ 2011-05-24 13:23 UTC (permalink / raw)
  To: u-boot

Hi Ben,

> Add a flag to nand_read_skip_bad() such that if true, any trailing
> pages in an eraseblock whose contents are entirely 0xff will be
> dropped.
>
> The implementation is via a new drop_ffs() function which is
> based on the function of the same name from the ubiformat
> utility by Artem Bityutskiy.
>
> This is as-per the reccomendations of the UBI FAQ [1]
>
> Signed-off-by: Ben Gardiner <bengardiner@nanometrics.ca>
> CC: Artem Bityutskiy <dedekind1@gmail.com>

Acked-by: Detlev Zundel <dzu@denx.de>

Cheers
  Detlev

-- 
"Oh, didn't you know, the Lord did the original programming of the universe in
COBOL." - "That's why the world is the evil work of Satan. A true divine being
would have used Scheme."  -  "And, if so, Jesus would have been crucified on a
big lambda symbol."  -- K. Chafin, K. Schilling & D. Hanley, on comp.lang.lisp
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 2/4] [v2] nand_util: convert nand_write_skip_bad() to flags
  2011-05-24 13:17   ` Detlev Zundel
@ 2011-05-24 13:27     ` Ben Gardiner
  0 siblings, 0 replies; 11+ messages in thread
From: Ben Gardiner @ 2011-05-24 13:27 UTC (permalink / raw)
  To: u-boot

Hi Detlev,

On Tue, May 24, 2011 at 9:17 AM, Detlev Zundel <dzu@denx.de> wrote:
>> ---
>> Changes since v1:
>> ?* rebased to HEAD of git://git.denx.de/u-boot-nand-flash.git : ff7b4a0
>> ? ?("env_nand: zero-initialize variable nand_erase_options")
>> ?* renamed the flag from WITH_OOB to WITH_YAFFS_OOB (Detlev Zundel)
>> ?* introduce 'WITH_DEFAULTS' flag defined as 0 so as to convert also
>> ? ?the remaining nand_write_skip_bad() call (Detlev Zundel)
>
> I don't remember requesting this change - and rereading my mails I
> cannot find anything either. ?Actually I consider this define to be
> overkill. ?What I was asking for was to change all occurrences of the
> function call - a 0 for flags is ok with me.

Sorry. That was how I interpreted the following. My mistake.

On Fri, Apr 29, 2011 at 7:44 AM, Detlev Zundel <dzu@denx.de> wrote:
>> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
>> index 7bd37de..69b2acc 100644
>> --- a/common/cmd_nand.c
>> +++ b/common/cmd_nand.c
>> @@ -581,7 +581,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? printf("Unknown nand command suffix '%s'.\n", s);
>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? return 1;
>> ? ? ? ? ? ? ? ? ? ? ? }
>> - ? ? ? ? ? ? ? ? ? ? ret = nand_write_skip_bad(nand, off, &rwsize, (u_char *)addr, 1);
>> + ? ? ? ? ? ? ? ? ? ? ret = nand_write_skip_bad(nand, off, &rwsize,
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (u_char *)addr, WITH_OOB);
>> ?#endif
>> ? ? ? ? ? ? ? } else if (!strcmp(s, ".oob")) {
>> ? ? ? ? ? ? ? ? ? ? ? /* out-of-band data */
>
> I see an occurrence of nand_write_skip_bad just above this if block.
> Please replace this also.

> If you remove that again, you can add my
>
> Acked-by: Detlev Zundel <dzu@denx.de>

Will do.

Thank you, Detlev.

,Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH 4/4] [v2] cmd_nand: add nand write.trimffs command
  2011-05-24 13:22   ` Detlev Zundel
@ 2011-05-24 13:30     ` Ben Gardiner
  0 siblings, 0 replies; 11+ messages in thread
From: Ben Gardiner @ 2011-05-24 13:30 UTC (permalink / raw)
  To: u-boot

Hi Detlev,

On Tue, May 24, 2011 at 9:22 AM, Detlev Zundel <dzu@denx.de> wrote:
> I have another request though - please add the new command to
> doc/README.nand. ?Thanks!

Good idea. Will do in v3.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-05-24 13:30 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 16:49 [U-Boot] [PATCH v2 0/4] introduce nand write.trimffs Ben Gardiner
2011-05-19 16:49 ` [U-Boot] [PATCH 1/4] [v2] nand_base: trivial: fix comment read/write comment Ben Gardiner
2011-05-24 12:36   ` Detlev Zundel
2011-05-19 16:49 ` [U-Boot] [PATCH 2/4] [v2] nand_util: convert nand_write_skip_bad() to flags Ben Gardiner
2011-05-24 13:17   ` Detlev Zundel
2011-05-24 13:27     ` Ben Gardiner
2011-05-19 16:49 ` [U-Boot] [PATCH 3/4] [v2] nand_util: drop trailing all-0xff pages if requested Ben Gardiner
2011-05-24 13:23   ` Detlev Zundel
2011-05-19 16:49 ` [U-Boot] [PATCH 4/4] [v2] cmd_nand: add nand write.trimffs command Ben Gardiner
2011-05-24 13:22   ` Detlev Zundel
2011-05-24 13:30     ` Ben Gardiner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.