[U-Boot] [PATCH 1/5] dm: sunxi: gpio: Add temporary implementation of name_to_gpio()

Simon Glass sjg at chromium.org
Sat Apr 18 19:33:43 CEST 2015


Until sunxi moves to device tree (e.g. for USB) we need to convert named
GPIOs to numbers. Add a function to do this.

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

 drivers/gpio/sunxi_gpio.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index cf5c624..e459895 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -172,6 +172,17 @@ int sunxi_name_to_gpio(const char *name)
 #endif
 
 #ifdef CONFIG_DM_GPIO
+/* TODO(sjg at chromium.org): Remove this function and use device tree */
+int sunxi_name_to_gpio(const char *name)
+{
+	unsigned int gpio;
+	int ret;
+
+	ret = gpio_lookup_name(name, NULL, NULL, &gpio);
+
+	return ret ? ret : gpio;
+}
+
 static int sunxi_gpio_direction_input(struct udevice *dev, unsigned offset)
 {
 	struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list