public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Add Yaffs2 image writing support.
@ 2010-01-10 17:38 Li Wenhao
  2010-03-11 22:41 ` Wolfgang Denk
  2010-04-09 20:43 ` Wolfgang Denk
  0 siblings, 2 replies; 5+ messages in thread
From: Li Wenhao @ 2010-01-10 17:38 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Li Wenhao <liwenhao.g@gmail.com>
---
 common/cmd_nand.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 075a8af..38c6480 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -390,6 +390,27 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 				ret = nand->read_oob(nand, off, &ops);
 			else
 				ret = nand->write_oob(nand, off, &ops);
+		} else if (!strcmp(s, ".yaffs2") && !read) {
+			mtd_oob_ops_t ops = {
+				.mode = MTD_OOB_AUTO,
+				.len = 2048,	/* page size */
+				.ooblen = 64,	/* spare size */
+			};
+
+			ulong page = 0;
+			ulong block_size = ops.len + ops.ooblen;
+			while (page * block_size < size) {
+				ops.datbuf = addr + page * block_size;
+				ops.oobbuf = ops.datbuf + ops.len;
+
+				ret = nand->write_oob(nand, 
+						      off + page * ops.len,
+						      &ops);
+
+				if (ret) break;
+
+				page++;
+			}
 		} else {
 			printf("Unknown nand command suffix '%s'.\n", s);
 			return 1;
-- 
1.6.3.3

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

* [U-Boot] [PATCH] Add Yaffs2 image writing support.
  2010-01-10 17:38 [U-Boot] [PATCH] Add Yaffs2 image writing support Li Wenhao
@ 2010-03-11 22:41 ` Wolfgang Denk
  2010-03-11 23:14   ` Scott Wood
  2010-04-09 20:43 ` Wolfgang Denk
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2010-03-11 22:41 UTC (permalink / raw)
  To: u-boot

Dear Scott,

In message <1263145126-23165-1-git-send-email-liwenhao.g@gmail.com> Li Wenha wrote:
> 
> Signed-off-by: Li Wenhao <liwenhao.g@gmail.com>
> ---
>  common/cmd_nand.c |   21 +++++++++++++++++++++
>  1 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
> index 075a8af..38c6480 100644
> --- a/common/cmd_nand.c
> +++ b/common/cmd_nand.c
> @@ -390,6 +390,27 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
>  				ret = nand->read_oob(nand, off, &ops);
>  			else
>  				ret = nand->write_oob(nand, off, &ops);
> +		} else if (!strcmp(s, ".yaffs2") && !read) {
> +			mtd_oob_ops_t ops = {
> +				.mode = MTD_OOB_AUTO,
> +				.len = 2048,	/* page size */
> +				.ooblen = 64,	/* spare size */
> +			};
> +
> +			ulong page = 0;
> +			ulong block_size = ops.len + ops.ooblen;
> +			while (page * block_size < size) {
> +				ops.datbuf = addr + page * block_size;
> +				ops.oobbuf = ops.datbuf + ops.len;
> +
> +				ret = nand->write_oob(nand, 
> +						      off + page * ops.len,
> +						      &ops);
> +
> +				if (ret) break;
> +
> +				page++;
> +			}
>  		} else {
>  			printf("Unknown nand command suffix '%s'.\n", s);
>  			return 1;
> -- 
> 1.6.3.3

What is the status of this patch? Is it in your queue?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A year spent in artificial intelligence is enough to make one believe
in God.

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

* [U-Boot] [PATCH] Add Yaffs2 image writing support.
  2010-03-11 22:41 ` Wolfgang Denk
@ 2010-03-11 23:14   ` Scott Wood
  0 siblings, 0 replies; 5+ messages in thread
From: Scott Wood @ 2010-03-11 23:14 UTC (permalink / raw)
  To: u-boot

Wolfgang Denk wrote:
> Dear Scott,
> 
> In message <1263145126-23165-1-git-send-email-liwenhao.g@gmail.com> Li Wenha wrote:
>> Signed-off-by: Li Wenhao <liwenhao.g@gmail.com>
>> ---
>>  common/cmd_nand.c |   21 +++++++++++++++++++++
>>  1 files changed, 21 insertions(+), 0 deletions(-)
>>
>> diff --git a/common/cmd_nand.c b/common/cmd_nand.c
>> index 075a8af..38c6480 100644
>> --- a/common/cmd_nand.c
>> +++ b/common/cmd_nand.c
>> @@ -390,6 +390,27 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
>>  				ret = nand->read_oob(nand, off, &ops);
>>  			else
>>  				ret = nand->write_oob(nand, off, &ops);
>> +		} else if (!strcmp(s, ".yaffs2") && !read) {
>> +			mtd_oob_ops_t ops = {
>> +				.mode = MTD_OOB_AUTO,
>> +				.len = 2048,	/* page size */
>> +				.ooblen = 64,	/* spare size */
>> +			};

What about 512 or 4096 byte pages?

>> +
>> +			ulong page = 0;
>> +			ulong block_size = ops.len + ops.ooblen;
>> +			while (page * block_size < size) {

What if "size" is not a multiple of "block_size"?  Should not read past 
the end of the input array, and should warn the user.

>> +				ret = nand->write_oob(nand, 
>> +						      off + page * ops.len,
>> +						      &ops);
>> +
>> +				if (ret) break;

The break should go on its own line, and you should tell the user about 
the failure.

>> +
>> +				page++;
>> +			}
>>  		} else {
>>  			printf("Unknown nand command suffix '%s'.\n", s);
>>  			return 1;
>> -- 
>> 1.6.3.3
> 
> What is the status of this patch? Is it in your queue?

No, I didn't notice it -- the subject doesn't mention NAND, and it 
presumably wasn't CCed to me.

Li Wenhao, could you send a new patch addressing the above issues, plus 
updated documentation?

-Scott

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

* [U-Boot] [PATCH] Add Yaffs2 image writing support.
  2010-01-10 17:38 [U-Boot] [PATCH] Add Yaffs2 image writing support Li Wenhao
  2010-03-11 22:41 ` Wolfgang Denk
@ 2010-04-09 20:43 ` Wolfgang Denk
  2010-04-10 12:27   ` Wenhao Li
  1 sibling, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2010-04-09 20:43 UTC (permalink / raw)
  To: u-boot

Dear Li Wenhao,

In message <1263145126-23165-1-git-send-email-liwenhao.g@gmail.com> you wrote:
> 
> Signed-off-by: Li Wenhao <liwenhao.g@gmail.com>
> ---
>  common/cmd_nand.c |   21 +++++++++++++++++++++
>  1 files changed, 21 insertions(+), 0 deletions(-)

Scott sent a number of comments / change requests for this patch. Do
you intend to submit an updated patch any time soon, or shall I drop
this from my list?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
An expert is a person who avoids the small errors while  sweeping  on
to the grand fallacy.

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

* [U-Boot] [PATCH] Add Yaffs2 image writing support.
  2010-04-09 20:43 ` Wolfgang Denk
@ 2010-04-10 12:27   ` Wenhao Li
  0 siblings, 0 replies; 5+ messages in thread
From: Wenhao Li @ 2010-04-10 12:27 UTC (permalink / raw)
  To: u-boot

It's my mistake. I should send my mails to the mail-list
instead of only replied to Scott.

After discussing the requests with Scott, I realized that
my patch may not work on a lot of chips. So please drop it.

Best regards,

Li Wenhao


2010/4/10 Wolfgang Denk <wd@denx.de>:
> Dear Li Wenhao,
>
> In message <1263145126-23165-1-git-send-email-liwenhao.g@gmail.com> you wrote:
>>
>> Signed-off-by: Li Wenhao <liwenhao.g@gmail.com>
>> ---
>> ?common/cmd_nand.c | ? 21 +++++++++++++++++++++
>> ?1 files changed, 21 insertions(+), 0 deletions(-)
>
> Scott sent a number of comments / change requests for this patch. Do
> you intend to submit an updated patch any time soon, or shall I drop
> this from my list?
>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> An expert is a person who avoids the small errors while ?sweeping ?on
> to the grand fallacy.
>

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

end of thread, other threads:[~2010-04-10 12:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-10 17:38 [U-Boot] [PATCH] Add Yaffs2 image writing support Li Wenhao
2010-03-11 22:41 ` Wolfgang Denk
2010-03-11 23:14   ` Scott Wood
2010-04-09 20:43 ` Wolfgang Denk
2010-04-10 12:27   ` Wenhao Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox