Hi,

I have rebased the patch to the latest git.

Regards michael


Andy Green wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Somebody in the thread at some point said:
| Hi,
|
| This patch fix the bad block skipping code.

Hi Michael -

I couldn't get your patch to apply to current U-Boot sources.  I
upleveled everything and I still can't get it to apply, I guess the
patch is against an older version of U-Boot sources.

I eyeballed the patch and the code, but it is quite different now from
what the patch compares against.

Can you please take a look at current git
./cpu/arm920t/s3c24x0/nand_read.c and make your change again?  I did not
see anything in the current code with + 5 and so on, but maybe it is
fixed another way.

git clone git://git.openmoko.org/git/u-boot.git u-boot
git checkout origin/stable

Thanks.

- -Andy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkf/bjEACgkQOjLpvpq7dMphQgCbB/iRqdYD7ah5mJtSWP/jEf2j
h5QAnRbxB6TshUzfT5d9+aHCmhuopKLJ
=DQ7E
-----END PGP SIGNATURE-----


Change the skip bad block. Avoid false positives by only checking 
the beginning of a block and check the second page

Signed-off-by: michael <[EMAIL PROTECTED]>

---
 cpu/arm920t/s3c24x0/nand_read.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/cpu/arm920t/s3c24x0/nand_read.c b/cpu/arm920t/s3c24x0/nand_read.c
index 8a7cbd3..7080ce7 100644
--- a/cpu/arm920t/s3c24x0/nand_read.c
+++ b/cpu/arm920t/s3c24x0/nand_read.c
@@ -59,7 +59,7 @@ static inline void nand_wait(void)
 #if defined(CONFIG_S3C2410)
 /* configuration for 2410 with 512byte sized flash */
 #define NAND_PAGE_SIZE		512
-#define BAD_BLOCK_OFFSET	517
+#define BAD_BLOCK_OFFSET	5
 #define NAND_BLOCK_MASK		(NAND_PAGE_SIZE - 1)
 #define NAND_BLOCK_SIZE		0x4000
 #else
@@ -81,8 +81,6 @@ static int is_bad_block(unsigned long i)
 	unsigned char data;
 	unsigned long page_num;
 
-	/* FIXME: do this twice, for first and second page in block */
-
 	nand_clear_RnB();
 #if (NAND_PAGE_SIZE == 512)
 	NFCMD = NAND_CMD_READOOB; /* 0x50 */
@@ -167,8 +165,9 @@ int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
 
 	for (i=start_addr; i < (start_addr + size);) {
 #ifdef CONFIG_S3C2410_NAND_SKIP_BAD
-		if (start_addr % NAND_BLOCK_SIZE == 0) {
-			if (is_bad_block(i)) {
+		if (i % NAND_BLOCK_SIZE == 0) {
+			if (is_bad_block(i) ||
+			    is_bad_block(i + NAND_PAGE_SIZE)) {
 				/* Bad block */
 				i += NAND_BLOCK_SIZE;
 				size += NAND_BLOCK_SIZE;
-- 
1.5.3.6

Reply via email to