@@ -144,8 +144,7 @@ static size_t pack_uart_w91_configure(uint8_t inst, void *unpack_data, uint8_t *
144
144
145
145
IPC_DISPATCHER_UNPACK_FUNC_ONLY_WITH_ERROR_PARAM (uart_w91_configure );
146
146
147
- static int uart_w91_configure (const struct device * dev ,
148
- const struct uart_config * cfg )
147
+ static int uart_w91_configure (const struct device * dev , const struct uart_config * cfg )
149
148
{
150
149
int err = - ETIMEDOUT ;
151
150
struct uart_w91_config_req config_req = {};
@@ -187,8 +186,10 @@ static int uart_w91_configure(const struct device *dev,
187
186
}
188
187
189
188
/* check flow control */
190
- if (cfg -> flow_ctrl != UART_CFG_FLOW_CTRL_NONE &&
191
- cfg -> flow_ctrl != UART_CFG_FLOW_CTRL_RTS_CTS ) {
189
+ if (cfg -> flow_ctrl == UART_CFG_FLOW_CTRL_NONE ||
190
+ cfg -> flow_ctrl == UART_CFG_FLOW_CTRL_RTS_CTS ) {
191
+ config_req .flow_ctrl = cfg -> flow_ctrl ;
192
+ } else {
192
193
return - ENOTSUP ;
193
194
}
194
195
@@ -296,8 +297,7 @@ static int uart_w91_read(const struct device *dev, uint8_t *rx_data, const int s
296
297
}
297
298
298
299
/* API implementation: config_get */
299
- static int uart_w91_config_get (const struct device * dev ,
300
- struct uart_config * cfg )
300
+ static int uart_w91_config_get (const struct device * dev , struct uart_config * cfg )
301
301
{
302
302
struct uart_w91_data * data = dev -> data ;
303
303
@@ -625,13 +625,14 @@ static int uart_w91_driver_init(const struct device *dev)
625
625
int err ;
626
626
const struct uart_w91_config * cfg = dev -> config ;
627
627
struct uart_w91_data * data = dev -> data ;
628
- struct uart_config * config = & data -> cfg ;
629
- uint8_t inst = ((struct uart_w91_config * )dev -> config )-> instance_id ;
628
+ struct uart_config config ;
630
629
631
630
ipc_based_driver_init (& data -> ipc );
632
631
633
632
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
634
633
/* once for all UART instances */
634
+ uint8_t inst = ((struct uart_w91_config * )dev -> config )-> instance_id ;
635
+
635
636
if (!uart_irq_thread_initialized ) {
636
637
k_tid_t thread_id = k_thread_create (& uart_irq_thread_data ,
637
638
uart_irq_thread_stack , K_THREAD_STACK_SIZEOF (uart_irq_thread_stack ),
@@ -656,12 +657,13 @@ static int uart_w91_driver_init(const struct device *dev)
656
657
return err ;
657
658
}
658
659
659
- data -> cfg .baudrate = cfg -> baud_rate ;
660
- data -> cfg .data_bits = UART_CFG_DATA_BITS_8 ;
661
- data -> cfg .parity = UART_CFG_PARITY_NONE ;
662
- data -> cfg .stop_bits = UART_CFG_STOP_BITS_1 ;
660
+ config .baudrate = cfg -> baud_rate ;
661
+ config .parity = UART_CFG_PARITY_NONE ;
662
+ config .stop_bits = UART_CFG_STOP_BITS_1 ;
663
+ config .data_bits = UART_CFG_DATA_BITS_8 ;
664
+ config .flow_ctrl = cfg -> hw_flow_control ;
663
665
664
- err = uart_w91_configure (dev , config );
666
+ err = uart_w91_configure (dev , & config );
665
667
666
668
return err ;
667
669
}
0 commit comments