Commit 857b8508 authored by Mark Wang's avatar Mark Wang Committed by David Leach
Browse files

drivers: serial: NXP: Enable flow control for uart_mcux_lpuart



add flow_ctrl filed and give it initialized value
    based on hw_flow_control.
Initialize mcux lpuart based on flow_ctrl

Signed-off-by: default avatarMark Wang <yichang.wang@nxp.com>
parent 00bfac00
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2017, NXP
 * Copyright (c) 2017,2021 NXP
 * Copyright (c) 2020 Softube
 *
 * SPDX-License-Identifier: Apache-2.0
@@ -19,6 +19,7 @@ struct mcux_lpuart_config {
	const struct device *clock_dev;
	clock_control_subsys_t clock_subsys;
	uint32_t baud_rate;
	uint8_t flow_ctrl;
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
	void (*irq_config_func)(const struct device *dev);
#endif
@@ -357,7 +358,7 @@ static int mcux_lpuart_init(const struct device *dev)
	uart_api_config->parity = UART_CFG_PARITY_NONE;
	uart_api_config->stop_bits = UART_CFG_STOP_BITS_1;
	uart_api_config->data_bits = UART_CFG_DATA_BITS_8;
	uart_api_config->flow_ctrl = UART_CFG_FLOW_CTRL_NONE;
	uart_api_config->flow_ctrl = config->flow_ctrl;

	/* set initial configuration */
	mcux_lpuart_configure_init(dev, uart_api_config);
@@ -430,6 +431,8 @@ static const struct mcux_lpuart_config mcux_lpuart_##n##_config = { \
	.clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)),		\
	.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name),\
	.baud_rate = DT_INST_PROP(n, current_speed),			\
	.flow_ctrl = DT_INST_PROP(n, hw_flow_control) ?	\
		UART_CFG_FLOW_CTRL_RTS_CTS : UART_CFG_FLOW_CTRL_NONE,\
	IRQ_FUNC_INIT							\
}