driver: uart: ns16550: convert custom init options to DTS flow control

The sole purpose of init options has been to enable hardware flow
control on NS16750 when asked. Use the proper DTS tags for this.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
This commit is contained in:
Timo Teräs 2020-03-03 22:25:52 +02:00 committed by Andrew Boie
parent dc5ac89ab9
commit e740818093
8 changed files with 14 additions and 78 deletions

View file

@ -92,8 +92,6 @@ config UART_NS16550_PORT_0
if UART_NS16550_PORT_0
config UART_NS16550_PORT_0_OPTIONS
default 0
config UART_INTERRUPT_DRIVEN
default y

View file

@ -27,10 +27,11 @@ config UART_NS16550_DRV_CMD
Says n if not sure.
config UART_NS16750
bool "Enable 64-bytes FIFO for UART 16750"
bool "Enable UART 16750 (64-bytes FIFO and auto flow control)"
depends on UART_NS16550
help
This enables support for 64-bytes FIFO if UART controller is 16750.
This enables support for 64-bytes FIFO and automatic hardware
flow control if UART controller is 16750.
config UART_NS16550_ACCESS_WORD_ONLY
bool "NS16550 only allows word access"
@ -40,67 +41,26 @@ config UART_NS16550_ACCESS_WORD_ONLY
16550 (DesignWare UART) only allows word access, byte access will raise
exception.
# ---------- Port 0 ----------
menuconfig UART_NS16550_PORT_0
bool "Enable NS16550 Port 0"
depends on UART_NS16550
help
This tells the driver to configure the UART port at boot, depending on
the additional configure options below.
config UART_NS16550_PORT_0_OPTIONS
int "Port 0 Options"
default 0
depends on UART_NS16550_PORT_0
help
Options used for port initialization.
# ---------- Port 1 ----------
This tells the driver to configure the UART port at boot.
menuconfig UART_NS16550_PORT_1
bool "Enable NS16550 Port 1"
depends on UART_NS16550
help
This tells the driver to configure the UART port at boot, depending on
the additional configure options below.
config UART_NS16550_PORT_1_OPTIONS
int "Port 1 Options"
default 0
depends on UART_NS16550_PORT_1
help
Options used for port initialization.
# ---------- Port 2 ----------
This tells the driver to configure the UART port at boot.
menuconfig UART_NS16550_PORT_2
bool "Enable NS16550 Port 2"
depends on UART_NS16550
help
This tells the driver to configure the UART port at boot, depending on
the additional configure options below.
config UART_NS16550_PORT_2_OPTIONS
int "Port 2 Options"
default 0
depends on UART_NS16550_PORT_2
help
Options used for port initialization.
# ---------- Port 3 ----------
This tells the driver to configure the UART port at boot.
menuconfig UART_NS16550_PORT_3
bool "Enable NS16550 Port 3"
depends on UART_NS16550
help
This tells the driver to configure the UART port at boot, depending on
the additional configure options below.
config UART_NS16550_PORT_3_OPTIONS
int "Port 3 Options"
default 0
depends on UART_NS16550_PORT_3
help
Options used for port initialization.
This tells the driver to configure the UART port at boot.

View file

@ -268,7 +268,6 @@ struct uart_ns16550_device_config {
/** Device data structure */
struct uart_ns16550_dev_data_t {
struct uart_config uart_config;
u8_t options; /**< Serial port options */
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
u8_t iir_cache; /**< cache of IIR since it clears when read */
@ -402,9 +401,11 @@ static int uart_ns16550_configure(struct device *dev,
uart_cfg.data_bits | uart_cfg.stop_bits | uart_cfg.parity);
mdc = MCR_OUT2 | MCR_RTS | MCR_DTR;
if ((dev_data->options & UART_OPTION_AFCE) == UART_OPTION_AFCE) {
#ifdef CONFIG_UART_NS16750
if (cfg->flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS) {
mdc |= MCR_AFCE;
}
#endif
OUTBYTE(MDC(dev), mdc);

View file

@ -35,9 +35,11 @@ static struct uart_ns16550_dev_data_t uart_ns16550_dev_data_@NUM@ = {
.uart_config.parity = UART_CFG_PARITY_NONE,
.uart_config.stop_bits = UART_CFG_STOP_BITS_1,
.uart_config.data_bits = UART_CFG_DATA_BITS_8,
#if DT_UART_NS16550_PORT_@NUM@_HW_FLOW_CONTROL
.uart_config.flow_ctrl = UART_CFG_FLOW_CTRL_RTS_CTS,
#else
.uart_config.flow_ctrl = UART_CFG_FLOW_CTRL_NONE,
.options = CONFIG_UART_NS16550_PORT_@NUM@_OPTIONS,
#endif
#ifdef DT_UART_NS16550_PORT_@NUM@_DLF
.dlf = DT_UART_NS16550_PORT_@NUM@_DLF,
#endif

View file

@ -232,11 +232,6 @@ struct uart_event {
*/
typedef void (*uart_callback_t)(struct uart_event *evt, void *user_data);
/**
* @brief Options for @a UART initialization.
*/
#define UART_OPTION_AFCE 0x01
/**
* @brief UART controller configuration structure
*

View file

@ -28,10 +28,6 @@ if UART_NS16550
config UART_NS16550_PORT_0
default y
config UART_NS16550_PORT_0_OPTIONS
default 0
depends on UART_NS16550_PORT_0
endif # UART_NS16550
endif # SOC_NIOS2F_ZEPHYR

View file

@ -20,17 +20,9 @@ if UART_NS16550
config UART_NS16550_PORT_0
default y
config UART_NS16550_PORT_0_OPTIONS
default 0
depends on UART_NS16550_PORT_0
config UART_NS16550_PORT_1
default y
config UART_NS16550_PORT_1_OPTIONS
default 0
depends on UART_NS16550_PORT_1
endif # UART_NS16550
if BT_UART

View file

@ -20,17 +20,9 @@ if UART_NS16550
config UART_NS16550_PORT_0
default y
config UART_NS16550_PORT_0_OPTIONS
default 0
depends on UART_NS16550_PORT_0
config UART_NS16550_PORT_1
default y
config UART_NS16550_PORT_1_OPTIONS
default 0
depends on UART_NS16550_PORT_1
endif # UART_NS16550
endif