summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2015-04-26 11:05:38 +0800
committerSimon Glass <sjg@chromium.org>2015-05-05 20:58:41 -0600
commit76382aa2ce811d4bb53f8c617590fb36681ce169 (patch)
tree448f8ee1ad30dcd875bc0474ba1a91e1bc3b4517 /drivers/i2c
parent4772511475ce9221a040142eb808fa963024598f (diff)
downloadu-boot-imx-76382aa2ce811d4bb53f8c617590fb36681ce169.zip
u-boot-imx-76382aa2ce811d4bb53f8c617590fb36681ce169.tar.gz
u-boot-imx-76382aa2ce811d4bb53f8c617590fb36681ce169.tar.bz2
dm: i2c-gpio: Remove redundant dm_gpio_set_value() call
dm_gpio_set_dir_flags() will also set gpio output value when switching to gpio output. So it's not necessary to call dm_gpio_set_value() after dm_gpio_set_dir_flags() call. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-gpio.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c
index ed899d4..a8b83c5 100644
--- a/drivers/i2c/i2c-gpio.c
+++ b/drivers/i2c/i2c-gpio.c
@@ -41,18 +41,19 @@ static int i2c_gpio_sda_get(struct gpio_desc *sda)
static void i2c_gpio_sda_set(struct gpio_desc *sda, int bit)
{
- if (bit) {
+ if (bit)
dm_gpio_set_dir_flags(sda, GPIOD_IS_IN);
- } else {
+ else
dm_gpio_set_dir_flags(sda, GPIOD_IS_OUT);
- dm_gpio_set_value(sda, 0);
- }
}
static void i2c_gpio_scl_set(struct gpio_desc *scl, int bit)
{
- dm_gpio_set_dir_flags(scl, GPIOD_IS_OUT);
- dm_gpio_set_value(scl, bit);
+ ulong flags = GPIOD_IS_OUT;
+
+ if (bit)
+ flags |= GPIOD_IS_OUT_ACTIVE;
+ dm_gpio_set_dir_flags(scl, flags);
}
static void i2c_gpio_write_bit(struct gpio_desc *scl, struct gpio_desc *sda,