dm: cros_ec: Remove use of fdtdec GPIO support
authorSimon Glass <sjg@chromium.org>
Tue, 6 Jan 2015 03:05:32 +0000 (20:05 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 30 Jan 2015 00:09:51 +0000 (17:09 -0700)
These functions are going away, so use the new uclass support instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/misc/cros_ec.c
include/cros_ec.h

index 9b4effb2fb56cda2fcba39d1a5ee80fe084384b8..7b20ffcfa2842260778e96d9a4681634422d2103 100644 (file)
@@ -606,10 +606,10 @@ int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd,
 int cros_ec_interrupt_pending(struct cros_ec_dev *dev)
 {
        /* no interrupt support : always poll */
-       if (!fdt_gpio_isvalid(&dev->ec_int))
+       if (!dm_gpio_is_valid(&dev->ec_int))
                return -ENOENT;
 
-       return !gpio_get_value(dev->ec_int.gpio);
+       return dm_gpio_get_value(&dev->ec_int);
 }
 
 int cros_ec_info(struct cros_ec_dev *dev, struct ec_response_mkbp_info *info)
@@ -1072,7 +1072,8 @@ static int cros_ec_decode_fdt(const void *blob, int node,
                return -1;
        }
 
-       fdtdec_decode_gpio(blob, node, "ec-interrupt", &dev->ec_int);
+       gpio_request_by_name_nodev(blob, node, "ec-interrupt", 0, &dev->ec_int,
+                                  GPIOD_IS_IN);
        dev->optimise_flash_write = fdtdec_get_bool(blob, node,
                                                    "optimise-flash-write");
        *devp = dev;
@@ -1090,17 +1091,11 @@ int cros_ec_register(struct udevice *dev)
        char id[MSG_BYTES];
 
        cdev->dev = dev;
-       fdtdec_decode_gpio(blob, node, "ec-interrupt", &cdev->ec_int);
+       gpio_request_by_name(dev, "ec-interrupt", 0, &cdev->ec_int,
+                            GPIOD_IS_IN);
        cdev->optimise_flash_write = fdtdec_get_bool(blob, node,
                                                     "optimise-flash-write");
 
-       /* we will poll the EC interrupt line */
-       fdtdec_setup_gpio(&cdev->ec_int);
-       if (fdt_gpio_isvalid(&cdev->ec_int)) {
-               gpio_request(cdev->ec_int.gpio, "cros-ec-irq");
-               gpio_direction_input(cdev->ec_int.gpio);
-       }
-
        if (cros_ec_check_version(cdev)) {
                debug("%s: Could not detect CROS-EC version\n", __func__);
                return -CROS_EC_ERR_CHECK_VERSION;
@@ -1184,13 +1179,6 @@ int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp)
        }
 #endif
 
-       /* we will poll the EC interrupt line */
-       fdtdec_setup_gpio(&dev->ec_int);
-       if (fdt_gpio_isvalid(&dev->ec_int)) {
-               gpio_request(dev->ec_int.gpio, "cros-ec-irq");
-               gpio_direction_input(dev->ec_int.gpio);
-       }
-
        if (cros_ec_check_version(dev)) {
                debug("%s: Could not detect CROS-EC version\n", __func__);
                return -CROS_EC_ERR_CHECK_VERSION;
index 9e13146ecbb266a5b73dbb9b93b1e90317c79a06..8457c80c5efd4264e5943255dc35b83fd520581b 100644 (file)
@@ -13,6 +13,7 @@
 #include <ec_commands.h>
 #include <fdtdec.h>
 #include <cros_ec_message.h>
+#include <asm/gpio.h>
 
 #ifndef CONFIG_DM_CROS_EC
 /* Which interface is the device on? */
@@ -39,7 +40,7 @@ struct cros_ec_dev {
        unsigned int bus_num;           /* Bus number (for I2C) */
        unsigned int max_frequency;     /* Maximum interface frequency */
 #endif
-       struct fdt_gpio_state ec_int;   /* GPIO used as EC interrupt line */
+       struct gpio_desc ec_int;        /* GPIO used as EC interrupt line */
        int protocol_version;           /* Protocol version to use */
        int optimise_flash_write;       /* Don't write erased flash blocks */