struct gpio_desc *sda = &bus->gpios[PIN_SDA];
if (bit)
- dm_gpio_set_dir_flags(sda, GPIOD_IS_IN);
+ sda->flags = (sda->flags & ~GPIOD_IS_OUT) | GPIOD_IS_IN;
else
- dm_gpio_set_dir_flags(sda, GPIOD_IS_OUT);
+ sda->flags = (sda->flags & (~GPIOD_IS_IN & ~GPIOD_IS_OUT_ACTIVE)) | GPIOD_IS_OUT;
+ dm_gpio_set_dir(sda);
}
static void i2c_gpio_scl_set(struct i2c_gpio_bus *bus, int bit)
int count = 0;
if (bit) {
- dm_gpio_set_dir_flags(scl, GPIOD_IS_IN);
+ scl->flags = (scl->flags & ~GPIOD_IS_OUT) | GPIOD_IS_IN;
+ dm_gpio_set_dir(scl);
while (!dm_gpio_get_value(scl) && count++ < 100000)
udelay(1);
if (!dm_gpio_get_value(scl))
pr_err("timeout waiting on slave to release scl\n");
} else {
- dm_gpio_set_dir_flags(scl, GPIOD_IS_OUT);
+ scl->flags = (scl->flags & (~GPIOD_IS_IN & ~GPIOD_IS_OUT_ACTIVE)) | GPIOD_IS_OUT;
+ dm_gpio_set_dir(scl);
}
}
static void i2c_gpio_scl_set_output_only(struct i2c_gpio_bus *bus, int bit)
{
struct gpio_desc *scl = &bus->gpios[PIN_SCL];
- ulong flags = GPIOD_IS_OUT;
+ scl->flags = (scl->flags & (~GPIOD_IS_IN & ~GPIOD_IS_OUT_ACTIVE)) | GPIOD_IS_OUT;
if (bit)
- flags |= GPIOD_IS_OUT_ACTIVE;
- dm_gpio_set_dir_flags(scl, flags);
+ scl->flags |= GPIOD_IS_OUT_ACTIVE;
+ dm_gpio_set_dir(scl);
}
static void i2c_gpio_write_bit(struct i2c_gpio_bus *bus, int delay, uchar bit)