drivers: serial: native_posix: Convert 2nd UART to be devicetree based

The first uart instance was already devicetree based.  To be consistent
convert the second instance to also be devicetree based.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2021-02-16 16:41:38 -06:00 committed by Alberto Escolar
commit c1e1273df2
3 changed files with 13 additions and 12 deletions

View file

@ -131,6 +131,16 @@
current-speed = <0>;
};
uart1: uart_1 {
status = "okay";
compatible = "zephyr,native-posix-uart";
label = "UART_1";
/* Dummy current-speed entry to comply with serial
* DTS binding
*/
current-speed = <0>;
};
rng: rng {
status = "okay";
compatible = "zephyr,native-posix-rng";

View file

@ -56,14 +56,6 @@ config UART_NATIVE_POSIX_PORT_1_ENABLE
This is used for example in PPP (Point-to-Point Protocol)
implementation.
config UART_NATIVE_POSIX_PORT_1_NAME
string "Port 1 Device Name"
default "UART_1"
depends on UART_NATIVE_POSIX_PORT_1_ENABLE
help
This is the device name for UART, and is included in the device
struct.
config NATIVE_UART_AUTOATTACH_DEFAULT_CMD
string "Default command to attach the UART to a new terminal"
default "xterm -e screen %s &"

View file

@ -253,7 +253,7 @@ static int np_uart_1_init(const struct device *dev)
d = (struct native_uart_status *)dev->data;
tty_fn = open_tty(d, CONFIG_UART_NATIVE_POSIX_PORT_1_NAME, false);
tty_fn = open_tty(d, DT_INST_LABEL(1), false);
d->in_fd = tty_fn;
d->out_fd = tty_fn;
@ -371,9 +371,8 @@ DEVICE_DT_INST_DEFINE(0,
&np_uart_driver_api_0);
#if defined(CONFIG_UART_NATIVE_POSIX_PORT_1_ENABLE)
DEVICE_DEFINE(uart_native_posix1,
CONFIG_UART_NATIVE_POSIX_PORT_1_NAME, &np_uart_1_init,
device_pm_control_nop,
DEVICE_DT_INST_DEFINE(1,
&np_uart_1_init, device_pm_control_nop,
(void *)&native_uart_status_1, NULL,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&np_uart_driver_api_1);