x86: ia32_pci: add options to allow I2C IRQ trigger
Add Kconfig option to specify how interrupt is triggered for I2C. Change-Id: I5f5afdf6bfc2adbfc2f66bdc1f58bd3a8fc60ecf Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
80c880c8cb
commit
e495f95a43
3 changed files with 58 additions and 0 deletions
|
@ -77,6 +77,33 @@ config DW_I2C0_INT_PRIORITY
|
|||
help
|
||||
IRQ priority
|
||||
|
||||
choice
|
||||
depends on DW_I2C0
|
||||
prompt "I2C0 IRQ Trigger Condition"
|
||||
default DW_I2C0_IRQ_RISING_EDGE
|
||||
|
||||
config DW_I2C0_IRQ_FALLING_EDGE
|
||||
bool "Falling Edge"
|
||||
help
|
||||
This option signifies that the I2C0 uses falling edge interrupt.
|
||||
|
||||
config DW_I2C0_IRQ_RISING_EDGE
|
||||
bool "Rising Edge"
|
||||
help
|
||||
This option signifies that the I2C0 uses rising edge interrupt.
|
||||
|
||||
config DW_I2C0_IRQ_LEVEL_HIGH
|
||||
bool "Level High"
|
||||
help
|
||||
This option signifies that the I2C0 uses level high interrupt.
|
||||
|
||||
config DW_I2C0_IRQ_LEVEL_LOW
|
||||
bool "Level Low"
|
||||
help
|
||||
This option signifies that the I2C0 uses level low interrupt.
|
||||
|
||||
endchoice
|
||||
|
||||
config DW_I2C0_BUS
|
||||
int "PCI Bus number"
|
||||
depends on DW_I2C0 && PCI
|
||||
|
|
|
@ -114,6 +114,22 @@ extern struct device * const uart_devs[];
|
|||
|
||||
#endif /* CONFIG_BLUETOOTH_UART */
|
||||
|
||||
#ifdef CONFIG_DW_I2C0
|
||||
|
||||
#include <drivers/ioapic.h>
|
||||
|
||||
#if defined(CONFIG_DW_I2C0_IRQ_FALLING_EDGE)
|
||||
#define DW_I2C0_IRQ_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_LOW)
|
||||
#elif defined(CONFIG_DW_I2C0_IRQ_RISING_EDGE)
|
||||
#define DW_I2C0_IRQ_IOAPIC_FLAGS (IOAPIC_EDGE | IOAPIC_HIGH)
|
||||
#elif defined(CONFIG_DW_I2C0_IRQ_LEVEL_HIGH)
|
||||
#define DW_I2C0_IRQ_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_HIGH)
|
||||
#elif defined(CONFIG_DW_I2C0_IRQ_LEVEL_LOW)
|
||||
#define DW_I2C0_IRQ_IOAPIC_FLAGS (IOAPIC_LEVEL | IOAPIC_LOW)
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_DW_I2C0 */
|
||||
|
||||
/*
|
||||
* The irq_connect() API connects to a (virtualized) IRQ and the
|
||||
* associated interrupt controller is programmed with the allocated vector.
|
||||
|
|
|
@ -110,6 +110,19 @@ static inline void console_irq_set(void)
|
|||
} while ((0))
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DW_I2C0
|
||||
static inline void dw_i2c0_irq_set(void)
|
||||
{
|
||||
_ioapic_irq_set(CONFIG_DW_I2C0_IRQ,
|
||||
CONFIG_DW_I2C0_IRQ + INT_VEC_IRQ0,
|
||||
DW_I2C0_IRQ_IOAPIC_FLAGS);
|
||||
}
|
||||
#else
|
||||
#define dw_i2c0_irq_set() \
|
||||
do { /* nothing */ \
|
||||
} while ((0))
|
||||
#endif /* CONFIG_DW_I2C0 */
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Perform basic hardware initialization
|
||||
|
@ -131,6 +144,8 @@ static int ia32_pci_init(struct device *arg)
|
|||
hpet_irq_set(); /* NOP if not needed */
|
||||
console_irq_set(); /* NOP if not needed */
|
||||
|
||||
dw_i2c0_irq_set(); /* NOP if not needed */
|
||||
|
||||
#if defined(CONFIG_PCI_DEBUG) && defined(CONFIG_PCI_ENUMERATION)
|
||||
/* Rescan PCI and display the list of PCI attached devices */
|
||||
struct pci_dev_info info = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue