]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/i2c/i2c-uclass-compat.c
Remove CONFIG_SYS_BOOTCOUNT_SINGLEWORD
[people/ms/u-boot.git] / drivers / i2c / i2c-uclass-compat.c
index 223f238f4bed0cc475743c94931ed25fd2a2427b..de78db6a887f3a4bc74a0486e2ee634c98775057 100644 (file)
@@ -9,7 +9,7 @@
 #include <errno.h>
 #include <i2c.h>
 
-static int cur_busnum;
+static int cur_busnum __attribute__((section(".data")));
 
 static int i2c_compat_get_device(uint chip_addr, int alen,
                                 struct udevice **devp)
@@ -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);
+}