mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] nandtest: Add more fields when bad byte found
@ 2021-10-11 19:07 Trent Piepho
  2021-10-12  7:46 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Trent Piepho @ 2021-10-11 19:07 UTC (permalink / raw)
  To: Barebox List; +Cc: Trent Piepho

This can help to determine what is causing the problem.  E.g., is the
bad byte always in the same eraseblock?  Is it always 513 bytes into a
page with a hardware ECC chunk size of 512 bytes?

Example before and after (error at absolute address 123456 with 128kB
eraseblock and 2kB page sizes):

Byte 0xe240 is 12 should be 34
Block 0x1 byte 0xe240 (page 0x1c offset 0x240) is 0x12 should be 0x34

Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
---
 commands/nandtest.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/commands/nandtest.c b/commands/nandtest.c
index 1bb59c7fd..4a7db9cc7 100644
--- a/commands/nandtest.c
+++ b/commands/nandtest.c
@@ -169,8 +169,10 @@ static int erase_and_write(loff_t ofs, unsigned char *data,
 		printf("\ncompare failed. seed %d\n", seed);
 		for (i = 0; i < meminfo.erasesize; i++) {
 			if (data[i] != rbuf[i])
-				printf("Byte 0x%x is %02x should be %02x\n",
-				       i, rbuf[i], data[i]);
+				printf("Block 0x%llx byte 0x%0x (page 0x%x offset 0x%x) is %02x should be %02x\n",
+				       div64_ul(ofs, meminfo.erasesize), i,
+				       i / meminfo.writesize, i % meminfo.writesize,
+				       rbuf[i], data[i]);
 		}
 		return ret;
 	}
-- 
2.31.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

* Re: [PATCH] nandtest: Add more fields when bad byte found
  2021-10-11 19:07 [PATCH] nandtest: Add more fields when bad byte found Trent Piepho
@ 2021-10-12  7:46 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-10-12  7:46 UTC (permalink / raw)
  To: Trent Piepho; +Cc: Barebox List

On Mon, Oct 11, 2021 at 12:07:25PM -0700, Trent Piepho wrote:
> This can help to determine what is causing the problem.  E.g., is the
> bad byte always in the same eraseblock?  Is it always 513 bytes into a
> page with a hardware ECC chunk size of 512 bytes?
> 
> Example before and after (error at absolute address 123456 with 128kB
> eraseblock and 2kB page sizes):
> 
> Byte 0xe240 is 12 should be 34
> Block 0x1 byte 0xe240 (page 0x1c offset 0x240) is 0x12 should be 0x34
> 
> Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com>
> ---
>  commands/nandtest.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/commands/nandtest.c b/commands/nandtest.c
> index 1bb59c7fd..4a7db9cc7 100644
> --- a/commands/nandtest.c
> +++ b/commands/nandtest.c
> @@ -169,8 +169,10 @@ static int erase_and_write(loff_t ofs, unsigned char *data,
>  		printf("\ncompare failed. seed %d\n", seed);
>  		for (i = 0; i < meminfo.erasesize; i++) {
>  			if (data[i] != rbuf[i])
> -				printf("Byte 0x%x is %02x should be %02x\n",
> -				       i, rbuf[i], data[i]);
> +				printf("Block 0x%llx byte 0x%0x (page 0x%x offset 0x%x) is %02x should be %02x\n",
> +				       div64_ul(ofs, meminfo.erasesize), i,
> +				       i / meminfo.writesize, i % meminfo.writesize,
> +				       rbuf[i], data[i]);
>  		}
>  		return ret;
>  	}
> -- 
> 2.31.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


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

end of thread, other threads:[~2021-10-12  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 19:07 [PATCH] nandtest: Add more fields when bad byte found Trent Piepho
2021-10-12  7:46 ` Sascha Hauer

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