[U-Boot] [PATCH 20/55] dm: exynos: gpio: Support pull-up/down in GPIOs

Simon Glass sjg at chromium.org
Fri Jul 3 02:15:57 CEST 2015


Add support for pull direction to the exynos GPIO driver.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/gpio/s5p_gpio.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index 49b1054..b516968 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -261,6 +261,20 @@ void gpio_set_rate(int gpio, int mode)
 			  s5p_gpio_get_pin(gpio), mode);
 }
 
+int exynos_set_pull(struct udevice *dev, unsigned offset, enum gpio_pull pull)
+{
+	struct exynos_bank_info *state = dev_get_priv(dev);
+	int val = S5P_GPIO_PULL_NONE;
+
+	if (pull == GPIO_PULL_DOWN)
+		val = S5P_GPIO_PULL_DOWN;
+	else if (pull == GPIO_PULL_UP)
+		val = S5P_GPIO_PULL_UP;
+	s5p_gpio_set_pull(state->bank, offset, val);
+
+	return 0;
+}
+
 #ifndef CONFIG_SPL_BUILD
 static int exynos_gpio_get_function(struct udevice *dev, unsigned offset)
 {
@@ -290,6 +304,7 @@ static const struct dm_gpio_ops gpio_exynos_ops = {
 	.direction_output	= exynos_gpio_direction_output,
 	.get_value		= exynos_gpio_get_value,
 	.set_value		= exynos_gpio_set_value,
+	.set_pull		= exynos_set_pull,
 	.get_function		= exynos_gpio_get_function,
 	.xlate			= exynos_gpio_xlate,
 };
-- 
2.4.3.573.g4eafbef



More information about the U-Boot mailing list