summaryrefslogtreecommitdiff
path: root/include/i2c.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-07-02 18:15:42 -0600
committerSimon Glass <sjg@chromium.org>2015-08-05 20:57:51 -0600
commitdf358c6beca8f7cc2f2b67c54f0bf255ebd5cc22 (patch)
tree702662e59c25602e3c8820742ce85c9506d410ba /include/i2c.h
parent7fc65bcf8a0a5463db86efbb273a40448c845efc (diff)
downloadu-boot-imx-df358c6beca8f7cc2f2b67c54f0bf255ebd5cc22.zip
u-boot-imx-df358c6beca8f7cc2f2b67c54f0bf255ebd5cc22.tar.gz
u-boot-imx-df358c6beca8f7cc2f2b67c54f0bf255ebd5cc22.tar.bz2
dm: i2c: Add a function to transfer messages
Sometimes it is useful to be able to transfer a raw I2C message. This happens when the chip address needs to be set manually, or when the data to be sent/received is in another buffer. Add a function to provide access to this. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'include/i2c.h')
-rw-r--r--include/i2c.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/i2c.h b/include/i2c.h
index 4c0e263..d191829 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -191,6 +191,19 @@ int dm_i2c_reg_read(struct udevice *dev, uint offset);
int dm_i2c_reg_write(struct udevice *dev, uint offset, unsigned int val);
/**
+ * dm_i2c_xfer() - Transfer messages over I2C
+ *
+ * This transfers a raw message. It is best to use dm_i2c_reg_read/write()
+ * instead.
+ *
+ * @dev: Device to use for transfer
+ * @msg: List of messages to transfer
+ * @nmsgs: Number of messages to transfer
+ * @return 0 on success, -ve on error
+ */
+int dm_i2c_xfer(struct udevice *dev, struct i2c_msg *msg, int nmsgs);
+
+/**
* dm_i2c_set_bus_speed() - set the speed of a bus
*
* @bus: Bus to adjust