gpio: ia32_pci: Add options to allow GPIO IRQ trigger

Add Kconfig option to specify how interrupt is triggered for GPIO.

Change-Id: I8db988efb0c081a18e585ccc6dd121bff61d6ccc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Tomasz Bursztyka 2015-09-11 14:47:11 +03:00 committed by Anas Nashif
commit 608fc5071b
3 changed files with 52 additions and 0 deletions

View file

@ -124,4 +124,31 @@ config DW_I2C0_BAR
depends on DW_I2C0 && PCI
default 0
choice
depends on GPIO_DW_0
prompt "DW GPIO port 0 trigger condition"
default GPIO_DW_0_RISING_EDGE
config GPIO_DW_0_FALLING_EDGE
bool "Falling edge"
help
"DW GPIO port 0 uses falling edge interrupt"
config GPIO_DW_0_RISING_EDGE
bool "Rising edge"
help
"DW GPIO port 0 uses rising edge interrupt"
config GPIO_DW_0_LEVEL_HIGH
bool "Level high"
help
"DW GPIO port 0 uses level high interrupt"
config GPIO_DW_0_LEVEL_LOW
bool "Level low"
help
"DW GPIO port 0 uses level low interrupt"
endchoice
endmenu

View file

@ -102,6 +102,18 @@ extern struct device * const uart_devs[];
#endif /* CONFIG_UART_CONSOLE */
#ifdef CONFIG_GPIO_DW_0
#if defined(CONFIG_GPIO_DW_0_FALLING_EDGE)
#define GPIO_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
#elif defined(CONFIG_GPIO_DW_0_RISING_EDGE)
#define GPIO_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_HIGH)
#elif defined(CONFIG_GPIO_DW_0_LEVEL_HIGH)
#define GPIO_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_HIGH)
#elif defined(CONFIG_GPIO_DW_0_LEVEL_LOW)
#define GPIO_DW_0_IRQ_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_LOW)
#endif
#endif /* GPIO_DW_0 */
/* Bluetooth UART definitions */
#if defined(CONFIG_BLUETOOTH_UART)

View file

@ -123,6 +123,18 @@ static inline void dw_i2c0_irq_set(void)
} while ((0))
#endif /* CONFIG_DW_I2C0 */
#ifdef CONFIG_GPIO_DW_0
static inline void gpio_irq_set(void) {
_ioapic_irq_set(CONFIG_GPIO_DW_0_IRQ,
CONFIG_GPIO_DW_0_IRQ + INT_VEC_IRQ0,
GPIO_DW_0_IRQ_IOAPIC_FLAGS);
}
#else
#define gpio_irq_set() \
do { /* nothing */ \
} while ((0))
#endif /* CONFIG_GPIO_DW_0 */
/**
*
* @brief Perform basic hardware initialization
@ -143,6 +155,7 @@ static int ia32_pci_init(struct device *arg)
ioapic_init(); /* NOP if not needed */
hpet_irq_set(); /* NOP if not needed */
console_irq_set(); /* NOP if not needed */
gpio_irq_set(); /* NOP if not needed */
dw_i2c0_irq_set(); /* NOP if not needed */