Skip to content

Commit 92a00ee

Browse files
jfischer-nocfriedt
authored andcommitted
drivers: uart_altera_jtag_hal: use DEVICE_DT_INST_DEFINE()
The conversion to devicetree seems to be half lost for this driver. There are already bindings and nodes for compatible "altr,jtag-uart", update driver to use it. Remove last mention of CONFIG_UART_CONSOLE_ON_DEV_NAME. Resolves #37207 Signed-off-by: Johann Fischer <[email protected]>
1 parent c179d83 commit 92a00ee

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

boards/nios2/altera_max10/doc/index.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,15 @@ minicom with flow control disabled, 115200-8N1 settings.
122122
JTAG UART
123123
---------
124124

125-
You can also have it send its console output to the JTAG UART. Set these in your
126-
project configuration:
125+
You can also have it send its console output to the JTAG UART.
126+
Enable ``jtag_uart`` node in :file:`altera_max10.dts` or overlay file:
127127

128-
.. code-block:: console
128+
.. code-block:: devicetree
129129
130-
CONFIG_UART_ALTERA_JTAG=y
131-
CONFIG_UART_CONSOLE_ON_DEV_NAME="jtag_uart0"
130+
&jtag_uart {
131+
status = "okay";
132+
current-speed = <115200>;
133+
};
132134
133135
To view these messages on your local workstation, run the terminal application
134136
in the SDK:

boards/nios2/qemu_nios2/qemu_nios2_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ CONFIG_HAS_ALTERA_HAL=y
66
CONFIG_CONSOLE=y
77
CONFIG_PRINTK=y
88
CONFIG_SERIAL=y
9-
CONFIG_UART_ALTERA_JTAG=y
109
CONFIG_UART_NS16550=y
1110
CONFIG_UART_CONSOLE=y
1211
CONFIG_INCLUDE_RESET_VECTOR=n

drivers/serial/Kconfig.altera_jtag

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# SPDX-License-Identifier: Apache-2.0
22

3+
DT_COMPAT_ALTR_JTAG_UART := altr,jtag-uart
4+
35
config UART_ALTERA_JTAG
46
bool "Nios II JTAG UART driver"
7+
default $(dt_compat_enabled,$(DT_COMPAT_ALTR_JTAG_UART))
58
select SERIAL_HAS_DRIVER
69
help
710
Enable the Altera JTAG UART driver, built in to many Nios II CPU

drivers/serial/uart_altera_jtag_hal.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include "altera_avalon_jtag_uart.h"
1414
#include "altera_avalon_jtag_uart_regs.h"
1515

16+
#define DT_DRV_COMPAT altr_jtag_uart
17+
1618
#define UART_ALTERA_JTAG_DATA_REG 0
1719
#define UART_ALTERA_JTAG_CONTROL_REG 1
1820

@@ -57,8 +59,7 @@ static const struct uart_device_config uart_altera_jtag_dev_cfg_0 = {
5759
.sys_clk_freq = 0, /* Unused */
5860
};
5961

60-
DEVICE_DEFINE(uart_altera_jtag_0, "jtag_uart0",
61-
uart_altera_jtag_init, NULL, NULL,
62-
&uart_altera_jtag_dev_cfg_0,
63-
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
64-
&uart_altera_jtag_driver_api);
62+
DEVICE_DT_INST_DEFINE(0, uart_altera_jtag_init, NULL,
63+
NULL, &uart_altera_jtag_dev_cfg_0,
64+
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
65+
&uart_altera_jtag_driver_api);

0 commit comments

Comments
 (0)