Skip to content

Commit

Permalink
drivers: uart_altera_jtag_hal: use DEVICE_DT_INST_DEFINE()
Browse files Browse the repository at this point in the history
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 zephyrproject-rtos#37207

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
  • Loading branch information
jfischer-no committed Aug 20, 2021
1 parent 83836aa commit 2c5d2b7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
12 changes: 7 additions & 5 deletions boards/nios2/altera_max10/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ minicom with flow control disabled, 115200-8N1 settings.
JTAG UART
---------

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

.. code-block:: console
.. code-block:: devicetree
CONFIG_UART_ALTERA_JTAG=y
CONFIG_UART_CONSOLE_ON_DEV_NAME="jtag_uart0"
&jtag_uart {
status = "okay";
current-speed = <115200>;
};
To view these messages on your local workstation, run the terminal application
in the SDK:
Expand Down
1 change: 0 additions & 1 deletion boards/nios2/qemu_nios2/qemu_nios2_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ CONFIG_HAS_ALTERA_HAL=y
CONFIG_CONSOLE=y
CONFIG_PRINTK=y
CONFIG_SERIAL=y
CONFIG_UART_ALTERA_JTAG=y
CONFIG_UART_NS16550=y
CONFIG_UART_CONSOLE=y
CONFIG_INCLUDE_RESET_VECTOR=n
Expand Down
3 changes: 3 additions & 0 deletions drivers/serial/Kconfig.altera_jtag
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# SPDX-License-Identifier: Apache-2.0

DT_COMPAT_ALTR_JTAG_UART := altr,jtag-uart

config UART_ALTERA_JTAG
bool "Nios II JTAG UART driver"
default $(dt_compat_enabled,$(DT_COMPAT_ALTR_JTAG_UART))
select SERIAL_HAS_DRIVER
help
Enable the Altera JTAG UART driver, built in to many Nios II CPU
Expand Down
11 changes: 6 additions & 5 deletions drivers/serial/uart_altera_jtag_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include "altera_avalon_jtag_uart.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_CONTROL_REG 1

Expand Down Expand Up @@ -57,8 +59,7 @@ static const struct uart_device_config uart_altera_jtag_dev_cfg_0 = {
.sys_clk_freq = 0, /* Unused */
};

DEVICE_DEFINE(uart_altera_jtag_0, "jtag_uart0",
uart_altera_jtag_init, NULL, NULL,
&uart_altera_jtag_dev_cfg_0,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&uart_altera_jtag_driver_api);
DEVICE_DT_INST_DEFINE(0, uart_altera_jtag_init, NULL,
NULL, &uart_altera_jtag_dev_cfg_0,
PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE,
&uart_altera_jtag_driver_api);

0 comments on commit 2c5d2b7

Please sign in to comment.