drivers/uart_16550: configure MCR_OUT2 bit from Kconfig

move MCR_OUT2 configuration from qemu-intel64/src/qemu_boot.c to common code
also leave this option disabled for qemu-intel64 as it's not required

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2024-03-18 17:52:50 +01:00 committed by Xiang Xiao
parent a0e00b993a
commit c7e8fd43a4
3 changed files with 15 additions and 9 deletions

View File

@ -58,14 +58,6 @@
void x86_64_boardinitialize(void) void x86_64_boardinitialize(void)
{ {
#if defined(CONFIG_16550_UART0) && (CONFIG_16550_UART0_BASE == 0x3f8)
uart_putreg(CONFIG_16550_UART0_BASE, UART_MCR_OFFSET, UART_MCR_OUT2);
#endif
#if defined(CONFIG_16550_UART1) && (CONFIG_16550_UART1_BASE == 0x3f8)
uart_putreg(CONFIG_16550_UART1_BASE, UART_MCR_OFFSET, UART_MCR_OUT2);
#endif
/* Configure on-board LEDs if LED support has been selected. */ /* Configure on-board LEDs if LED support has been selected. */
#ifdef CONFIG_ARCH_LEDS #ifdef CONFIG_ARCH_LEDS

View File

@ -548,4 +548,10 @@ config 16550_WAIT_LCR
will trigger spurious interrupts when setting the LCR without will trigger spurious interrupts when setting the LCR without
waiting. Default: n waiting. Default: n
config 16550_SET_MCR_OUT2
bool "Set MCR OUT2 bit high"
default n
---help---
Some platforms require OUT2 of MCR being set for interrupt to be triggered
endif # 16550_UART endif # 16550_UART

View File

@ -754,7 +754,8 @@ static int u16550_setup(FAR struct uart_dev_s *dev)
FAR struct u16550_s *priv = (FAR struct u16550_s *)dev->priv; FAR struct u16550_s *priv = (FAR struct u16550_s *)dev->priv;
uint16_t div; uint16_t div;
uint32_t lcr; uint32_t lcr;
#if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) || \
defined(CONFIG_16550_SET_MCR_OUT2)
uint32_t mcr; uint32_t mcr;
#endif #endif
@ -845,6 +846,13 @@ static int u16550_setup(FAR struct uart_dev_s *dev)
UART_FCR_TXRST | UART_FCR_RXRST | UART_FCR_TXRST | UART_FCR_RXRST |
UART_FCR_FIFOEN)); UART_FCR_FIFOEN));
#ifdef CONFIG_16550_SET_MCR_OUT2
/* Set OUT2 bit in MCR register */
mcr = u16550_serialin(priv, UART_MCR_OFFSET);
u16550_serialout(priv, UART_MCR_OFFSET, mcr | UART_MCR_OUT2);
#endif
/* Set up the auto flow control */ /* Set up the auto flow control */
#if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL) #if defined(CONFIG_SERIAL_IFLOWCONTROL) || defined(CONFIG_SERIAL_OFLOWCONTROL)