summaryrefslogtreecommitdiff
path: root/drivers/i2c/i2c-uclass-compat.c
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2015-06-15 12:08:11 +0200
committerStefano Babic <sbabic@denx.de>2015-06-15 12:08:11 +0200
commit212b66016120fa4cd3b8f7edbe4c9f106032884e (patch)
treef956cd9195952c7890493897a9c2108a8ee852d7 /drivers/i2c/i2c-uclass-compat.c
parentb31fb4b97b4d9c9fcf5a50c39d5d2c277f7008c9 (diff)
parent64d16706a052553c85d2f8f4c741879a4e3e6116 (diff)
Merge branch 'master' of git://git.denx.de/u-boot
Diffstat (limited to 'drivers/i2c/i2c-uclass-compat.c')
-rw-r--r--drivers/i2c/i2c-uclass-compat.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-uclass-compat.c b/drivers/i2c/i2c-uclass-compat.c
index 223f238f4b..5606d1f807 100644
--- a/drivers/i2c/i2c-uclass-compat.c
+++ b/drivers/i2c/i2c-uclass-compat.c
@@ -106,3 +106,24 @@ void board_i2c_init(const void *blob)
{
/* Nothing to do here - the init happens through driver model */
}
+
+uint8_t i2c_reg_read(uint8_t chip_addr, uint8_t offset)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = i2c_compat_get_device(chip_addr, 1, &dev);
+ if (ret)
+ return 0xff;
+ return dm_i2c_reg_read(dev, offset);
+}
+
+void i2c_reg_write(uint8_t chip_addr, uint8_t offset, uint8_t val)
+{
+ struct udevice *dev;
+ int ret;
+
+ ret = i2c_compat_get_device(chip_addr, 1, &dev);
+ if (!ret)
+ dm_i2c_reg_write(dev, offset, val);
+}