From bdb62b89344b9053acb60d4faeadb727e42a409d Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Fri, 8 Jul 2016 12:23:41 +0300 Subject: [PATCH] QMSI/uart: Use IOAPIC_EDGE instead of IOAPIC_LEVEL Use IOAPIC_EDGE instead of IOAPIC_LEVEL to fix missing interrupts. During tests it was found that using IOAPIC_LEVEL interrupts for UART at some points are lost. Proposed by Calando, Antoine Change-Id: I18b20217c4d73fdeaa424bf59d00f6be1ec6ef1b Signed-off-by: Andrei Emeltchenko --- arch/x86/soc/quark_se/soc.h | 2 ++ drivers/serial/uart_qmsi.c | 5 +++-- include/misc/util.h | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/soc/quark_se/soc.h b/arch/x86/soc/quark_se/soc.h index 3d11e8e7a71..ea066a7e9f3 100644 --- a/arch/x86/soc/quark_se/soc.h +++ b/arch/x86/soc/quark_se/soc.h @@ -61,6 +61,8 @@ */ #define PINMUX_BASE_ADDR 0xb0800900 +#define UART_IRQ_FLAGS (IOAPIC_EDGE | IOAPIC_HIGH) + #endif /* _ASMLANGUAGE */ #endif /* __SOC_H_ */ diff --git a/drivers/serial/uart_qmsi.c b/drivers/serial/uart_qmsi.c index 69fdef64863..1c7df1e6bc3 100644 --- a/drivers/serial/uart_qmsi.c +++ b/drivers/serial/uart_qmsi.c @@ -24,6 +24,7 @@ #include "qm_uart.h" #include "qm_isr.h" #include "clk.h" +#include "soc.h" #include "qm_soc_regs.h" #define IIR_IID_NO_INTERRUPT_PENDING 0x01 @@ -293,7 +294,7 @@ static void irq_config_func_0(struct device *dev) { IRQ_CONNECT(QM_IRQ_UART_0, CONFIG_UART_QMSI_0_IRQ_PRI, uart_qmsi_isr, DEVICE_GET(uart_0), - (IOAPIC_LEVEL | IOAPIC_HIGH)); + UART_IRQ_FLAGS); irq_enable(QM_IRQ_UART_0); QM_SCSS_INT->int_uart_0_mask &= ~BIT(0); } @@ -304,7 +305,7 @@ static void irq_config_func_1(struct device *dev) { IRQ_CONNECT(QM_IRQ_UART_1, CONFIG_UART_QMSI_1_IRQ_PRI, uart_qmsi_isr, DEVICE_GET(uart_1), - (IOAPIC_LEVEL | IOAPIC_HIGH)); + UART_IRQ_FLAGS); irq_enable(QM_IRQ_UART_1); QM_SCSS_INT->int_uart_1_mask &= ~BIT(0); } diff --git a/include/misc/util.h b/include/misc/util.h index 80ce2c83cec..3f53ec65e9e 100644 --- a/include/misc/util.h +++ b/include/misc/util.h @@ -98,7 +98,9 @@ static inline int64_t arithmetic_shift_right(int64_t value, uint8_t shift) #define KHZ(x) ((x) * 1000) #define MHZ(x) (KHZ(x) * 1000) +#ifndef BIT #define BIT(n) (1UL << (n)) +#endif #define BIT_MASK(n) (BIT(n) - 1)