Merge with /home/mk/8-benq/u-boot
[oweals/u-boot.git] / common / soft_i2c.c
index 268da2cdc4463fa1a4f5b5d6ac6faaf1a445b1fb..bffcd4405ec5bbe5d550ec471f6e5f4657bd33fa 100644 (file)
 
 /* #define     DEBUG_I2C       */
 
+#ifdef DEBUG_I2C
+DECLARE_GLOBAL_DATA_PTR;
+#endif
+
 
 /*-----------------------------------------------------------------------
  * Definitions
@@ -53,7 +57,6 @@
 
 #ifdef DEBUG_I2C
 #define PRINTD(fmt,args...)    do {    \
-       DECLARE_GLOBAL_DATA_PTR;        \
        if (gd->have_console)           \
                printf (fmt ,##args);   \
        } while (0)
@@ -164,13 +167,10 @@ static void send_ack(int ack)
        volatile immap_t *immr = (immap_t *)CFG_IMMR;
 #endif
 
-       I2C_ACTIVE;
        I2C_SCL(0);
        I2C_DELAY;
-
-       I2C_SDA(ack);
-
        I2C_ACTIVE;
+       I2C_SDA(ack);
        I2C_DELAY;
        I2C_SCL(1);
        I2C_DELAY;
@@ -289,7 +289,7 @@ int i2c_probe(uchar addr)
        int rc;
 
        /*
-        * perform 1 byte write transaction with just address byte 
+        * perform 1 byte write transaction with just address byte
         * (fake write)
         */
        send_start();