Add support for Tegra UART Trace Controller (UTC) client
v6 cover Add support for Tegra UART Trace Controller (UTC) client
The Tegra UTC (UART Trace Controller) is a hardware controller that allows multiple systems within the Tegra SoC to share a hardware UART interface. It supports up to 16 clients, with each client having its own interrupt and a FIFO buffer for both RX (receive) and TX (transmit), each capable of holding 128 characters.
The Tegra UTC uses 8-N-1 configuration and operates on a pre-configured baudrate, which is configured by the bootloader.
Kartik Rajput (2):
dt-bindings: serial: Add bindings for nvidia,tegra264-utc
serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC)
.../bindings/serial/nvidia,tegra264-utc.yaml | 73 ++ drivers/tty/serial/Kconfig | 23 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/tegra-utc.c | 625 ++++++++++++++++++ 4 files changed, 722 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml create mode 100644 drivers/tty/serial/tegra-utc.c
Signature · 1 line
2.43.0
PATCH v6 1/2 dt-bindings: serial: Add bindings for nvidia,tegra264-utc
The Tegra UTC (UART Trace Controller) allows multiple clients within the Tegra SoC to share a physical UART interface. It supports up to 16 clients. Each client operates as an independent UART endpoint with a dedicated interrupt and 128-character TX/RX FIFOs.
Add device tree binding documentation for the Tegra UTC client.
---
v1 -> v2:
* Removed current-speed as it might not be accurate as the Tegra UTC multiplex data from various clients.
* Use 'tx-threshold' and 'rx-threshold' properties defined in serial.yaml instead of 'nvidia,utc-fifo-threshold'.
* Add serial.yaml reference.
* Define minimum and maximum values for threshold.
* Rephrase the documentation to clarify that we are documenting the Tegra UTC clients and not the controller itself.
--- .../bindings/serial/nvidia,tegra264-utc.yaml | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +73 -0
@@ -0,0 +1,73 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/serial/nvidia,tegra264-utc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NVIDIA Tegra UTC (UART Trace Controller) client + +maintainers: + - Kartik Rajput <[email protected]> + - Thierry Reding <[email protected]> + - Jonathan Hunter <[email protected]> + +description: + Represents a client interface of the Tegra UTC (UART Trace Controller). The + Tegra UTC allows multiple clients within the Tegra SoC to share a physical + UART interface. It supports up to 16 clients. Each client operates as an + independent UART endpoint with a dedicated interrupt and 128-character TX/RX + FIFOs. + + The Tegra UTC clients use 8-N-1 configuration and operates on a baudrate + configured by the bootloader at the controller level. + +allOf: + - $ref: serial.yaml# + +properties: + compatible: + const: nvidia,tegra264-utc + + reg: + items: + - description: TX region. + - description: RX region. + + reg-names: + items: + - const: tx + - const: rx + + interrupts: + maxItems: 1 + + tx-threshold: + minimum: 1 + maximum: 128 + + rx-threshold: + minimum: 1 + maximum: 128 + +required: + - compatible + - reg + - reg-names + - interrupts + - tx-threshold + - rx-threshold + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + + tegra_utc: serial@c4e0000 { + compatible = "nvidia,tegra264-utc"; + reg = <0xc4e0000 0x8000>, <0xc4e8000 0x8000>; + reg-names = "tx", "rx"; + interrupts = <GIC_SPI 514 IRQ_TYPE_LEVEL_HIGH>; + tx-threshold = <4>; + rx-threshold = <4>; + };
Signature · 1 line
2.43.0
PATCH v6 2/2 serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC)
In reply to Kartik RajputThe Tegra264 SoC supports the UART Trace Controller (UTC), which allows multiple firmware clients (up to 16) to share a single physical UART. Each client is provided with its own interrupt and has access to a 128-character wide FIFO for both transmit (TX) and receive (RX) operations.
Add tegra-utc driver to support Tegra UART Trace Controller (UTC) client.
---
v5 -> v6:
* Use fixed width values for the register offsets.
* Use decimal value for TEGRA_UTC_DEFAULT_FIFO_THRESHOLD.
* Replace instance of &pdev->dev with dev in tegra_utc_probe().
v4 -> v5:
* No change (posted accidentally).
v3 -> v4:
* Cleaned up included header files.
* Guard unregister_console() with CONFIG_SERIAL_TEGRA_UTC_CONSOLE macro.
* Remove unused variable val from tegra_utc_get_poll_char().
* Define TEGRA_UTC_INTR_COMMON for the common interrupts between TX and RX clients.
* Improve error messages in tegra_utc_probe().
* Minor code clean up.
v2 -> v3:
* Update included header files.
* Remove struct tegra_utc_soc and move fifosize to struct tegra_utc_port.
* Remove irq from struct tegra_utc_port and use uart_port::irq instead.
* Update tegra_utc_tx_chars to use uart_port_tx API instead.
* Remove flag variable from tegra_utc_rx_chars() as it was not really required.
* Removed mask for ch in tegra_utc_rx_chars() as both uart_handle_sysrq_char() and tty_insert_flip_char() takes u8 value.
* Update tegra_utc_isr() to return IRQ_HANDLED only when it actually handles the interrupt.
* Use uart_port_lock/unlock APIs in tegra_utc_isr() instead of using irqsave/irqrestore counterparts.
* Update tegra_utc_get_poll_char() logic to return NO_POLL_CHAR if FIFO is empty.
* Use read_poll_timeout_atomic() in tegra_utc_put_poll_char() to avoid stall.
* Introduce write_atomic/thread console APIs to make the driver CON_NBCON compatible.
* Unregister the console in tegra_utc_remove().
* Use max_chars-- instead of --max_chars in tegra_utc_rx_chars().
* Improve error handling logic of tegra_utc_startup() if request_irq() fails.
* Add trailing comma in tegra_utc_driver.
* Propagate error if uart_read_port_properties() fails.
* replace of_* APIs with device_* APIs.
v1 -> v2:
* Use dev_err_probe() in tegra_utc_probe().
* Use uart_read_port_properties() instead of manually parsing the port line.
* Remove duplicate error prints if platform_get_irq() fails.
* In tegra_utc_of_match, remove , after terminator line.
* Remove current-speed, as it is not always accurate.
--- drivers/tty/serial/Kconfig | 23 ++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/tegra-utc.c | 625 +++++++++++++++++++++++++++++++++ 3 files changed, 649 insertions(+) create mode 100644 drivers/tty/serial/tegra-utc.c
drivers/tty/serial/Kconfig +23 -0
@@ -306,6 +306,29 @@ config SERIAL_TEGRA_TCU_CONSOLE If unsure, say Y. +config SERIAL_TEGRA_UTC + tristate "NVIDIA Tegra UART Trace Controller" + depends on ARCH_TEGRA || COMPILE_TEST + select SERIAL_CORE + help + Support for Tegra UTC (UART Trace controller) client serial port. + + UTC is a HW based serial port that allows multiplexing multiple data + streams of up to 16 UTC clients into a single hardware serial port. + +config SERIAL_TEGRA_UTC_CONSOLE + bool "Support for console on a Tegra UTC serial port" + depends on SERIAL_TEGRA_UTC + select SERIAL_CORE_CONSOLE + default SERIAL_TEGRA_UTC + help + If you say Y here, it will be possible to use a Tegra UTC client as + the system console (the system console is the device which receives + all kernel messages and warnings and which allows logins in single + user mode). + + If unsure, say Y. + config SERIAL_MAX3100 tristate "MAX3100/3110/3111/3222 support" depends on SPI
drivers/tty/serial/Makefile +1 -0
@@ -86,6 +86,7 @@ obj-$(CONFIG_SERIAL_STM32) += stm32-usart.o obj-$(CONFIG_SERIAL_SUNPLUS) += sunplus-uart.o obj-$(CONFIG_SERIAL_TEGRA) += serial-tegra.o obj-$(CONFIG_SERIAL_TEGRA_TCU) += tegra-tcu.o +obj-$(CONFIG_SERIAL_TEGRA_UTC) += tegra-utc.o obj-$(CONFIG_SERIAL_TIMBERDALE) += timbuart.o obj-$(CONFIG_SERIAL_TXX9) += serial_txx9.o obj-$(CONFIG_SERIAL_UARTLITE) += uartlite.o
drivers/tty/serial/tegra-utc.c new file +625 -0
625 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v6 2/2] serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC)
Quoted 8 lines · Kartik Rajput
The Tegra264 SoC supports the UART Trace Controller (UTC), which allows multiple firmware clients (up to 16) to share a single physical UART. Each client is provided with its own interrupt and has access to a 128-character wide FIFO for both transmit (TX) and receive (RX) operations.
Add tegra-utc driver to support Tegra UART Trace Controller (UTC) client.
LGTM now, FWIW,
Signature · 2 lines
With Best Regards, Andy Shevchenko