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: Mark Wang <yichang.wang@nxp.com>
This commit is contained in:
parent
00bfac00ae
commit
857b8508d0
1 changed files with 5 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, NXP
|
* Copyright (c) 2017,2021 NXP
|
||||||
* Copyright (c) 2020 Softube
|
* Copyright (c) 2020 Softube
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
@ -19,6 +19,7 @@ struct mcux_lpuart_config {
|
||||||
const struct device *clock_dev;
|
const struct device *clock_dev;
|
||||||
clock_control_subsys_t clock_subsys;
|
clock_control_subsys_t clock_subsys;
|
||||||
uint32_t baud_rate;
|
uint32_t baud_rate;
|
||||||
|
uint8_t flow_ctrl;
|
||||||
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
||||||
void (*irq_config_func)(const struct device *dev);
|
void (*irq_config_func)(const struct device *dev);
|
||||||
#endif
|
#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->parity = UART_CFG_PARITY_NONE;
|
||||||
uart_api_config->stop_bits = UART_CFG_STOP_BITS_1;
|
uart_api_config->stop_bits = UART_CFG_STOP_BITS_1;
|
||||||
uart_api_config->data_bits = UART_CFG_DATA_BITS_8;
|
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 */
|
/* set initial configuration */
|
||||||
mcux_lpuart_configure_init(dev, uart_api_config);
|
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_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \
|
||||||
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name),\
|
.clock_subsys = (clock_control_subsys_t)DT_INST_CLOCKS_CELL(n, name),\
|
||||||
.baud_rate = DT_INST_PROP(n, current_speed), \
|
.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 \
|
IRQ_FUNC_INIT \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue