Skip to contentSkip to conversation

i2c, dtt: move dtt_init () to board_init_r ()

PATCH New Heiko Schocher 3 participants 4 messages Feb 24, 2009 – Feb 25, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/7 i2c, dtt: move dtt_init () to board_init_r ()

In case where a board not uses CONFIG_POST, it is not necessary to init the DTTs when running from flash.

---
 lib_ppc/board.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib_ppc/board.c +4 -1
index 3bcfb45..375b091 100644
@@ -339,10 +339,10 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_HARD_SPI)
 	init_func_spi,
 #endif
+#ifdef CONFIG_POST
 #if defined(CONFIG_DTT)		/* Digital Thermometers and Thermostats */
 	dtt_init,
 #endif
-#ifdef CONFIG_POST
 	post_init_f,
 #endif
 	INIT_FUNC_WATCHDOG_RESET
@@ -1072,6 +1072,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	WATCHDOG_RESET ();
 
+#if defined(CONFIG_DTT) && !defined(CONFIG_POST)
+	dtt_init ();
+#endif
 #if defined(CONFIG_CMD_SCSI)
 	WATCHDOG_RESET ();
 	puts ("SCSI:  ");
Signature · 5 lines
1.6.0.6

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#1 lore raw

PATCH v4 1/7 i2c, dtt: move dtt_init () to board_init_r ()

Hi Heiko,

Quoted 25 lines · Heiko Schocher

In case where a board not uses CONFIG_POST, it is not necessary to init the DTTs when running from flash.

---
 lib_ppc/board.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib_ppc/board.c +1 -1
index 3bcfb45..375b091 100644
@@ -339,10 +339,10 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_HARD_SPI)
 	init_func_spi,
 #endif
+#ifdef CONFIG_POST
 #if defined(CONFIG_DTT)		/* Digital Thermometers and Thermostats */
 	dtt_init,
 #endif
-#ifdef CONFIG_POST
 	post_init_f,
 #endif
 	INIT_FUNC_WATCHDOG_RESET

lib_ppc/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 1080

Quoted 9 lines
lib_ppc/board.c +3 -0
@@ -1072,6 +1072,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	WATCHDOG_RESET ();
 
+#if defined(CONFIG_DTT) && !defined(CONFIG_POST)
+	dtt_init ();
+#endif
 #if defined(CONFIG_CMD_SCSI)
 	WATCHDOG_RESET ();
 	puts ("SCSI:  ");

Is there a reason we can't just move the dtt_init() call to after relocation to RAM for both the cases with and without CONFIG_POST defined? If some POST relies on the temperature sensors being initialized it seems cleaner to change the POST to run after relocation than add more ifdefery to common code.

Unconditionally moving dtt_init() to after relocation would also allow dtt drivers to use global variables, etc (which it just so happens an lm90-type driver I'm working on requires:).

Best,
Peter

#2 lore raw

PATCH v4 1/7 i2c, dtt: move dtt_init () to board_init_r ()

Dear Peter Tyser,

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

Is there a reason we can't just move the dtt_init() call to after relocation to RAM for both the cases with and without CONFIG_POST defined? If some POST relies on the temperature sensors being initialized it seems cleaner to change the POST to run after relocation than add more ifdefery to common code.

The only temperature dependent code I am aware of in the POST context does not make use of the DTT code, so moving DTT initialization after relocation to RAM should not be a problem.

Quoted 3 lines

Unconditionally moving dtt_init() to after relocation would also allow dtt drivers to use global variables, etc (which it just so happens an lm90-type driver I'm working on requires:).

Agreed.

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
The inappropriate cannot be beautiful.
             - Frank Lloyd Wright _The Future of Architecture_ (1953)
#3 lore raw

PATCH v4 1/7 i2c, dtt: move dtt_init () to board_init_r ()

In reply to Peter Tyser

Hello Peter,

Quoted 29 lines · Peter Tyser
Quoted 28 lines · Heiko Schocher

In case where a board not uses CONFIG_POST, it is not necessary to init the DTTs when running from flash.

---
 lib_ppc/board.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
lib_ppc/board.c +1 -1
index 3bcfb45..375b091 100644
@@ -339,10 +339,10 @@ init_fnc_t *init_sequence[] = {
 #if defined(CONFIG_HARD_SPI)
 	init_func_spi,
 #endif
+#ifdef CONFIG_POST
 #if defined(CONFIG_DTT)		/* Digital Thermometers and Thermostats */
 	dtt_init,
 #endif
-#ifdef CONFIG_POST
 	post_init_f,
 #endif
 	INIT_FUNC_WATCHDOG_RESET
@@ -1072,6 +1072,9 @@ void board_init_r (gd_t *id, ulong dest_addr)
 
 	WATCHDOG_RESET ();
 
Quoted 12 lines

lib_ppc/board.c void board_init_r (gd_t *id, ulong dest_addr) · line 1080

Quoted 6 lines
lib_ppc/board.c +3 -0
+#if defined(CONFIG_DTT) && !defined(CONFIG_POST)
+	dtt_init ();
+#endif
 #if defined(CONFIG_CMD_SCSI)
 	WATCHDOG_RESET ();
 	puts ("SCSI:  ");

Is there a reason we can't just move the dtt_init() call to after relocation to RAM for both the cases with and without CONFIG_POST defined? If some POST relies on the temperature sensors being initialized it seems cleaner to change the POST to run after relocation than add more ifdefery to common code.

Ok, you are right, there is no reason (I searched for POST_ROM, and there is no test which uses i2c when running from flash, so dtt_init() can go completly to board_init_r ()

Quoted 3 lines

Unconditionally moving dtt_init() to after relocation would also allow dtt drivers to use global variables, etc (which it just so happens an lm90-type driver I'm working on requires:).

:-)

bye
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany