mxc_i2c.c: code i2c_probe as a 0 length i2c_write
authorTroy Kisky <troy.kisky@boundarydevices.com>
Thu, 19 Jul 2012 08:18:08 +0000 (08:18 +0000)
committerHeiko Schocher <hs@denx.de>
Tue, 31 Jul 2012 05:43:51 +0000 (07:43 +0200)
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Acked-by: Marek Vasut <marex@denx.de>
Acked-by: Stefano Babic <sbabic@denx.de>
drivers/i2c/mxc_i2c.c

index 55a688a80282cba2dec42c0f5a8f9d56dde66f48..626e13eb11e7347f0a8d54e151b0279d2793b274 100644 (file)
@@ -301,23 +301,6 @@ exit:
        return ret;
 }
 
-/*
- * Try if a chip add given address responds (probe the chip)
- */
-int i2c_probe(uchar chip)
-{
-       struct mxc_i2c_regs *i2c_regs = (struct mxc_i2c_regs *)I2C_BASE;
-       int ret;
-
-       ret = i2c_imx_start();
-       if (ret)
-               return ret;
-
-       ret = tx_byte(i2c_regs, chip << 1);
-       i2c_imx_stop();
-       return ret;
-}
-
 /*
  * Read data from I2C device
  */
@@ -406,3 +389,11 @@ int i2c_write(uchar chip, uint addr, int alen, uchar *buf, int len)
 
        return ret;
 }
+
+/*
+ * Test if a chip at a given address responds (probe the chip)
+ */
+int i2c_probe(uchar chip)
+{
+       return i2c_write(chip, 0, 0, NULL, 0);
+}