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 <johann.fischer@nordicsemi.no>
This commit is contained in:
Johann Fischer 2021-08-07 10:54:03 +02:00 committed by Christopher Friedt
parent c179d83e72
commit 92a00ee39b
4 changed files with 16 additions and 11 deletions

View file

@ -122,13 +122,15 @@ minicom with flow control disabled, 115200-8N1 settings.
JTAG UART JTAG UART
--------- ---------
You can also have it send its console output to the JTAG UART. Set these in your You can also have it send its console output to the JTAG UART.
project configuration: Enable ``jtag_uart`` node in :file:`altera_max10.dts` or overlay file:
.. code-block:: console .. code-block:: devicetree
CONFIG_UART_ALTERA_JTAG=y &jtag_uart {
CONFIG_UART_CONSOLE_ON_DEV_NAME="jtag_uart0" status = "okay";
current-speed = <115200>;
};
To view these messages on your local workstation, run the terminal application To view these messages on your local workstation, run the terminal application
in the SDK: in the SDK:

View file

@ -6,7 +6,6 @@ CONFIG_HAS_ALTERA_HAL=y
CONFIG_CONSOLE=y CONFIG_CONSOLE=y
CONFIG_PRINTK=y CONFIG_PRINTK=y
CONFIG_SERIAL=y CONFIG_SERIAL=y
CONFIG_UART_ALTERA_JTAG=y
CONFIG_UART_NS16550=y CONFIG_UART_NS16550=y
CONFIG_UART_CONSOLE=y CONFIG_UART_CONSOLE=y
CONFIG_INCLUDE_RESET_VECTOR=n CONFIG_INCLUDE_RESET_VECTOR=n

View file

@ -1,7 +1,10 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
DT_COMPAT_ALTR_JTAG_UART := altr,jtag-uart
config UART_ALTERA_JTAG config UART_ALTERA_JTAG
bool "Nios II JTAG UART driver" bool "Nios II JTAG UART driver"
default $(dt_compat_enabled,$(DT_COMPAT_ALTR_JTAG_UART))
select SERIAL_HAS_DRIVER select SERIAL_HAS_DRIVER
help help
Enable the Altera JTAG UART driver, built in to many Nios II CPU Enable the Altera JTAG UART driver, built in to many Nios II CPU

View file

@ -13,6 +13,8 @@
#include "altera_avalon_jtag_uart.h" #include "altera_avalon_jtag_uart.h"
#include "altera_avalon_jtag_uart_regs.h" #include "altera_avalon_jtag_uart_regs.h"
#define DT_DRV_COMPAT altr_jtag_uart
#define UART_ALTERA_JTAG_DATA_REG 0 #define UART_ALTERA_JTAG_DATA_REG 0
#define UART_ALTERA_JTAG_CONTROL_REG 1 #define UART_ALTERA_JTAG_CONTROL_REG 1
@ -57,8 +59,7 @@ static const struct uart_device_config uart_altera_jtag_dev_cfg_0 = {
.sys_clk_freq = 0, /* Unused */ .sys_clk_freq = 0, /* Unused */
}; };
DEVICE_DEFINE(uart_altera_jtag_0, "jtag_uart0", DEVICE_DT_INST_DEFINE(0, uart_altera_jtag_init, NULL,
uart_altera_jtag_init, NULL, NULL, NULL, &uart_altera_jtag_dev_cfg_0,
&uart_altera_jtag_dev_cfg_0, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, &uart_altera_jtag_driver_api);
&uart_altera_jtag_driver_api);