arm: GPIO driver modifications for MKL25Z soc support
The MKL25Z soc do not support irqs in PORTB, PORTC and PORTE. This is a patch to not enable irq if such ports are enabled. Change-Id: I7b0b308504fcea47714fee8f2913baf336c4aa7d Signed-off-by: Gustavo Denardin <gustavo.denardin@gmail.com> Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
b0ae518933
commit
4951340829
1 changed files with 52 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
struct gpio_mcux_config {
|
||||
GPIO_Type *gpio_base;
|
||||
PORT_Type *port_base;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
struct gpio_mcux_data {
|
||||
|
@ -42,6 +43,11 @@ static int gpio_mcux_configure(struct device *dev,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Check if GPIO port supports interrupts */
|
||||
if ((flags & GPIO_INT) && ((config->flags & GPIO_INT) == 0)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* The flags contain options that require touching registers in the
|
||||
* GPIO module and the corresponding PORT module.
|
||||
*
|
||||
|
@ -233,6 +239,11 @@ static int gpio_mcux_porta_init(struct device *dev);
|
|||
static const struct gpio_mcux_config gpio_mcux_porta_config = {
|
||||
.gpio_base = GPIOA,
|
||||
.port_base = PORTA,
|
||||
#ifdef IRQ_GPIO_PORTA
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_mcux_data gpio_mcux_porta_data;
|
||||
|
@ -245,12 +256,16 @@ DEVICE_AND_API_INIT(gpio_mcux_porta, CONFIG_GPIO_MCUX_PORTA_NAME,
|
|||
|
||||
static int gpio_mcux_porta_init(struct device *dev)
|
||||
{
|
||||
#ifdef IRQ_GPIO_PORTA
|
||||
IRQ_CONNECT(IRQ_GPIO_PORTA, CONFIG_GPIO_MCUX_PORTA_PRI,
|
||||
gpio_mcux_port_isr, DEVICE_GET(gpio_mcux_porta), 0);
|
||||
|
||||
irq_enable(IRQ_GPIO_PORTA);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_GPIO_MCUX_PORTA */
|
||||
|
||||
|
@ -260,6 +275,11 @@ static int gpio_mcux_portb_init(struct device *dev);
|
|||
static const struct gpio_mcux_config gpio_mcux_portb_config = {
|
||||
.gpio_base = GPIOB,
|
||||
.port_base = PORTB,
|
||||
#ifdef IRQ_GPIO_PORTB
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_mcux_data gpio_mcux_portb_data;
|
||||
|
@ -272,12 +292,16 @@ DEVICE_AND_API_INIT(gpio_mcux_portb, CONFIG_GPIO_MCUX_PORTB_NAME,
|
|||
|
||||
static int gpio_mcux_portb_init(struct device *dev)
|
||||
{
|
||||
#ifdef IRQ_GPIO_PORTB
|
||||
IRQ_CONNECT(IRQ_GPIO_PORTB, CONFIG_GPIO_MCUX_PORTB_PRI,
|
||||
gpio_mcux_port_isr, DEVICE_GET(gpio_mcux_portb), 0);
|
||||
|
||||
irq_enable(IRQ_GPIO_PORTB);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_GPIO_MCUX_PORTB */
|
||||
|
||||
|
@ -287,6 +311,11 @@ static int gpio_mcux_portc_init(struct device *dev);
|
|||
static const struct gpio_mcux_config gpio_mcux_portc_config = {
|
||||
.gpio_base = GPIOC,
|
||||
.port_base = PORTC,
|
||||
#ifdef IRQ_GPIO_PORTC
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_mcux_data gpio_mcux_portc_data;
|
||||
|
@ -299,12 +328,16 @@ DEVICE_AND_API_INIT(gpio_mcux_portc, CONFIG_GPIO_MCUX_PORTC_NAME,
|
|||
|
||||
static int gpio_mcux_portc_init(struct device *dev)
|
||||
{
|
||||
#ifdef IRQ_GPIO_PORTC
|
||||
IRQ_CONNECT(IRQ_GPIO_PORTC, CONFIG_GPIO_MCUX_PORTC_PRI,
|
||||
gpio_mcux_port_isr, DEVICE_GET(gpio_mcux_portc), 0);
|
||||
|
||||
irq_enable(IRQ_GPIO_PORTC);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_GPIO_MCUX_PORTC */
|
||||
|
||||
|
@ -314,6 +347,11 @@ static int gpio_mcux_portd_init(struct device *dev);
|
|||
static const struct gpio_mcux_config gpio_mcux_portd_config = {
|
||||
.gpio_base = GPIOD,
|
||||
.port_base = PORTD,
|
||||
#ifdef IRQ_GPIO_PORTD
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_mcux_data gpio_mcux_portd_data;
|
||||
|
@ -326,12 +364,16 @@ DEVICE_AND_API_INIT(gpio_mcux_portd, CONFIG_GPIO_MCUX_PORTD_NAME,
|
|||
|
||||
static int gpio_mcux_portd_init(struct device *dev)
|
||||
{
|
||||
#ifdef IRQ_GPIO_PORTD
|
||||
IRQ_CONNECT(IRQ_GPIO_PORTD, CONFIG_GPIO_MCUX_PORTD_PRI,
|
||||
gpio_mcux_port_isr, DEVICE_GET(gpio_mcux_portd), 0);
|
||||
|
||||
irq_enable(IRQ_GPIO_PORTD);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_GPIO_MCUX_PORTD */
|
||||
|
||||
|
@ -341,6 +383,11 @@ static int gpio_mcux_porte_init(struct device *dev);
|
|||
static const struct gpio_mcux_config gpio_mcux_porte_config = {
|
||||
.gpio_base = GPIOE,
|
||||
.port_base = PORTE,
|
||||
#ifdef IRQ_GPIO_PORTE
|
||||
.flags = GPIO_INT,
|
||||
#else
|
||||
.flags = 0,
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_mcux_data gpio_mcux_porte_data;
|
||||
|
@ -353,11 +400,16 @@ DEVICE_AND_API_INIT(gpio_mcux_porte, CONFIG_GPIO_MCUX_PORTE_NAME,
|
|||
|
||||
static int gpio_mcux_porte_init(struct device *dev)
|
||||
{
|
||||
#ifdef IRQ_GPIO_PORTE
|
||||
IRQ_CONNECT(IRQ_GPIO_PORTE, CONFIG_GPIO_MCUX_PORTE_PRI,
|
||||
gpio_mcux_port_isr, DEVICE_GET(gpio_mcux_porte), 0);
|
||||
|
||||
irq_enable(IRQ_GPIO_PORTE);
|
||||
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
#endif /* CONFIG_GPIO_MCUX_PORTE */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue