[U-Boot] [PATCH 1/3] mpc5200: do not use printf in i2c_init()

Jon Smirl jonsmirl at gmail.com
Sat Mar 21 21:39:56 CET 2009


On Sat, Mar 21, 2009 at 3:47 PM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Jon,
>
> In message <20090321133844.11905.61201.stgit at localhost> you wrote:
>> From: Sascha Hauer <s.hauer at pengutronix.de>
>>
>> On boards which have the environment in eeprom, i2c_init()
>> is called before the console and ram is initialized. Do
>> not printf here.
>>
>> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
>> ---
>>  cpu/mpc5xxx/i2c.c |   10 ----------
>>  1 files changed, 0 insertions(+), 10 deletions(-)
>
> Rather than doing this unconditionally, this change should only be
> implemented on boards which actually hold the envrionment in I2C
> EEPROM (alternatively, one should consider fixing these boards to use
> more appropriate storage; in addition to being not reliable, I2C
> EEPROM is slow - see
> http://www.denx.de/wiki/DULG/AN2004_11_BootTimeOptimization )
>

How about this instead?  Is there a variable that indicates when the
console is safe to use, if so I can adjust the macro.

From: Jon Smirl <jonsmirl at gmail.com>

On boards which have the environment in eeprom, i2c_init()
is called before the console and ram is initialized. Do
not printf here.

Signed-off-by: Jon Smirl <jonsmirl at gmail.com>
---
 cpu/mpc5xxx/i2c.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/cpu/mpc5xxx/i2c.c b/cpu/mpc5xxx/i2c.c
index 7d76274..40f1682 100644
--- a/cpu/mpc5xxx/i2c.c
+++ b/cpu/mpc5xxx/i2c.c
@@ -41,6 +41,13 @@ DECLARE_GLOBAL_DATA_PTR;
 #define I2C_TIMEOUT	100
 #define I2C_RETRIES	3

+#ifdef CONFIG_ENV_IS_IN_EEPROM
+/* On boards which have the environment in eeprom, i2c_init()
+ * is called before the console and ram is initialized. Do
+ * not printf here. */
+#define printf(format, arg...) do {} while (0)
+#endif
+
 struct mpc5xxx_i2c_tap {
 	int scl2tap;
 	int tap2tap;


-- 
Jon Smirl
jonsmirl at gmail.com


More information about the U-Boot mailing list