Skip to contentSkip to conversation

nand_spl: nand_boot.c: Remove CONFIG_SYS_NAND_READ_DELAY

PATCH New Stefan Roese 3 participants 3 messages May 4, 2011 – May 13, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nand_spl: nand_boot.c: Remove CONFIG_SYS_NAND_READ_DELAY

There are multiple reasons why this define should be removed:

First it saves some space and therefore fixes a problem we have on the canyonlands_nand and glacier_nand targets right now.

Second, the define was hackish and would most likely not work on all board using nand_boot.c. Boards not providing a real dev_ready() function should implement a board specific function instead.

I checked and it seems, that all boards using nand_boot.c right now already implement a board specific dev_ready() function. So this patch should not break any boards and will result in smaller NAND_SPL images.

Cc Scott Wood <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Sughosh Ganu <[email protected]>
Cc Sudhakar Rajashekhara <[email protected]>
---
 nand_spl/nand_boot.c |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)
nand_spl/nand_boot.c +6 -18
index 4a96878..cefeb91 100644
@@ -22,9 +22,6 @@
 #include <nand.h>
 #include <asm/io.h>
 
-#define CONFIG_SYS_NAND_READ_DELAY \
-	{ volatile int dummy; int i; for (i=0; i<10000; i++) dummy = i; }
-
 static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
 
 #if (CONFIG_SYS_NAND_PAGE_SIZE <= 512)
@@ -61,11 +58,8 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8
 	/*
 	 * Wait a while for the data to be ready
 	 */
-	if (this->dev_ready)
-		while (!this->dev_ready(mtd))
-			;
-	else
-		CONFIG_SYS_NAND_READ_DELAY;
+	while (!this->dev_ready(mtd))
+		;
 
 	return 0;
 }
@@ -78,11 +72,8 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8
 	struct nand_chip *this = mtd->priv;
 	int page_addr = page + block * CONFIG_SYS_NAND_PAGE_COUNT;
 
-	if (this->dev_ready)
-		while (!this->dev_ready(mtd))
-			;
-	else
-		CONFIG_SYS_NAND_READ_DELAY;
+	while (!this->dev_ready(mtd))
+		;
 
 	/* Emulate NAND_CMD_READOOB */
 	if (cmd == NAND_CMD_READOOB) {
@@ -118,11 +109,8 @@ static int nand_command(struct mtd_info *mtd, int block, int page, int offs, u8
 	/*
 	 * Wait a while for the data to be ready
 	 */
-	if (this->dev_ready)
-		while (!this->dev_ready(mtd))
-			;
-	else
-		CONFIG_SYS_NAND_READ_DELAY;
+	while (!this->dev_ready(mtd))
+		;
 
 	return 0;
 }
Signature · 1 line
1.7.5
#1 lore raw

PATCH 1/1 nand_spl: nand_boot.c: Remove CONFIG_SYS_NAND_READ_DELAY

hi Stefan,

Quoted 5 lines · Stefan Roese

There are multiple reasons why this define should be removed:

First it saves some space and therefore fixes a problem we have on the canyonlands_nand and glacier_nand targets right now.

Quoted 8 lines

Second, the define was hackish and would most likely not work on all board using nand_boot.c. Boards not providing a real dev_ready() function should implement a board specific function instead.

I checked and it seems, that all boards using nand_boot.c right now already implement a board specific dev_ready() function. So this patch should not break any boards and will result in smaller NAND_SPL images.

Tested on hawkboard, nand_spl and u-boot images boots fine.

-sughosh

#2 lore raw

PATCH 1/1 nand_spl: nand_boot.c: Remove CONFIG_SYS_NAND_READ_DELAY

In reply to Stefan Roese
Quoted 14 lines · Stefan Roese

There are multiple reasons why this define should be removed:

First it saves some space and therefore fixes a problem we have on the canyonlands_nand and glacier_nand targets right now.

Second, the define was hackish and would most likely not work on all board using nand_boot.c. Boards not providing a real dev_ready() function should implement a board specific function instead.

I checked and it seems, that all boards using nand_boot.c right now already implement a board specific dev_ready() function. So this patch should not break any boards and will result in smaller NAND_SPL images.

Quoted 8 lines
Cc Scott Wood <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Sughosh Ganu <[email protected]>
Cc Sudhakar Rajashekhara <[email protected]>
---
 nand_spl/nand_boot.c |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)

Applied to u-boot-nand-flash

-Scott