Skip to contentSkip to conversation

nand: allow delayed initialization

RFC PATCH Superseded Mike Frysinger 3 participants 19 messages Sep 21, 2010 – Oct 10, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 nand: allow delayed initialization

Many people like the current nand_init() behavior where it is always initialized during boot and the flash size shown, but there are cases where we are willing to forgo this niceness for speed/functionality. So rather than change the default, introduce a delayed config option people may enable. This way the nand is only poked when someone tries to actually use it.

---
note: i havent documented this in the README yet as i want to get
feedback on the approach first

 common/cmd_nand.c       |    2 ++
 common/env_nand.c       |    8 ++++++++
 drivers/mtd/nand/nand.c |    9 +++++++++
 include/nand.h          |    5 +++++
 4 files changed, 24 insertions(+), 0 deletions(-)
common/cmd_nand.c +2 -0
index f611fd7..ed3ca54 100644
@@ -222,6 +222,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 	if (argc < 2)
 		goto usage;
 
+	nand_delayed_init();
+
 	if (quiet_str)
 		quiet = simple_strtoul(quiet_str, NULL, 0) != 0;
 
common/env_nand.c +8 -0
index 99f661e..e8be67b 100644
@@ -307,6 +307,8 @@ void env_relocate_spec (void)
 		return use_default();
 	}
 
+	nand_delayed_init();
+
 	if (readenv(CONFIG_ENV_OFFSET, (u_char *) tmp_env1))
 		puts("No Valid Environment Area Found\n");
 	if (readenv(CONFIG_ENV_OFFSET_REDUND, (u_char *) tmp_env2))
@@ -347,6 +349,8 @@ void env_relocate_spec (void)
 		free(tmp_env1);
 	}
 
+#else
+	nand_delayed_init();
 #endif /* ! ENV_IS_EMBEDDED */
 }
 #else /* ! CONFIG_ENV_OFFSET_REDUND */
@@ -359,12 +363,16 @@ void env_relocate_spec (void)
 #if !defined(ENV_IS_EMBEDDED)
 	int ret;
 
+	nand_delayed_init();
+
 	ret = readenv(CONFIG_ENV_OFFSET, (u_char *) env_ptr);
 	if (ret)
 		return use_default();
 
 	if (crc32(0, env_ptr->data, ENV_SIZE) != env_ptr->crc)
 		return use_default();
+#else
+	nand_delayed_init();
 #endif /* ! ENV_IS_EMBEDDED */
 }
 #endif /* CONFIG_ENV_OFFSET_REDUND */
drivers/mtd/nand/nand.c +9 -0
index 47d6872..42ec40a 100644
@@ -81,6 +81,15 @@ void nand_init(void)
 {
 	int i;
 	unsigned int size = 0;
+
+#ifdef CONFIG_SYS_NAND_DELAYED_INIT
+	static uint8_t initialized;
+	if (initialized)
+		return;
+	initialized = 1;
+	printf("Delayed NAND init: ");
+#endif
+
 	for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
 		nand_init_chip(&nand_info[i], &nand_chip[i], base_address[i]);
 		size += nand_info[i].size / 1024;
include/nand.h +5 -0
index 2a81597..939b8e7 100644
@@ -25,6 +25,11 @@
 #define _NAND_H_
 
 extern void nand_init(void);
+#ifdef CONFIG_SYS_NAND_DELAYED_INIT
+# define nand_delayed_init() nand_init()
+#else
+# define nand_delayed_init() do { } while (0)
+#endif
 
 #include <linux/mtd/compat.h>
 #include <linux/mtd/mtd.h>
Signature · 1 line
1.7.2.3
#1 lore raw

PATCH 2/2 Blackfin: nand: support delayed initialization

---
 arch/blackfin/lib/board.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/blackfin/lib/board.c +1 -1
index 7649f9a..02a5ee9 100644
@@ -346,7 +346,7 @@ void board_init_r(gd_t * id, ulong dest_addr)
 	bd->bi_flashoffset = 0;
 #endif
 
-#ifdef CONFIG_CMD_NAND
+#if defined(CONFIG_CMD_NAND) && !defined(CONFIG_SYS_NAND_DELAYED_INIT)
 	puts("NAND:  ");
 	nand_init();		/* go init the NAND */
 #endif
Signature · 1 line
1.7.2.3
#2 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

In reply to Mike Frysinger

Many people like the current nand_init() behavior where it is always initialized during boot and the flash size shown, but there are cases where we are willing to forgo this niceness for speed/functionality. So rather than change the default, introduce a delayed config option people may enable. This way the nand is only poked when someone tries to actually use it.

---
v2
- update to current mainline

 common/cmd_nand.c       |    2 ++
 common/env_nand.c       |    8 ++++++++
 drivers/mtd/nand/nand.c |    9 +++++++++
 include/nand.h          |    5 +++++
 4 files changed, 24 insertions(+), 0 deletions(-)
common/cmd_nand.c +2 -0
index 3f1d077..5409382 100644
@@ -309,6 +309,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 	if (argc < 2)
 		goto usage;
 
+	nand_delayed_init();
+
 	if (quiet_str)
 		quiet = simple_strtoul(quiet_str, NULL, 0) != 0;
 
common/env_nand.c +8 -0
index 4e8307a..3d80510 100644
@@ -359,6 +359,8 @@ void env_relocate_spec(void)
 		return;
 	}
 
+	nand_delayed_init();
+
 	if (readenv(CONFIG_ENV_OFFSET, (u_char *) tmp_env1))
 		puts("No Valid Environment Area found\n");
 
@@ -404,6 +406,8 @@ void env_relocate_spec(void)
 	free(tmp_env1);
 	free(tmp_env2);
 
+#else
+	nand_delayed_init();
 #endif /* ! ENV_IS_EMBEDDED */
 }
 #else /* ! CONFIG_ENV_OFFSET_REDUND */
@@ -418,6 +422,8 @@ void env_relocate_spec (void)
 	int ret;
 	char buf[CONFIG_ENV_SIZE];
 
+	nand_delayed_init();
+
 #if defined(CONFIG_ENV_OFFSET_OOB)
 	ret = get_nand_env_oob(&nand_info[0], &nand_env_oob_offset);
 	/*
@@ -439,6 +445,8 @@ void env_relocate_spec (void)
 	}
 
 	env_import(buf, 1);
+#else
+	nand_delayed_init();
 #endif /* ! ENV_IS_EMBEDDED */
 }
 #endif /* CONFIG_ENV_OFFSET_REDUND */
drivers/mtd/nand/nand.c +9 -0
index 47d6872..42ec40a 100644
@@ -81,6 +81,15 @@ void nand_init(void)
 {
 	int i;
 	unsigned int size = 0;
+
+#ifdef CONFIG_SYS_NAND_DELAYED_INIT
+	static uint8_t initialized;
+	if (initialized)
+		return;
+	initialized = 1;
+	printf("Delayed NAND init: ");
+#endif
+
 	for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
 		nand_init_chip(&nand_info[i], &nand_chip[i], base_address[i]);
 		size += nand_info[i].size / 1024;
include/nand.h +5 -0
index 8bdf419..74ef73f 100644
@@ -25,6 +25,11 @@
 #define _NAND_H_
 
 extern void nand_init(void);
+#ifdef CONFIG_SYS_NAND_DELAYED_INIT
+# define nand_delayed_init() nand_init()
+#else
+# define nand_delayed_init() do { } while (0)
+#endif
 
 #include <linux/mtd/compat.h>
 #include <linux/mtd/mtd.h>
Signature · 1 line
1.7.3.1
#3 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Dear Mike Frysinger,

Quoted 9 lines · In message <[email protected]> you wrote:

Many people like the current nand_init() behavior where it is always initialized during boot and the flash size shown, but there are cases where we are willing to forgo this niceness for speed/functionality. So rather than change the default, introduce a delayed config option people may enable. This way the nand is only poked when someone tries to actually use it.

---

...

include/nand.h line 32

Quoted 6 lines

extern void nand_init(void);

include/nand.h +5 -0
+#ifdef CONFIG_SYS_NAND_DELAYED_INIT
+# define nand_delayed_init() nand_init()
+#else
+# define nand_delayed_init() do { } while (0)
+#endif

Would it not be esier to rename your nand_delayed_init() into nand_init(), and add a "#ifndef CONFIG_SYS_NAND_DELAYED_INIT" around the current call to nand_init()?

Question: is there a risk of problems with boards that have the environment in NAND?

Best regards,

Wolfgang Denk

Signature · 4 lines
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
"Don't think; let the machine do it for you!"        - E. C. Berkeley
#4 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 10 lines · On Sunday, October 03, 2010 14:27:13 Wolfgang Denk wrote:
Quoted 9 lines · Mike Frysinger

Many people like the current nand_init() behavior where it is always initialized during boot and the flash size shown, but there are cases where we are willing to forgo this niceness for speed/functionality. So rather than change the default, introduce a delayed config option people may enable. This way the nand is only poked when someone tries to actually use it.

extern void nand_init(void);

Quoted 9 lines

include/nand.h line 32

Quoted 5 lines
include/nand.h +5 -0
+#ifdef CONFIG_SYS_NAND_DELAYED_INIT
+# define nand_delayed_init() nand_init()
+#else
+# define nand_delayed_init() do { } while (0)
+#endif

Would it not be esier to rename your nand_delayed_init() into nand_init(), and add a "#ifndef CONFIG_SYS_NAND_DELAYED_INIT" around the current call to nand_init()?

nand_init() cant handle being called multiple times. and i need to add more nand_init() points that only apply to when things are delayed. so when delayed init is not enabled (the default), there is no change in compiled code size.

Quoted 2 lines

Question: is there a risk of problems with boards that have the environment in NAND?

that's why my patch adds delayed init points to the major nand env entry points. my understanding is that these must be called before the env read/write funcs may be called.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101003/f2169123/attachment.pgp

#5 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Dear Mike Frysinger,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 4 lines

Would it not be esier to rename your nand_delayed_init() into nand_init(), and add a "#ifndef CONFIG_SYS_NAND_DELAYED_INIT" around the current call to nand_init()?

nand_init() cant handle being called multiple times. and i need to add more nand_init() points that only apply to when things are delayed. so when delayed init is not enabled (the default), there is no change in compiled code size.

Well, you have this in your new nand_init() code:

+ static uint8_t initialized;
+ if (initialized)
+ return;
+ initialized = 1;

Why cannot we call nand_init() multiple times, then?

Quoted 6 lines
Quoted 2 lines

Question: is there a risk of problems with boards that have the environment in NAND?

that's why my patch adds delayed init points to the major nand env entry points. my understanding is that these must be called before the env read/write funcs may be called.

OK, just wanted to make sure.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
"Everybody is talking about the  weather  but  nobody  does  anything
about it."                                               - Mark Twain
#6 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 17 lines · On Sunday, October 03, 2010 17:40:32 Wolfgang Denk wrote:
Quoted 8 lines · Mike Frysinger
Quoted 3 lines

Would it not be esier to rename your nand_delayed_init() into nand_init(), and add a "#ifndef CONFIG_SYS_NAND_DELAYED_INIT" around the current call to nand_init()?

nand_init() cant handle being called multiple times. and i need to add more nand_init() points that only apply to when things are delayed. so when delayed init is not enabled (the default), there is no change in compiled code size.

Well, you have this in your new nand_init() code:

drivers/mtd/nand/nand.c +4 -0
+	static uint8_t initialized;
+	if (initialized)
+		return;
+	initialized = 1;
Quoted 1 line

Why cannot we call nand_init() multiple times, then?

because of the whole of my statement. i did not want to affect code size if this option was disabled.

in a preious patch, i had the env code doing:

#ifdef CONFIG_SYS_NAND_DELAYED_INIT
	nand_init();

#endif

but i thought it made more sense to rework it so the #ifdef existed in one place (the header) and not in the source.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101003/0c40c8df/attachment.pgp

#7 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Dear Mike Frysinger,

Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Why cannot we call nand_init() multiple times, then?

because of the whole of my statement. i did not want to affect code size if this option was disabled.

Quoted 7 lines

in a preious patch, i had the env code doing:

#ifdef CONFIG_SYS_NAND_DELAYED_INIT
	nand_init();

#endif

but i thought it made more sense to rework it so the #ifdef existed in one> place (the header) and not in the source.

I'm not sure where we are with this.

Do you plan to post an update?

Best regards,

Wolfgang Denk

Signature · 6 lines
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
I am pleased to see that we have differences.  May we together become
greater than the sum of both of us.
	-- Surak of Vulcan, "The Savage Curtain", stardate 5906.4
#8 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 3 lines · On Wednesday, October 06, 2010 16:40:47 Wolfgang Denk wrote:

I'm not sure where we are with this.

Do you plan to post an update?

there isnt a clear indication of where to take this. seems like we want to do this, and we want it as the default moving forward, but we want all existing boards to be unchanged. so only reasonable way would be to invert the logic, add a define for the arch lib/board.c files, and then add that define to all existing boards.

call the new define CONFIG_NAND_EARLY_INIT ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101007/2c929629/attachment.pgp

#9 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Dear Mike Frysinger,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 2 lines

Do you plan to post an update?

there isnt a clear indication of where to take this. seems like we want to do this, and we want it as the default moving forward, but we want all existing boards to be unchanged. so only reasonable way would be to invert the logic, add a define for the arch lib/board.c files, and then add that define to all existing boards.

I don't think we want to modify 550+ Board configurations and re-test on that many boards...

I think we should rather enable the new feature by some #define, and recommend to enable this on new boards.

Quoted 1 line

call the new define CONFIG_NAND_EARLY_INIT ?

Fine with me.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Everyting looks interesting until you do it. Then you find it's  just
another job.                     - Terry Pratchett, _Moving Pictures_
#10 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 11 lines · On Thursday, October 07, 2010 15:35:44 Wolfgang Denk wrote:
Quoted 7 lines · Mike Frysinger
Quoted 1 line

Do you plan to post an update?

there isnt a clear indication of where to take this. seems like we want to do this, and we want it as the default moving forward, but we want all existing boards to be unchanged. so only reasonable way would be to invert the logic, add a define for the arch lib/board.c files, and then add that define to all existing boards.

I don't think we want to modify 550+ Board configurations and re-test on that many boards...

it would be ~100 boards. board_init() is only called when CONFIG_CMD_NAND is defined. so it should be as simple as:

	sed -i \
	'/define[[:space:]]*CONFIG_CMD_NAND/i#define CONFIG_NAND_EARLY_INIT' \
	include/configs/*
Quoted 2 lines

I think we should rather enable the new feature by some #define, and recommend to enable this on new boards.

problem with recommendations is that people dont notice them
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101007/1cac9095/attachment.pgp

#11 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 15 lines · On Thursday, October 07, 2010 17:26:55 Mike Frysinger wrote:
Quoted 11 lines · On Thursday, October 07, 2010 15:35:44 Wolfgang Denk wrote:
Quoted 7 lines · Mike Frysinger
Quoted 1 line

Do you plan to post an update?

there isnt a clear indication of where to take this. seems like we want to do this, and we want it as the default moving forward, but we want all existing boards to be unchanged. so only reasonable way would be to invert the logic, add a define for the arch lib/board.c files, and then add that define to all existing boards.

I don't think we want to modify 550+ Board configurations and re-test on that many boards...

it would be ~100 boards. board_init() is only called when CONFIG_CMD_NAND is defined. so it should be as simple as:

Quoted 8 lines
	sed -i \
	'/define[[:space:]]*CONFIG_CMD_NAND/i#define CONFIG_NAND_EARLY_INIT' \
	include/configs/*
Quoted 2 lines

I think we should rather enable the new feature by some #define, and recommend to enable this on new boards.

problem with recommendations is that people dont notice them

hmm, what about this scheme:
- add NAND_MAYBE_EARLY_INIT to include/config_defaults.h
- have nand_init() emit a #warning if NAND_MAYBE_EARLY_INIT is defined but
NAND_EARLY_INIT is not
- board porters add either "#define NAND_EARLY_INIT" or "#undef
NAND_MAYBE_EARLY_INIT" to their board config
- after a release or two, we set "#define NAND_EARLY_INIT" to any boards
where their maintainers did not step up and drop "NAND_MAYBE_EARLY_INIT" totally

this way, existing behavior is retained, board porters have an incentive to choose the desired behavior themselves (kill the #warning), and we have confidence that we didnt break (most) people.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101007/1b0878a2/attachment.pgp

#12 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 35 lines · Mike Frysinger
Quoted 19 lines · On Thursday, October 07, 2010 17:26:55 Mike Frysinger wrote:
Quoted 11 lines · On Thursday, October 07, 2010 15:35:44 Wolfgang Denk wrote:
Quoted 7 lines · Mike Frysinger
Quoted 1 line

Do you plan to post an update?

there isnt a clear indication of where to take this. ?seems like we want to do this, and we want it as the default moving forward, but we want all existing boards to be unchanged. ?so only reasonable way would be to invert the logic, add a define for the arch lib/board.c files, and then add that define to all existing boards.

I don't think we want to modify 550+ Board configurations and re-test on that many boards...

it would be ~100 boards. ?board_init() is only called when CONFIG_CMD_NAND is defined. ?so it should be as simple as:
? ? ? sed -i \
? ? ? '/define[[:space:]]*CONFIG_CMD_NAND/i#define CONFIG_NAND_EARLY_INIT' \
? ? ? include/configs/*

Quoted 4 lines
Quoted 2 lines

I think we should rather enable the new feature by some #define, and recommend to enable this on new boards.

problem with recommendations is that people dont notice them

hmm, what about this scheme:
?- add NAND_MAYBE_EARLY_INIT to include/config_defaults.h
?- have nand_init() emit a #warning if NAND_MAYBE_EARLY_INIT is defined but NAND_EARLY_INIT is not
?- board porters add either "#define NAND_EARLY_INIT" or "#undef NAND_MAYBE_EARLY_INIT" to their board config
?- after a release or two, we set "#define NAND_EARLY_INIT" to any boards where their maintainers did not step up and drop "NAND_MAYBE_EARLY_INIT" totally

Quoted 3 lines

this way, existing behavior is retained, board porters have an incentive to choose the desired behavior themselves (kill the #warning), and we have confidence that we didnt break (most) people.

btw, i'm waiting for you to OK this path before i code it up and post new patches ;)
-mike

#13 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Dear Mike Frysinger,

Quoted 7 lines · In message <[email protected]> you…
Quoted 4 lines

this way, existing behavior is retained, board porters have an incentive to choose the desired behavior themselves (kill the #warning), and we have confidence that we didnt break (most) people.

btw, i'm waiting for you to OK this path before i code it up and post new patches ;)

Yes, this is OK with me. [Please add an entry to
doc/feature-removal-schedule.txt as well.]

Best regards,

Wolfgang Denk

Signature · 5 lines
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
"Unix is simple, but it takes a genius to understand the simplicity."
					             - Dennis Ritchie
#14 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

In reply to Mike Frysinger
Quoted 1 line · On Sat, 2 Oct 2010 15:47:20 -0400 Mike Frysinger <[email protected]> wrote:

+#ifdef CONFIG_SYS_NAND_DELAYED_INIT

Seems like this should be CONFIG_ rather than CONFIG_SYS_.

I'm wondering if we should just make this the default behavior. We already deferred the bad block scanning, perhaps this could replace that.

-Scott

#15 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 3 lines · On Monday, October 04, 2010 13:36:14 Scott Wood wrote:

I'm wondering if we should just make this the default behavior. We already deferred the bad block scanning, perhaps this could replace that.

i would like that, but Wolfgang indicated in the past that the default behavior of detecting the nand flash & printing out its size was desirable. perhaps that stance is flexible ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101005/2bb1c284/attachment.pgp

#16 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 8 lines · On Tue, 5 Oct 2010 04:08:12 -0400 Mike Frysinger <[email protected]> wrote:
Quoted 3 lines · On Monday, October 04, 2010 13:36:14 Scott Wood wrote:

I'm wondering if we should just make this the default behavior. We already deferred the bad block scanning, perhaps this could replace that.

i would like that, but Wolfgang indicated in the past that the default behavior of detecting the nand flash & printing out its size was desirable. perhaps that stance is flexible ...

So much for "U-Boot doesn't initialize hardware that it doesn't use." :-)

-Scott

#17 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Dear Scott Wood,

Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 5 lines · On Tue, 5 Oct 2010 04:08:12 -0400 Mike Frysinger <[email protected]> wrote:
Quoted 3 lines · On Monday, October 04, 2010 13:36:14 Scott Wood wrote:

I'm wondering if we should just make this the default behavior. We already deferred the bad block scanning, perhaps this could replace that.

Quoted 5 lines
Quoted 3 lines

i would like that, but Wolfgang indicated in the past that the default behavior of detecting the nand flash & printing out its size was desirable. perhaps that stance is flexible ...

So much for "U-Boot doesn't initialize hardware that it doesn't use." :-)

U-Boot has a > 10 year long history. In that time we learned a lesson or two, and some things would today not be accepted any more that once seemed to be pretty innocent or even a clever thing.

I think the delayed initialization of NAND (or should we rather call it "on demand initialization" ?) is indeed a good thing, and a definite improvement.

If possible, I would like to see this the default setting for all new board to be added. Existing boards should have the option to select this behaviour, too.

What I do not want to do (if it can be avoided) is change the default behaviour of existing boards, i. e. I would like to leave this decision to the respective board maintainers (in the active opt-in sense).

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Too many people are ready to carry the stool when the piano needs  to
be moved.
#18 lore raw

RFC PATCH v2 1/2 nand: allow delayed initialization

Quoted 8 lines · On Tue, 5 Oct 2010 20:27:43 +0200 Wolfgang Denk <[email protected]> wrote:

If possible, I would like to see this the default setting for all new board to be added. Existing boards should have the option to select this behaviour, too.

What I do not want to do (if it can be avoided) is change the default behaviour of existing boards, i. e. I would like to leave this decision to the respective board maintainers (in the active opt-in sense).

Configurability and retaining existing behavior is good, but too much of it can leave the code a mess, especially when you get semi-redundant alternatives such as delaying everything or delaying just the bad block scan. Plus things like optional informative probing might be better triggered by a script rather than an ifdef.

I don't care that much either way, though -- if you want to keep this one as an ifdef, it's fine with me.

-Scott