Skip to content

Commit c179d83

Browse files
jfischer-nocfriedt
authored andcommitted
drivers: uart_mcumgr: remove CONFIG_UART_MCUMGR_ON_DEV_NAME
Remove CONFIG_UART_MCUMGR_ON_DEV_NAME and use DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr)). Add usb.overlay, which contains chosen node and cdc-acm-uart node, to smp_svr sample. Signed-off-by: Johann Fischer <[email protected]>
1 parent 72be0ed commit c179d83

File tree

6 files changed

+24
-17
lines changed

6 files changed

+24
-17
lines changed

doc/releases/release-notes-2.7.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Removed APIs in this release
5050
* Removed ``CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_ACM`` and
5151
``CONFIG_OPENTHREAD_COPROCESSOR_SPINEL_ON_UART_DEV_NAME`` Kconfig options
5252
in favor of chosen node ``zephyr,ot-uart``.
53+
* Removed ``CONFIG_UART_MCUMGR_ON_DEV_NAME`` Kconfig option
54+
in favor of direct use of chosen node ``zephyr,uart-mcumgr``.
5355

5456
============================
5557

drivers/console/Kconfig

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -246,17 +246,6 @@ config UART_MCUMGR
246246

247247
if UART_MCUMGR
248248

249-
# Workaround for not being able to have commas in macro arguments
250-
DT_CHOSEN_Z_UART_MCUMGR := zephyr,uart-mcumgr
251-
252-
config UART_MCUMGR_ON_DEV_NAME
253-
string "Device Name of UART Device for mcumgr UART"
254-
default "$(dt_chosen_label,$(DT_CHOSEN_Z_UART_MCUMGR))" if HAS_DTS
255-
default "UART_0"
256-
help
257-
This option specifies the name of UART device to be used
258-
for mcumgr UART.
259-
260249
config UART_MCUMGR_RX_BUF_SIZE
261250
int "Size of receive buffer for mcumgr fragments received over UART, in bytes"
262251
default 128

drivers/console/uart_mcumgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,9 +246,9 @@ void uart_mcumgr_register(uart_mcumgr_recv_fn *cb)
246246
{
247247
uart_mgumgr_recv_cb = cb;
248248

249-
uart_mcumgr_dev = device_get_binding(CONFIG_UART_MCUMGR_ON_DEV_NAME);
249+
uart_mcumgr_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr));
250250

251-
if (uart_mcumgr_dev != NULL) {
251+
if (device_is_ready(uart_mcumgr_dev)) {
252252
uart_mcumgr_setup(uart_mcumgr_dev);
253253
}
254254
}
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
# Enable USB subsystem
22
CONFIG_USB_DEVICE_STACK=y
3-
CONFIG_USB_CDC_ACM=y
4-
CONFIG_UART_INTERRUPT_DRIVEN=y
3+
CONFIG_SERIAL=y
54
CONFIG_UART_LINE_CTRL=y
65
# USB backend is serial device
76
CONFIG_MCUMGR_SMP_UART=y
8-
# Choose USB serial device for backend (CDC_ACM)
9-
CONFIG_UART_MCUMGR_ON_DEV_NAME="CDC_ACM_0"

samples/subsys/mgmt/mcumgr/smp_svr/sample.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ tests:
1818
platform_allow: frdm_k64f
1919
sample.mcumg.smp_svr.cdc:
2020
extra_args: OVERLAY_CONFIG="overlay-cdc.conf"
21+
DTC_OVERLAY_FILE="usb.overlay"
2122
platform_allow: nrf52833dk_nrf52820 nrf52833dk_nrf52833 nrf52840dk_nrf52840 nrf5340dk_nrf5340_cpuapp
2223
sample.mcumg.smp_svr.serial:
2324
extra_args: OVERLAY_CONFIG="overlay-serial.conf"
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* Copyright (c) 2021 Nordic Semiconductor ASA
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
chosen {
9+
zephyr,uart-mcumgr = &cdc_acm_uart0;
10+
};
11+
};
12+
13+
&zephyr_udc0 {
14+
cdc_acm_uart0: cdc_acm_uart0 {
15+
compatible = "zephyr,cdc-acm-uart";
16+
label = "CDC_ACM_0";
17+
};
18+
};

0 commit comments

Comments
 (0)