mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 09:54:35 +00:00
i2c: correct I2C deblock logic
Current code use dm_gpio_get_value() to get SDA and SCL value, and the
value depends on whether DTS file config the GPIO_ACTIVE_LOW. In ususal
case for i2c GPIO, DTS need to set GPIO_ACTIVE_LOW for SCL/SDA pins. So
here the logic is not correct.
And we must not use GPIOD_ACTIVE_LOW in client code include the
dm_gpio_set_dir_flags(), it is DTS's responsibility for this flag. So
remove GPIOD_ACTIVE_LOW here.
Fixes: aa54192d4a
("dm: i2c: implement gpio-based I2C deblock")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Alexander Kochetkov <al.kochet@gmail.com <mailto:al.kochet@gmail.com>>
This commit is contained in:
parent
d600b0fcbb
commit
7f6a2e6e0f
1 changed files with 2 additions and 2 deletions
|
@ -508,13 +508,13 @@ static void i2c_gpio_set_pin(struct gpio_desc *pin, int bit)
|
||||||
dm_gpio_set_dir_flags(pin, GPIOD_IS_IN);
|
dm_gpio_set_dir_flags(pin, GPIOD_IS_IN);
|
||||||
else
|
else
|
||||||
dm_gpio_set_dir_flags(pin, GPIOD_IS_OUT |
|
dm_gpio_set_dir_flags(pin, GPIOD_IS_OUT |
|
||||||
GPIOD_ACTIVE_LOW |
|
|
||||||
GPIOD_IS_OUT_ACTIVE);
|
GPIOD_IS_OUT_ACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int i2c_gpio_get_pin(struct gpio_desc *pin)
|
static int i2c_gpio_get_pin(struct gpio_desc *pin)
|
||||||
{
|
{
|
||||||
return dm_gpio_get_value(pin);
|
/* DTS need config GPIO_ACTIVE_LOW */
|
||||||
|
return !dm_gpio_get_value(pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
int i2c_deblock_gpio_loop(struct gpio_desc *sda_pin,
|
int i2c_deblock_gpio_loop(struct gpio_desc *sda_pin,
|
||||||
|
|
Loading…
Add table
Reference in a new issue