drivers: enc28j60: convert to new GPIO API
Convert ENC28J60 controller driver to new GPIO API. Signed-off-by: Johann Fischer <j.fischer@phytec.de>
This commit is contained in:
parent
d3da608535
commit
91fad730a6
3 changed files with 12 additions and 7 deletions
|
@ -694,10 +694,8 @@ static int eth_enc28j60_init(struct device *dev)
|
|||
}
|
||||
|
||||
if (gpio_pin_configure(context->gpio, config->gpio_pin,
|
||||
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE
|
||||
| GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE))) {
|
||||
LOG_ERR("Unable to configure GPIO pin %u",
|
||||
config->gpio_pin);
|
||||
GPIO_INPUT | config->gpio_flags)) {
|
||||
LOG_ERR("Unable to configure GPIO pin %u", config->gpio_pin);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -708,9 +706,9 @@ static int eth_enc28j60_init(struct device *dev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (gpio_pin_enable_callback(context->gpio, config->gpio_pin)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
gpio_pin_interrupt_configure(context->gpio,
|
||||
config->gpio_pin,
|
||||
GPIO_INT_EDGE_TO_ACTIVE);
|
||||
|
||||
if (eth_enc28j60_soft_reset(dev)) {
|
||||
LOG_ERR("Soft-reset failed");
|
||||
|
@ -763,6 +761,7 @@ static struct eth_enc28j60_runtime eth_enc28j60_0_runtime = {
|
|||
static const struct eth_enc28j60_config eth_enc28j60_0_config = {
|
||||
.gpio_port = DT_INST_0_MICROCHIP_ENC28J60_INT_GPIOS_CONTROLLER,
|
||||
.gpio_pin = DT_INST_0_MICROCHIP_ENC28J60_INT_GPIOS_PIN,
|
||||
.gpio_flags = DT_INST_0_MICROCHIP_ENC28J60_INT_GPIOS_FLAGS,
|
||||
.spi_port = DT_INST_0_MICROCHIP_ENC28J60_BUS_NAME,
|
||||
.spi_freq = DT_INST_0_MICROCHIP_ENC28J60_SPI_MAX_FREQUENCY,
|
||||
.spi_slave = DT_INST_0_MICROCHIP_ENC28J60_BASE_ADDRESS,
|
||||
|
|
|
@ -216,6 +216,7 @@
|
|||
struct eth_enc28j60_config {
|
||||
const char *gpio_port;
|
||||
u8_t gpio_pin;
|
||||
gpio_devicetree_flags_t gpio_flags;
|
||||
const char *spi_port;
|
||||
u8_t spi_cs_pin;
|
||||
const char *spi_cs_port;
|
||||
|
|
|
@ -11,3 +11,8 @@ properties:
|
|||
int-gpios:
|
||||
type: phandle-array
|
||||
required: true
|
||||
description: Interrupt pin.
|
||||
|
||||
The interrupt pin of ENC28J60 is active low.
|
||||
If connected directly the MCU pin should be configured
|
||||
as active low.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue