All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] The command "nand write.yaffs" is not working correctly
@ 2011-09-21  1:09 Peter Pan
  2011-09-30  9:10 ` Jin Zhengxiong-R64188
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Pan @ 2011-09-21  1:09 UTC (permalink / raw)
  To: u-boot

I'm recently facing a yaffs2 image write problem in u-boot.

In u-boot console, I write the yaffs2 image in ram to an already erased nand
flash with command "nand write.yaffs ${loadaddr} ${nandrootoffset}
${filesize}".
After that, if I boot using a ramdisk and mount that yaffs2 partition,
I can only
see a folder of "lost+fount". I seems nothing has been written into
that partition.

But if now I write this image using "nandwrite -a -o /dev/mtd4
yaffs2.img" and mount
that partition, it's working.

Anyone met that problem already? Or if I did anything wrong?

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

* [U-Boot] The command "nand write.yaffs" is not working correctly
  2011-09-21  1:09 [U-Boot] The command "nand write.yaffs" is not working correctly Peter Pan
@ 2011-09-30  9:10 ` Jin Zhengxiong-R64188
  2011-09-30 15:35   ` Peter Pan
  2011-10-03 20:43   ` Scott Wood
  0 siblings, 2 replies; 4+ messages in thread
From: Jin Zhengxiong-R64188 @ 2011-09-30  9:10 UTC (permalink / raw)
  To: u-boot

> -----Original Message-----
> From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de] On
> Behalf Of Peter Pan
> Sent: Wednesday, September 21, 2011 9:09 AM
> To: u-boot at lists.denx.de
> Subject: [U-Boot] The command "nand write.yaffs" is not working correctly
> 
> I'm recently facing a yaffs2 image write problem in u-boot.
> 
> In u-boot console, I write the yaffs2 image in ram to an already erased nand
> flash with command "nand write.yaffs ${loadaddr} ${nandrootoffset} ${filesize}".
> After that, if I boot using a ramdisk and mount that yaffs2 partition, I can
> only see a folder of "lost+fount". I seems nothing has been written into that
> partition.
> 
> But if now I write this image using "nandwrite -a -o /dev/mtd4 yaffs2.img" and
> mount that partition, it's working.
> 
> Anyone met that problem already? Or if I did anything wrong?

[Jin Zhengxiong-R64188] 
I once met the similar issue with 2011.03 base and fixed it with following patch, But 
I didn't do a detail checking for that, FYI...

@@ -499,6 +499,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 		return -EINVAL;
 	}
 
+#ifndef CONFIG_CMD_NAND_YAFFS
 	if (!need_skip) {
 		rval = nand_write (nand, offset, length, buffer);
 		if (rval == 0)
@@ -509,13 +510,12 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 			offset, rval);
 		return rval;
 	}
