diff mbox

[U-Boot,v4,1/6] dm: i2c: Add u8 read/write i2c functions

Message ID 1474864510-8609-2-git-send-email-j-keerthy@ti.com
State Superseded
Delegated to: Przemyslaw Marczak
Headers show

Commit Message

J, KEERTHY Sept. 26, 2016, 4:35 a.m. UTC
Add u8 i2c read/write hooks.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
---
 drivers/i2c/i2c-uclass.c | 10 ++++++++++
 include/i2c.h            | 24 ++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

Comments

Simon Glass Sept. 27, 2016, 12:33 a.m. UTC | #1
On 25 September 2016 at 22:35, Keerthy <j-keerthy@ti.com> wrote:
> Add u8 i2c read/write hooks.
>
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>
> ---
>  drivers/i2c/i2c-uclass.c | 10 ++++++++++
>  include/i2c.h            | 24 ++++++++++++++++++++++++
>  2 files changed, 34 insertions(+)

Well, OK.

Reviewed-by: Simon Glass <sjg@chromium.org>
Keerthy Sept. 27, 2016, 3:37 a.m. UTC | #2
On Tuesday 27 September 2016 06:03 AM, Simon Glass wrote:
> On 25 September 2016 at 22:35, Keerthy <j-keerthy@ti.com> wrote:
>> Add u8 i2c read/write hooks.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> Reviewed-by: Tom Rini <trini@konsulko.com>
>> ---
>>  drivers/i2c/i2c-uclass.c | 10 ++++++++++
>>  include/i2c.h            | 24 ++++++++++++++++++++++++
>>  2 files changed, 34 insertions(+)
>
> Well, OK.
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Thanks Simon.

>
diff mbox

Patch

diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
index dbd3789..6ce5d9a 100644
--- a/drivers/i2c/i2c-uclass.c
+++ b/drivers/i2c/i2c-uclass.c
@@ -231,6 +231,16 @@  int dm_i2c_reg_write(struct udevice *dev, uint offset, uint value)
 	return dm_i2c_write(dev, offset, &val, 1);
 }
 
+int dm_i2c_u8_read(struct udevice *dev, uint offset, u8 *val)
+{
+	return dm_i2c_read(dev, offset, val, 1);
+}
+
+int dm_i2c_u8_write(struct udevice *dev, uint offset, u8 *val)
+{
+	return dm_i2c_write(dev, offset, val, 1);
+}
+
 /**
  * i2c_probe_chip() - probe for a chip on a bus
  *
diff --git a/include/i2c.h b/include/i2c.h
index d500445..c3059ad 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -191,6 +191,30 @@  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_u8_read() - Read a byte value from an I2C register
+ *
+ * This reads a single value from the given address in an I2C chip
+ *
+ * @dev:        Device to use for transfer
+ * @addr:       Address to read from
+ * @val:	Value read is stored in val
+ * @return 0 for success, -ve on error
+ */
+int dm_i2c_u8_read(struct udevice *dev, uint offset, u8 *val);
+
+/**
+ * dm_i2c_u8_write() - Write a byte value to an I2C register
+ *
+ * This writes a single value to the given address in an I2C chip
+ *
+ * @dev:        Device to use for transfer
+ * @addr:       Address to write to
+ * @val:        Value to write
+ * @return 0 on success, -ve on error
+ */
+int dm_i2c_u8_write(struct udevice *dev, uint offset, u8 *val);
+
+/**
  * dm_i2c_xfer() - Transfer messages over I2C
  *
  * This transfers a raw message. It is best to use dm_i2c_reg_read/write()