aboutsummaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorstroese <stroese>2004-07-02 14:37:04 +0000
committerstroese <stroese>2004-07-02 14:37:04 +0000
commit2c96baa2a40b4c955e07194bdad21aac98c53768 (patch)
treef6bf2bbcf8bbc82b127cec0173b0e7c7236cf251 /cpu
parent18f71f27aea4b10c7cb53731a5d401c5a78027fc (diff)
Fix problem in 405 i2c driver; don't try to print without console!
Diffstat (limited to 'cpu')
-rw-r--r--cpu/ppc4xx/i2c.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpu/ppc4xx/i2c.c b/cpu/ppc4xx/i2c.c
index 099d30a05..3a644a4cc 100644
--- a/cpu/ppc4xx/i2c.c
+++ b/cpu/ppc4xx/i2c.c
@@ -350,6 +350,7 @@ int i2c_read (uchar chip, uint addr, int alen, uchar * buffer, int len)
{
uchar xaddr[4];
int ret;
+ DECLARE_GLOBAL_DATA_PTR;
if ( alen > 4 ) {
printf ("I2C read: addr len %d not supported\n", alen);
@@ -380,7 +381,8 @@ int i2c_read (uchar chip, uint addr, int alen, uchar * buffer, int len)
chip |= ((addr >> (alen * 8)) & CFG_I2C_EEPROM_ADDR_OVERFLOW);
#endif
if( (ret = i2c_transfer( 1, chip<<1, &xaddr[4-alen], alen, buffer, len )) != 0) {
- printf( "I2c read: failed %d\n", ret);
+ if (gd->have_console)
+ printf( "I2c read: failed %d\n", ret);
return 1;
}
return 0;