Add support for Tegra UART Trace Controller (UTC) client
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 | 83 +++ drivers/tty/serial/Kconfig | 23 + drivers/tty/serial/Makefile | 1 + drivers/tty/serial/tegra-utc.c | 641 ++++++++++++++++++ 4 files changed, 748 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 1/2 dt-bindings: serial: Add bindings for nvidia,tegra264-utc
The Tegra UTC (UART Trace Controller) is a HW based serial port that allows multiplexing multiple data streams of up to 16 UTC clients into a single hardware serial port.
Add bindings for the Tegra UTC client device.
--- .../bindings/serial/nvidia,tegra264-utc.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +83 -0
@@ -0,0 +1,83 @@ +# 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 UART Trace Controller (UTC) client + +maintainers: + - Kartik Rajput <[email protected]> + - Thierry Reding <[email protected]> + - Jonathan Hunter <[email protected]> + +description: + 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. + +properties: + $nodename: + pattern: "^serial(@.*)?$" + + compatible: + const: nvidia,tegra264-utc + + reg: + items: + - description: Register region for TX client. + - description: Register region for RX client. + minItems: 2 + + reg-names: + items: + - const: tx + - const: rx + minItems: 2 + + interrupts: + maxItems: 1 + + current-speed: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This property specifies the baudrate at which the Tegra UTC is + operating. + + nvidia,utc-fifo-threshold: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This property specifies the UTC TX and RX client FIFO threshold in + terms of occupancy. + + This property should have the same value as the burst size (number + of characters read by the Tegra UTC hardware at a time from each + client) which is configured by the bootloader. + +required: + - compatible + - reg + - reg-names + - interrupts + - current-speed + - nvidia,utc-fifo-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>; + current-speed = <115200>; + nvidia,utc-fifo-threshold = <4>; + };
Signature · 1 line
2.43.0
Re: [PATCH 1/2] dt-bindings: serial: Add bindings for nvidia,tegra264-utc
Quoted 18 lines · Kartik Rajput
The Tegra UTC (UART Trace Controller) is a HW based serial port that allows multiplexing multiple data streams of up to 16 UTC clients into a single hardware serial port.
Add bindings for the Tegra UTC client device.
Signed-off-by Kartik Rajput <[email protected]>--- .../bindings/serial/nvidia,tegra264-utc.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yamlDocumentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +0
-0
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml line 7
Quoted 7 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +7
-0@@ -0,0 +1,83 @@ +# 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 UART Trace Controller (UTC) client
Controller and client (Client?) sound conflicting. What is this client of?
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml line 19
Quoted 12 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +12
-0+ +maintainers: + - Kartik Rajput <[email protected]> + - Thierry Reding <[email protected]> + - Jonathan Hunter <[email protected]> + +description: + 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.
So is this client or the controller?
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml line 26
Quoted 7 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +7
-0+ + The Tegra UTC uses 8-N-1 configuration and operates on a pre-configured + baudrate, which is configured by the bootloader. + +properties: + $nodename: + pattern: "^serial(@.*)?$"
Drop, not needed. But you miss proper $ref, see other bindings.
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml line 33
Quoted 7 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +7
-0+ + compatible: + const: nvidia,tegra264-utc + + reg: + items: + - description: Register region for TX client.
Drop redundant parts, so just "TX region".
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml line 35
Quoted 2 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +2
-0+ - description: Register region for RX client. + minItems: 2
Drop
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml line 41
Quoted 6 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +6
-0+ + reg-names: + items: + - const: tx + - const: rx + minItems: 2
Drop. Please take a look at other bindings how they do things. There is no such code anywhere in the kernel.
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml line 49
Quoted 8 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +8
-0+ + interrupts: + maxItems: 1 + + current-speed: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This property specifies the baudrate at which the Tegra UTC is
Drop "This property specifies the". Do not say what Devicetree syntax is. We all know. This is a description of hardware, not the DTS langauge.
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml line 60
Quoted 11 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yaml new file +11
-0+ operating. + + nvidia,utc-fifo-threshold: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + This property specifies the UTC TX and RX client FIFO threshold in + terms of occupancy. + + This property should have the same value as the burst size (number + of characters read by the Tegra UTC hardware at a time from each + client) which is configured by the bootloader.
Title says this is a client, so quite confusing. Anyway, why is this board specific?
Also, missing constraints, missing units. Why common serial properties are not applicable?
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: serial: Add bindings for nvidia,tegra264-utc
Thanks for reviewing the patch Krzysztof!
Quoted 33 lines · Krzysztof Kozlowski
External email: Use caution opening links or attachments
Quoted 29 lines · Kartik Rajput
The Tegra UTC (UART Trace Controller) is a HW based serial port that
allows multiplexing multiple data streams of up to 16 UTC clients into
a single hardware serial port.Add bindings for the Tegra UTC client device.
Signed-off-by Kartik Rajput <[email protected]>---
.../bindings/serial/nvidia,tegra264-utc.yaml | 83
+++++++++++++++++++1 file changed, 83 insertions(+)create mode 100644
Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yamldiff --git
a/Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yamlb/Documentation/devicetree/bindings/serial/nvidia,tegra264-utc.yamlnew file mode 100644
index 000000000000..63ba3655451fDocumentation/devicetree/bindings/serial/nvidia,tegra264- new file +0
-0
utc.yamlDocumentation/devicetree/bindings/serial/nvidia,tegra264- new file +4
-0@@ -0,0 +1,83 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id:
Quoted 9 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-
Quoted 4 lines
http://devicetree.org/schemas/serial/nvidia,tegra264-utc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#Documentation/devicetree/bindings/serial/nvidia,tegra264- new file +2
-0+ +title: NVIDIA Tegra UART Trace Controller (UTC) clientController and client (Client?) sound conflicting. What is this client
of?
This DT binding document is for the Tegra UTC client.
The Tegra UTC (UART Trace Controller) is a controller that allows sharing a single physical UART across multiple firmwares/OS. It supports up-to 16 client interfaces, each client have its own RX and TX FIFO and an interrupt. The Tegra UTC controller is managed by the bootloader and its clients are managed by firmwares/OS.
The firmwares/OS can use these client interfaces to send/receive data over the UART by reading/writing from/to the client FIFOs. The Tegra UTC multiplexes and de-multiplexes the data from/to each client FIFOs and sends/receive that over a physical UART.
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264- new file +8
-0+ +maintainers: + - Kartik Rajput <[email protected]> + - Thierry Reding <[email protected]> + - Jonathan Hunter <[email protected]> + +description: + The Tegra UTC (UART Trace Controller) is a hardware controllerthat
+ allows multiple systems within the Tegra SoC to share a hardware
Quoted 9 lines
Quoted 6 lines
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.So is this client or the controller?
This is for the The Tegra UTC client interface. The Tegra UTC controller is managed by the bootloader.
Quoted 12 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-
Quoted 8 lines
+
+ The Tegra UTC uses 8-N-1 configuration and operates on a pre- configured
+ baudrate, which is configured by the bootloader.Documentation/devicetree/bindings/serial/nvidia,tegra264- new file +4
-0+ +properties: + $nodename: + pattern: "^serial(@.*)?$"Drop, not needed. But you miss proper $ref, see other bindings.
Ack. I'll fix this in v2.
Quoted 10 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264-
Quoted 7 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264- new file +7
-0+ + compatible: + const: nvidia,tegra264-utc + + reg: + items: + - description: Register region for TX client.Drop redundant parts, so just "TX region".
Ack. I'll fix this in v2.
Quoted 5 lines
Quoted 2 lines
+ - description: Register region for RX client. + minItems: 2
Drop
Ack. I'll fix this in v2.
Quoted 11 lines
Quoted 6 lines
+
+ reg-names:
+ items:
+ - const: tx
+ - const: rx
+ minItems: 2Drop. Please take a look at other bindings how they do things. There is
no such code anywhere in the kernel.
Ack. I'll fix this in v2.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/serial/nvidia,tegra264- new file +5
-0+ + interrupts: + maxItems: 1 + + current-speed:
Quoted 9 lines
Quoted 4 lines
+ $ref: /schemas/types.yaml#/definitions/uint32
+ description:
+ This property specifies the baudrate at which the Tegra UTC isDrop "This property specifies the". Do not say what Devicetree syntax is. We all know. This is a description of hardware, not the DTS langauge.
Ack. I'll fix this in v2.
Quoted 9 lines
Quoted 9 lines
+ operating.
+
+ nvidia,utc-fifo-threshold:
+ $ref: /schemas/types.yaml#/definitions/uint32 + description:
+ This property specifies the UTC TX and RX client FIFO threshold in
+ terms of occupancy.
+
Quoted 8 lines
Quoted 5 lines
+ This property should have the same value as the burst size (number
+ of characters read by the Tegra UTC hardware at a time from each
+ client) which is configured by the bootloader.Title says this is a client, so quite confusing. Anyway, why is this board specific?
The client FIFO threshold should match the burst size configured in the UTC controller by bootloader. This value could change depending on what bootloader has programmed. Hence, this is moved to the device-tree.
Quoted 5 lines
Also, missing constraints, missing units. Why common serial properties
are not applicable?
I do see current-speed defined in serial-peripheral-props.yaml, that can be used here. I also see "rx-threshold" and "tx-threshold" properties defined in serial.yaml, maybe those can be utilized here. I will update this in v2.
Quoted 3 lines
Best regards,
Krzysztof
Thanks & Regards,
Kartik
Re: [PATCH 1/2] dt-bindings: serial: Add bindings for nvidia,tegra264-utc
Quoted 7 lines · Kartik Rajput
Thanks for reviewing the patch Krzysztof!
Quoted 4 lines · Krzysztof Kozlowski
External email: Use caution opening links or attachments
On Tue, Jan 28, 2025 at 12:16:32PM +0530, Kartik Rajput wrote:
[...]
Quoted 26 lines
Quoted 13 lines
Quoted 4 lines
+ nvidia,utc-fifo-threshold:
+ $ref: /schemas/types.yaml#/definitions/uint32 + description:
+ This property specifies the UTC TX and RX client FIFOQuoted 8 lines
threshold in
+ terms of occupancy.
+
+ This property should have the same value as the burst size (number
+ of characters read by the Tegra UTC hardware at a time from each
+ client) which is configured by the bootloader.Quoted 2 lines
Title says this is a client, so quite confusing. Anyway, why is this board specific?
The client FIFO threshold should match the burst size configured in the UTC controller by bootloader. This value could change depending on what bootloader has programmed. Hence, this is moved to the device-tree.
Quoted 5 lines
Also, missing constraints, missing units. Why common serial properties
are not applicable?
Quoted 4 lines
I do see current-speed defined in
serial-peripheral-props.yaml, that can be used here. I also see "rx-threshold" and "tx-threshold" properties defined inserial.yaml, maybe those can be utilized here. I will update this in v2.
I suppose "rx-threshold" and "tx-threshold" could be used instead of the custom "nvidia,utc-fifo-threshold" property. It looks like the hardware has separate values for the threshold in both directions, so this would give us a more accurate description (though from the current state of affairs it looks like both are always going to be the same).
I'm not so sure about "current-speed", though. There's no concept of speed for the UTC, right? It's effectively backed by a physical UART that will run at a certain speed, but given that it will multiplex data from a variety of sources, "current-speed" will not be accurate in many cases.
Thierry
PATCH 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.
--- drivers/tty/serial/Kconfig | 23 ++ drivers/tty/serial/Makefile | 1 + drivers/tty/serial/tegra-utc.c | 641 +++++++++++++++++++++++++++++++++ 3 files changed, 665 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 +641 -0
641 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 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.
...
drivers/tty/serial/tegra-utc.c line 548
Quoted 12 lines
drivers/tty/serial/tegra-utc.c new file +12
-0+static int tegra_utc_probe (struct platform_device *pdev) +{ +struct device_node *np = pdev->dev.of_node; +struct tegra_utc_port *tup; +int index; +int ret; + + index =of_alias_get_id (np,"serial" ); +if (index <0 ) { +dev_err (&pdev->dev,"failed to get alias id, err %d\n" , index); +return index; + }
Can we please use uart_read_port_properties() instead of open-coding everything again and again?
drivers/tty/serial/tegra-utc.c line 554
Quoted 5 lines
drivers/tty/serial/tegra-utc.c new file +5
-0+ tup =devm_kzalloc (&pdev->dev,sizeof (struct tegra_utc_port ),GFP_KERNEL ); +if (!tup) +return -ENOMEM ; + + ret =of_property_read_u32 (np,"current-speed" , &tup->baudrate);
Why not clock-frequency? But if needed, add this to the above mentioned API as I know more than one driver may utilise this.
drivers/tty/serial/tegra-utc.c line 556
Quoted 2 lines
drivers/tty/serial/tegra-utc.c new file +2
-0+if (ret) { +dev_err (&pdev->dev,"missing current-speed device-tree property\n" );
With
struct device *dev = &pdev-dev;
this and other lines will be neater.
Review
Quoted 1 line
(quoted diff) +1
-0+ return ret;
return dev_err_probe(...);
drivers/tty/serial/tegra-utc.c line 568
Quoted 12 lines
drivers/tty/serial/tegra-utc.c new file +11
-0+ } + + ret =of_property_read_u32 (np,"nvidia,utc-fifo-threshold" , &tup->fifo_threshold); +if (ret) { +dev_err (&pdev->dev,"missing nvidia,fifo-threshold device-tree property\n" ); +return ret; + } + + tup->irq =platform_get_irq (pdev,0 ); +if (tup->irq <0 ) { +dev_err (&pdev->dev,"failed to get interrupt\n" );
Dup. This error report is done by the above API.
Quoted 18 lines
drivers/tty/serial/tegra-utc.c new file +16
-0+return tup->irq; + } + tup->soc =of_device_get_match_data (&pdev->dev); + tup->tx_base =devm_platform_ioremap_resource_byname (pdev,"tx" ); +if (IS_ERR (tup->tx_base)) +return PTR_ERR (tup->tx_base); + + tup->rx_base =devm_platform_ioremap_resource_byname (pdev,"rx" ); +if (IS_ERR (tup->rx_base)) +return PTR_ERR (tup->rx_base); + +tegra_utc_setup_port (&pdev->dev, tup, index); +platform_set_drvdata (pdev, tup); + +return tegra_utc_register_port (tup); +}
...
drivers/tty/serial/tegra-utc.c line 601
Quoted 3 lines
drivers/tty/serial/tegra-utc.c new file +3
-0+static const struct of_device_id tegra_utc_of_match[] = { + { .compatible ="nvidia,tegra264-utc" , .data = &tegra264_utc_soc }, + {},
No comma for the terminator line.
Quoted 1 line
+};
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/2] serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC)
Thanks for reviewing the patch Andy!
Quoted 26 lines · Andy Shevchenko
External email: Use caution opening links or attachments
Quoted 10 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.
...
Quoted 9 lines
drivers/tty/serial/tegra-utc.c new file +9
-0+static int tegra_utc_probe (struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.of_node; + struct tegra_utc_port *tup; + int index; + int ret; + + index = of_alias_get_id(np, "serial"); + if (index < 0) {
Quoted 9 lines
Quoted 4 lines
+
dev_err(&pdev->dev, "failed to get alias id, err %d\n", index);
+ return index;
+ }Can we please use
uart_read_port_properties()instead of open-coding everything
again and again?
Ack. I will use uart_read_port_properties() in v2.
Quoted 6 lines
Quoted 6 lines
+ tup =
devm_kzalloc(&pdev->dev, sizeof(struct tegra_utc_port), GFP_KERNEL);
+ if (!tup)
+ return-ENOMEM;
+
+ ret = of_property_read_u32(np, "current-speed", &tup-
Quoted 7 lines
Quoted 1 line
Quoted 1 line
baudrate);
Why not clock-frequency? But if needed, add this to the above mentioned API as
I know more than one driver may utilise this.
"current-speed" is to specify the baudrate at which the UTC is operating. Not sure if "clock-frequency" is the ideal property for this as we are not configuring any clocks in the driver.
Also, to add this in uart_read_port_properties() would require updating uart_port stucture to store the baudrate value. Would this be fine? Asking because I do not see termios related configurations stored in uart_port structure.
Quoted 6 lines
Quoted 3 lines
+ if (ret) {
+dev_err(&pdev->dev, "missing current-speed device- tree property\n");With
Quoted 8 lines
struct device *dev = &pdev-dev;
this and other lines will be neater.
Quoted 1 line
+ return ret;
return
dev_err_probe(...);
Ack. I will update this in v2.
Quoted 13 lines
Quoted 12 lines
+ }
+
+ ret =of_property_read_u32(np, "nvidia,utc-fifo-threshold", &tup->fifo_threshold);
+ if (ret) {
+dev_err(&pdev->dev, "missing nvidia,fifo-threshold device-tree property\n");
+ return ret;
+ }
+
+tup->irq=platform_get_irq(pdev, 0);
+ if (tup->irq< 0) {
Quoted 4 lines
Quoted 1 line
+
dev_err(&pdev->dev, "failed to get interrupt\n");Dup. This error report is done by the above API.
Ack. I will fix this in v2.
Quoted 23 lines
Quoted 20 lines
+ return
tup->irq;
+ }+
tup->soc=of_device_get_match_data(&pdev->dev);+
tup->tx_base=devm_platform_ioremap_resource_byname(pdev, "tx");
+ if (IS_ERR(tup->tx_base))
+ returnPTR_ERR(tup->tx_base);
+
+tup->rx_base=devm_platform_ioremap_resource_byname(pdev, "rx");
+ if (IS_ERR(tup->rx_base))
+ returnPTR_ERR(tup->rx_base);drivers/tty/serial/tegra-utc.c new file +6
-0+ + tegra_utc_setup_port(&pdev->dev, tup, index); + platform_set_drvdata(pdev, tup); + + return tegra_utc_register_port(tup); +}...
Quoted 9 lines
Quoted 4 lines
+static const struct
of_device_idtegra_utc_of_match[] = { + { .compatible = "nvidia,tegra264-utc", .data =&tegra264_utc_soc},
+ {},No comma for the terminator line.
Quoted 1 line
+};
Ack. I will fix this in v2.
Quoted 5 lines
--
With Best Regards,
Andy Shevchenko
Thanks & Regards,
Kartik
Re: [PATCH 2/2] serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC)
Quoted 2 lines · Kartik Rajput
Quoted 1 line · Andy Shevchenko
On Tue, Jan 28, 2025 at 12:16:33PM +0530, Kartik Rajput wrote:
...
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
+ ret = of_property_read_u32(np, "current-speed", &tup-
Quoted 1 line
baudrate);
Why not clock-frequency? But if needed, add this to the above mentioned API as
I know more than one driver may utilise this."current-speed" is to specify the baudrate at which the UTC is operating. Not sure if "clock-frequency" is the ideal property for this as we are not configuring any clocks in the driver.
I didn't say anything about configuring clocks. The clock-frequency property is standard way to provide a functional frequency of the UART (usually some MHz crystal) which you can divide by the known HW coefficients and get the baud rate (but yes, I agree that this is HW-dependent and needs to be thought through).
Quoted 2 lines
Also, to add this in
uart_read_port_properties()would require updatinguart_portstucture to store the baudrate value. Would this be fine?
Sure, it requires some members to be defined beforehand.
Quoted 2 lines
Asking because I do not see termios related configurations stored in
uart_portstructure.
Yeah, the only one is uartclk. But again, if you need current-speed to be parsed, consider doing this in the uart_read_port_properties() and saving as uartclk in the known way.
Technically it's possible to add a new member to uart_port, but it has a lot of downsides as I can see: additional memory, added ambiguity to how parse uartclk and current speed if they both are defined.
Signature · 2 lines
With Best Regards, Andy Shevchenko