-
+#endif
 	while (left_to_write > 0) {
 		size_t block_offset = offset & (nand->erasesize - 1);
 		size_t write_size;
 
 		WATCHDOG_RESET ();
-
 		if (nand_block_isbad (nand, offset & ~(nand->erasesize - 1))) {
 			printf ("Skip bad block 0x%08llx\n",
 				offset & ~(nand->erasesize - 1));
@@ -546,7 +546,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 				ops.oobbuf = ops.datbuf + pagesize;
 
 				rval = nand->write_oob(nand, offset, &ops);
-				if (!rval)
+				if ( rval != 0)
 					break;
 
 				offset += pagesize;

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

* [U-Boot] The command "nand write.yaffs" is not working correctly
  2011-09-30  9:10 ` Jin Zhengxiong-R64188
@ 2011-09-30 15:35   ` Peter Pan
  2011-10-03 20:43   ` Scott Wood
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Pan @ 2011-09-30 15:35 UTC (permalink / raw)
  To: u-boot

Thank you, Zhengxiong.

The patch seems reasonable. My nand flash has no bad block currently. That
need_skip will skip the oob write part.

I will check that after the golden holiday.
? 2011-9-30 ??5:10?"Jin Zhengxiong-R64188" <R64188@freescale.com>???
>> -----Original Message-----
>> From: u-boot-bounces at lists.denx.de [mailto:u-boot-bounces at lists.denx.de]
On
>> Behalf Of Peter Pan
>> Sent: Wednesday, September 21, 2011 9:09 AM
>> To: u-boot at lists.denx.de
>> Subject: [U-Boot] The command "nand write.yaffs" is not working correctly
>>
>> I'm recently facing a yaffs2 image write problem in u-boot.
>>
>> In u-boot console, I write the yaffs2 image in ram to an already erased
nand
>> flash with command "nand write.yaffs ${loadaddr} ${nandrootoffset}
${filesize}".
>> After that, if I boot using a ramdisk and mount that yaffs2 partition, I
can
>> only see a folder of "lost+fount". I seems nothing has been written into
that
>> partition.
>>
>> But if now I write this image using "nandwrite -a -o /dev/mtd4
yaffs2.img" and
>> mount that partition, it's working.
>>
>> Anyone met that problem already? Or if I did anything wrong?
>
> [Jin Zhengxiong-R64188]
> I once met the similar issue with 2011.03 base and fixed it with following
patch, But
> I didn't do a detail checking for that, FYI...
>
> @@ -499,6 +499,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t
offset, size_t *length,
> return -EINVAL;
> }
>
> +#ifndef CONFIG_CMD_NAND_YAFFS
> if (!need_skip) {
> rval = nand_write (nand, offset, length, buffer);
> if (rval == 0)
> @@ -509,13 +510,12 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t
offset, size_t *length,
> offset, rval);
> return rval;
> }
> -
> +#endif
> while (left_to_write > 0) {
> size_t block_offset = offset & (nand->erasesize - 1);
> size_t write_size;
>
> WATCHDOG_RESET ();
> -
> if (nand_block_isbad (nand, offset & ~(nand->erasesize - 1))) {
> printf ("Skip bad block 0x%08llx\n",
> offset & ~(nand->erasesize - 1));
> @@ -546,7 +546,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t
offset, size_t *length,
> ops.oobbuf = ops.datbuf + pagesize;
>
> rval = nand->write_oob(nand, offset, &ops);
> - if (!rval)
> + if ( rval != 0)
> break;
>
> offset += pagesize;
>
>

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

* [U-Boot] The command "nand write.yaffs" is not working correctly
  2011-09-30  9:10 ` Jin Zhengxiong-R64188
  2011-09-30 15:35   ` Peter Pan
@ 2011-10-03 20:43   ` Scott Wood
  1 sibling, 0 replies; 4+ messages in thread
From: Scott Wood @ 2011-10-03 20:43 UTC (permalink / raw)
  To: u-boot

On 09/30/2011 04:10 AM, Jin Zhengxiong-R64188 wrote:
> I once met the similar issue with 2011.03 base and fixed it with following patch, But 
> I didn't do a detail checking for that, FYI...
> 
> @@ -499,6 +499,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
>  		return -EINVAL;
>  	}
>  
> +#ifndef CONFIG_CMD_NAND_YAFFS
>  	if (!need_skip) {
>  		rval = nand_write (nand, offset, length, buffer);
>  		if (rval == 0)
> @@ -509,13 +510,12 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
>  			offset, rval);
>  		return rval;
>  	}
> -
> +#endif

This should be a runtime check for whether yaffs was actually requested.
 The current code does something similar for WITH_DROP_FFS.

Or perhaps we should just drop this optimization altogether, barring
someone demonstrating that it makes a huge performance difference.

>  	while (left_to_write > 0) {
>  		size_t block_offset = offset & (nand->erasesize - 1);
>  		size_t write_size;
>  
>  		WATCHDOG_RESET ();
> -
>  		if (nand_block_isbad (nand, offset & ~(nand->erasesize - 1))) {
>  			printf ("Skip bad block 0x%08llx\n",
>  				offset & ~(nand->erasesize - 1));
> @@ -546,7 +546,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
>  				ops.oobbuf = ops.datbuf + pagesize;
>  
>  				rval = nand->write_oob(nand, offset, &ops);
> -				if (!rval)
> +				if ( rval != 0)
>  					break;
>  
>  				offset += pagesize;

Drop these.

-Scott

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

end of thread, other threads:[~2011-10-03 20:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21  1:09 [U-Boot] The command "nand write.yaffs" is not working correctly Peter Pan
2011-09-30  9:10 ` Jin Zhengxiong-R64188
2011-09-30 15:35   ` Peter Pan
2011-10-03 20:43   ` Scott Wood

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.