]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
sunxi: axp: Remove non driver-model support from the axp gpio code
authorHans de Goede <hdegoede@redhat.com>
Sun, 26 Apr 2015 09:19:37 +0000 (11:19 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 8 Sep 2015 20:35:21 +0000 (22:35 +0200)
Now that all sunxi boards are using driver-model for gpio (*), we can remove
the non driver-model support from the axp gpio code, and the glue to call
into the axp gpio code from the sunxi_gpio non driver-model code.

*) For the regular u-boot build, SPL still uses non driver-model gpio for
now, but the SPL never uses axp gpios support and we were already not building
axp-gpio support for the SPL.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
arch/arm/include/asm/arch-sunxi/gpio.h
drivers/gpio/axp_gpio.c
drivers/gpio/sunxi_gpio.c

index d5caeed27a2d0b6611639ec600c99741467c0728..59d8210e88d5665a27e9c6e0be54151a81f25029 100644 (file)
@@ -224,11 +224,4 @@ int axp_gpio_init(void);
 static inline int axp_gpio_init(void) { return 0; }
 #endif
 
-struct udevice;
-
-int axp_gpio_direction_input(struct udevice *dev, unsigned offset);
-int axp_gpio_direction_output(struct udevice *dev, unsigned offset, int val);
-int axp_gpio_get_value(struct udevice *dev, unsigned offset);
-int axp_gpio_set_value(struct udevice *dev, unsigned offset, int val);
-
 #endif /* _SUNXI_GPIO_H */
index 55f20a34b64c74bf2814b1fc153a610f7b2497eb..2e97cc39d68bf1a5b28d613d1016a48fc40df1a1 100644 (file)
@@ -26,6 +26,8 @@
 #error Unknown AXP model
 #endif
 
+static int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val);
+
 static u8 axp_get_gpio_ctrl_reg(unsigned pin)
 {
        switch (pin) {
@@ -41,7 +43,7 @@ static u8 axp_get_gpio_ctrl_reg(unsigned pin)
        return 0;
 }
 
-int axp_gpio_direction_input(struct udevice *dev, unsigned pin)
+static int axp_gpio_direction_input(struct udevice *dev, unsigned pin)
 {
        u8 reg;
 
@@ -59,7 +61,8 @@ int axp_gpio_direction_input(struct udevice *dev, unsigned pin)
        }
 }
 
-int axp_gpio_direction_output(struct udevice *dev, unsigned pin, int val)
+static int axp_gpio_direction_output(struct udevice *dev, unsigned pin,
+                                    int val)
 {
        __maybe_unused int ret;
        u8 reg;
@@ -84,7 +87,7 @@ int axp_gpio_direction_output(struct udevice *dev, unsigned pin, int val)
        }
 }
 
-int axp_gpio_get_value(struct udevice *dev, unsigned pin)
+static int axp_gpio_get_value(struct udevice *dev, unsigned pin)
 {
        u8 reg, val, mask;
        int ret;
@@ -116,7 +119,7 @@ int axp_gpio_get_value(struct udevice *dev, unsigned pin)
        return (val & mask) ? 1 : 0;
 }
 
-int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val)
+static int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val)
 {
        u8 reg;
 
@@ -140,7 +143,6 @@ int axp_gpio_set_value(struct udevice *dev, unsigned pin, int val)
        }
 }
 
-#ifdef CONFIG_DM_GPIO
 static const struct dm_gpio_ops gpio_axp_ops = {
        .direction_input        = axp_gpio_direction_input,
        .direction_output       = axp_gpio_direction_output,
@@ -165,23 +167,20 @@ U_BOOT_DRIVER(gpio_axp) = {
        .ops    = &gpio_axp_ops,
        .probe  = gpio_axp_probe,
 };
-#endif
 
 int axp_gpio_init(void)
 {
-       __maybe_unused struct udevice *dev;
+       struct udevice *dev;
        int ret;
 
        ret = pmic_bus_init();
        if (ret)
                return ret;
 
-#ifdef CONFIG_DM_GPIO
        /* There is no devicetree support for the axp yet, so bind directly */
        ret = device_bind_driver(dm_root(), "gpio_axp", "AXP-gpio", &dev);
        if (ret)
                return ret;
-#endif
 
        return 0;
 }
index 21c3ff1e75e79f2920aa0b439f83ae63e4e2d5e3..f9881308f42b6ee58a1a55451fecf894ef2f92b2 100644 (file)
@@ -74,10 +74,6 @@ int gpio_free(unsigned gpio)
 
 int gpio_direction_input(unsigned gpio)
 {
-#if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO
-       if (gpio >= SUNXI_GPIO_AXP0_START)
-               return axp_gpio_direction_input(NULL, gpio - SUNXI_GPIO_AXP0_START);
-#endif
        sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_INPUT);
 
        return 0;
@@ -85,11 +81,6 @@ int gpio_direction_input(unsigned gpio)
 
 int gpio_direction_output(unsigned gpio, int value)
 {
-#if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO
-       if (gpio >= SUNXI_GPIO_AXP0_START)
-               return axp_gpio_direction_output(NULL, gpio - SUNXI_GPIO_AXP0_START,
-                                                value);
-#endif
        sunxi_gpio_set_cfgpin(gpio, SUNXI_GPIO_OUTPUT);
 
        return sunxi_gpio_output(gpio, value);
@@ -97,19 +88,11 @@ int gpio_direction_output(unsigned gpio, int value)
 
 int gpio_get_value(unsigned gpio)
 {
-#if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO
-       if (gpio >= SUNXI_GPIO_AXP0_START)
-               return axp_gpio_get_value(NULL, gpio - SUNXI_GPIO_AXP0_START);
-#endif
        return sunxi_gpio_input(gpio);
 }
 
 int gpio_set_value(unsigned gpio, int value)
 {
-#if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO
-       if (gpio >= SUNXI_GPIO_AXP0_START)
-               return axp_gpio_set_value(NULL, gpio - SUNXI_GPIO_AXP0_START, value);
-#endif
        return sunxi_gpio_output(gpio, value);
 }
 
@@ -120,21 +103,6 @@ int sunxi_name_to_gpio(const char *name)
        long pin;
        char *eptr;
 
-#if !defined CONFIG_SPL_BUILD && defined CONFIG_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;
-               return SUNXI_GPIO_AXP0_START + pin;
-       }
-#endif
        if (*name == 'P' || *name == 'p')
                name++;
        if (*name >= 'A') {