summaryrefslogtreecommitdiff
path: root/drivers/gpio/sunxi_gpio.c
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2015-05-05 10:09:06 +0200
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2015-05-05 10:09:06 +0200
commitb939689c7b87773c44275a578ffc8674a867e39d (patch)
tree785d71eb0bbc707385e4456a14b21706223d99a3 /drivers/gpio/sunxi_gpio.c
parent97840b5d1fe0960134c3553a9d9d1c1cd1be784d (diff)
parentace97d26176a3ebc9ec07738450de93eea35975c (diff)
downloadu-boot-imx-b939689c7b87773c44275a578ffc8674a867e39d.zip
u-boot-imx-b939689c7b87773c44275a578ffc8674a867e39d.tar.gz
u-boot-imx-b939689c7b87773c44275a578ffc8674a867e39d.tar.bz2
Merge branch 'u-boot/master' into 'u-boot-arm/master'
Diffstat (limited to 'drivers/gpio/sunxi_gpio.c')
-rw-r--r--drivers/gpio/sunxi_gpio.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c
index 6296092..cf5c624 100644
--- a/drivers/gpio/sunxi_gpio.c
+++ b/drivers/gpio/sunxi_gpio.c
@@ -21,6 +21,9 @@
#ifdef CONFIG_AXP209_POWER
#include <axp209.h>
#endif
+#ifdef CONFIG_AXP221_POWER
+#include <axp221.h>
+#endif
DECLARE_GLOBAL_DATA_PTR;
@@ -115,6 +118,20 @@ int gpio_set_value(unsigned gpio, int value)
return sunxi_gpio_output(gpio, value);
}
+int sunxi_name_to_gpio_bank(const char *name)
+{
+ int group = 0;
+
+ if (*name == 'P' || *name == 'p')
+ name++;
+ if (*name >= 'A') {
+ group = *name - (*name > 'a' ? 'a' : 'A');
+ return group;
+ }
+
+ return -1;
+}
+
int sunxi_name_to_gpio(const char *name)
{
int group = 0;
@@ -125,6 +142,12 @@ int sunxi_name_to_gpio(const char *name)
#ifdef AXP_GPIO
if (strncasecmp(name, "AXP0-", 5) == 0) {
name += 5;
+ if (strcmp(name, "VBUS-DETECT") == 0)
+ return SUNXI_GPIO_AXP0_START +
+ SUNXI_GPIO_AXP0_VBUS_DETECT;
+ if (strcmp(name, "VBUS-ENABLE") == 0)
+ return SUNXI_GPIO_AXP0_START +
+ SUNXI_GPIO_AXP0_VBUS_ENABLE;
pin = simple_strtol(name, &eptr, 10);
if (!*name || *eptr)
return -1;
@@ -238,7 +261,7 @@ static char *gpio_bank_name(int bank)
static int gpio_sunxi_probe(struct udevice *dev)
{
struct sunxi_gpio_platdata *plat = dev_get_platdata(dev);
- struct gpio_dev_priv *uc_priv = dev->uclass_priv;
+ struct gpio_dev_priv *uc_priv = dev_get_uclass_priv(dev);
/* Tell the uclass how many GPIOs we have */
if (plat) {