dm: cros_ec: Remove use of fdtdec GPIO support

These functions are going away, so use the new uclass support instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2015-01-05 20:05:32 -07:00
parent a02af4aeec
commit 32f8a19f6d
2 changed files with 8 additions and 19 deletions

View 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) int cros_ec_interrupt_pending(struct cros_ec_dev *dev)
{ {
/* no interrupt support : always poll */ /* no interrupt support : always poll */
if (!fdt_gpio_isvalid(&dev->ec_int)) if (!dm_gpio_is_valid(&dev->ec_int))
return -ENOENT; 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) 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; 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, dev->optimise_flash_write = fdtdec_get_bool(blob, node,
"optimise-flash-write"); "optimise-flash-write");
*devp = dev; *devp = dev;
@ -1090,17 +1091,11 @@ int cros_ec_register(struct udevice *dev)
char id[MSG_BYTES]; char id[MSG_BYTES];
cdev->dev = dev; 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, cdev->optimise_flash_write = fdtdec_get_bool(blob, node,
"optimise-flash-write"); "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)) { if (cros_ec_check_version(cdev)) {
debug("%s: Could not detect CROS-EC version\n", __func__); debug("%s: Could not detect CROS-EC version\n", __func__);
return -CROS_EC_ERR_CHECK_VERSION; return -CROS_EC_ERR_CHECK_VERSION;
@ -1184,13 +1179,6 @@ int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp)
} }
#endif #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)) { if (cros_ec_check_version(dev)) {
debug("%s: Could not detect CROS-EC version\n", __func__); debug("%s: Could not detect CROS-EC version\n", __func__);
return -CROS_EC_ERR_CHECK_VERSION; return -CROS_EC_ERR_CHECK_VERSION;

View file

@ -13,6 +13,7 @@
#include <ec_commands.h> #include <ec_commands.h>
#include <fdtdec.h> #include <fdtdec.h>
#include <cros_ec_message.h> #include <cros_ec_message.h>
#include <asm/gpio.h>
#ifndef CONFIG_DM_CROS_EC #ifndef CONFIG_DM_CROS_EC
/* Which interface is the device on? */ /* Which interface is the device on? */
@ -39,7 +40,7 @@ struct cros_ec_dev {
unsigned int bus_num; /* Bus number (for I2C) */ unsigned int bus_num; /* Bus number (for I2C) */
unsigned int max_frequency; /* Maximum interface frequency */ unsigned int max_frequency; /* Maximum interface frequency */
#endif #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 protocol_version; /* Protocol version to use */
int optimise_flash_write; /* Don't write erased flash blocks */ int optimise_flash_write; /* Don't write erased flash blocks */