summaryrefslogtreecommitdiff
path: root/drivers/gpio/sunxi_gpio.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-04-22 09:31:22 (GMT)
committerHans de Goede <hdegoede@redhat.com>2015-05-04 14:51:53 (GMT)
commitf9b7a04bc8aae9b1ffe35c8cc90e1a59f618a9ab (patch)
tree9a076843fd7ae13a1b1564c8af8175e442c69aa1 /drivers/gpio/sunxi_gpio.c
parent2fcf033d36618da4c86de135a0d447fd3bbaf8ea (diff)
downloadu-boot-f9b7a04bc8aae9b1ffe35c8cc90e1a59f618a9ab.tar.xz
sunxi: axp: Add driver-model support to the axp_gpio code
Add driver-model support to the axp_gpio code, note that this needs a small tweak to the driver-model version of sunxi_name_to_gpio to deal with the vbus detect and enable pins which are not standard numbered gpios. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'drivers/gpio/sunxi_gpio.c')
-rw-r--r--drivers/gpio/sunxi_gpio.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index 5a0b5e4..21c3ff1 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -172,7 +172,19 @@ int sunxi_name_to_gpio(const char *name)
{
unsigned int gpio;
int ret;
-
+#if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO
+ char lookup[8];
+
+ if (strcasecmp(name, "AXP0-VBUS-DETECT") == 0) {
+ sprintf(lookup, SUNXI_GPIO_AXP0_PREFIX "%d",
+ SUNXI_GPIO_AXP0_VBUS_DETECT);
+ name = lookup;
+ } else if (strcasecmp(name, "AXP0-VBUS-ENABLE") == 0) {
+ sprintf(lookup, SUNXI_GPIO_AXP0_PREFIX "%d",
+ SUNXI_GPIO_AXP0_VBUS_ENABLE);
+ name = lookup;
+ }
+#endif
ret = gpio_lookup_name(name, NULL, NULL, &gpio);
return ret ? ret : gpio;