]> git.sur5r.net Git - u-boot/blobdiff - drivers/i2c/fsl_i2c.c
soft_i2c: move to drivers/i2c
[u-boot] / drivers / i2c / fsl_i2c.c
index 9d5df8ad2ff73c26d456b3b3865b17e92946113a..b7b3a75bc952700ef9a64e365281e75a09578d00 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <common.h>
 
-#ifdef CONFIG_FSL_I2C
 #ifdef CONFIG_HARD_I2C
 
 #include <command.h>
@@ -173,12 +172,11 @@ i2c_init(int speed, int slaveadd)
 static __inline__ int
 i2c_wait4bus(void)
 {
-       ulong timeval = get_timer(0);
+       unsigned long long timeval = get_ticks();
 
        while (readb(&i2c_dev[i2c_bus_num]->sr) & I2C_SR_MBB) {
-               if (get_timer(timeval) > I2C_TIMEOUT) {
+               if ((get_ticks() - timeval) > usec2ticks(I2C_TIMEOUT))
                        return -1;
-               }
        }
 
        return 0;
@@ -188,7 +186,7 @@ static __inline__ int
 i2c_wait(int write)
 {
        u32 csr;
-       ulong timeval = get_timer(0);
+       unsigned long long timeval = get_ticks();
 
        do {
                csr = readb(&i2c_dev[i2c_bus_num]->sr);
@@ -213,7 +211,7 @@ i2c_wait(int write)
                }
 
                return 0;
-       } while (get_timer (timeval) < I2C_TIMEOUT);
+       } while ((get_ticks() - timeval) < usec2ticks(I2C_TIMEOUT));
 
        debug("i2c_wait: timed out\n");
        return -1;
@@ -392,4 +390,3 @@ unsigned int i2c_get_bus_speed(void)
 }
 
 #endif /* CONFIG_HARD_I2C */
-#endif /* CONFIG_FSL_I2C */