driver/serial: ns16550: set NS16550 as default variant

This add UART_NS16550_VARIANT_16550 configuration inside the choice
of UART_NS16550_VARIANT_NS16750 and UART_NS16550_VARIANT_NS16950.
The configuration is enabled by default to make NS16550 device to get
correct FIFO size configuration (16 bytes).

fixes #45783

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
This commit is contained in:
Dino Li 2022-05-18 13:38:10 +08:00 committed by Marti Bolivar
parent 4049ccf621
commit 5a1c084447
3 changed files with 16 additions and 10 deletions

View file

@ -13,7 +13,7 @@ CONFIG_SYSCON=y
# Serial Drivers
CONFIG_SERIAL=y
CONFIG_UART_NS16550=y
CONFIG_UART_NS16950=y
CONFIG_UART_NS16550_VARIANT_NS16950=y
#CONFIG_UART_INTERRUPT_DRIVEN=y
#CONFIG_UART_NS16550_ACCESS_WORD_ONLY=y
#CONFIG_UART_ALTERA_JTAG=y

View file

@ -29,18 +29,23 @@ config UART_NS16550_DRV_CMD
Says n if not sure.
choice
prompt "UART type"
default UART_NS16750
prompt "UART variant"
default UART_NS16550_VARIANT_NS16550
help
Select UART device type
Select UART device variant
config UART_NS16750
config UART_NS16550_VARIANT_NS16550
bool "UART 16550 (16-bytes FIFO)"
help
This enables support for 16-bytes FIFO if UART controller is 16550.
config UART_NS16550_VARIANT_NS16750
bool "UART 16750 (64-bytes FIFO and auto flow control)"
help
This enables support for 64-bytes FIFO and automatic hardware
flow control if UART controller is 16750.
config UART_NS16950
config UART_NS16550_VARIANT_NS16950
bool "UART 16950 (128-bytes FIFO and auto flow control)"
help
This enables support for 128-bytes FIFO and automatic hardware flow control.

View file

@ -448,7 +448,8 @@ static int uart_ns16550_configure(const struct device *dev,
uart_cfg.data_bits | uart_cfg.stop_bits | uart_cfg.parity);
mdc = MCR_OUT2 | MCR_RTS | MCR_DTR;
#if defined(CONFIG_UART_NS16750) || defined(CONFIG_UART_NS16950)
#if defined(CONFIG_UART_NS16550_VARIANT_NS16750) || \
defined(CONFIG_UART_NS16550_VARIANT_NS16950)
if (cfg->flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS) {
mdc |= MCR_AFCE;
}
@ -463,15 +464,15 @@ static int uart_ns16550_configure(const struct device *dev,
*/
OUTBYTE(FCR(dev),
FCR_FIFO | FCR_MODE0 | FCR_FIFO_8 | FCR_RCVRCLR | FCR_XMITCLR
#ifdef CONFIG_UART_NS16750
#ifdef CONFIG_UART_NS16550_VARIANT_NS16750
| FCR_FIFO_64
#endif
);
if ((INBYTE(IIR(dev)) & IIR_FE) == IIR_FE) {
#ifdef CONFIG_UART_NS16750
#ifdef CONFIG_UART_NS16550_VARIANT_NS16750
dev_data->fifo_size = 64;
#elif defined(CONFIG_UART_NS16950)
#elif defined(CONFIG_UART_NS16550_VARIANT_NS16950)
dev_data->fifo_size = 128;
#else
dev_data->fifo_size = 16;