Xavier NX (JetPack 5.1.3): How to disable UART DMA and use PIO mode via DTB?

Hello everyone,

I’m working with UART on NVIDIA Jetson Xavier NX, running JetPack 5.1.3 (L4T R35.x, kernel 5.10).

The UART is currently described in the device tree using the nvidia,tegra186-hsuart compatible and appears to be configured to use DMA (GPCDMA). I would like to modify the DTB only so that this UART runs in PIO (interrupt) mode and does not use DMA.

Current device tree node (example):

	uarta: serial@3100000 {
		compatible = "nvidia,tegra186-hsuart";
		iommus = <&smmu TEGRA_SID_GPCDMA_0>;
#if TEGRA_IOMMU_DT_VERSION >= DT_VERSION_2
		interconnects = <&mc TEGRA194_MEMORY_CLIENT_HOST1XDMAR>;
		interconnect-names = "dma-mem";
#endif
		dma-coherent;
		reg = <0x0 0x03100000 0x0 0x10000>;
		reg-shift = <2>;
		interrupts = <0 TEGRA194_IRQ_UARTA 0x04>;
		nvidia,memory-clients = <14>;
		dmas = <&gpcdma 8>, <&gpcdma 8>;
		dma-names = "rx", "tx";
		clocks = <&bpmp_clks TEGRA194_CLK_UARTA>,
			<&bpmp_clks TEGRA194_CLK_PLLP_OUT0>;
		clock-names = "serial", "parent";
		assigned-clocks = <&bpmp_clks TEGRA194_CLK_UARTA>;
		assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLP_OUT0>;
		resets = <&bpmp_resets TEGRA194_RESET_UARTA>;
		reset-names = "serial";
		nvidia,adjust-baud-rates = <115200 115200 100>;
		status = "disabled";
	};
  • Which DT properties determine whether tegra186-hsuart uses DMA or falls back to PIO mode?

  • Is there any Xavier NX–specific requirement for forcing PIO mode on UART in JetPack 5.1.3?

Any guidance or references would be appreciated.

Thank you.

Hi tuan100220,

Are you using the devkit or custom board for Xavier NX?

Please remove the following lines in device tree to make UART work with PIO mode.

	uarta: serial@3100000 {
		compatible = "nvidia,tegra186-hsuart";
		iommus = <&smmu TEGRA_SID_GPCDMA_0>;
#if TEGRA_IOMMU_DT_VERSION >= DT_VERSION_2
		interconnects = <&mc TEGRA194_MEMORY_CLIENT_HOST1XDMAR>;
		interconnect-names = "dma-mem";
#endif
-		dma-coherent;
		reg = <0x0 0x03100000 0x0 0x10000>;
		reg-shift = <2>;
		interrupts = <0 TEGRA194_IRQ_UARTA 0x04>;
		nvidia,memory-clients = <14>;
-		dmas = <&gpcdma 8>, <&gpcdma 8>;
-		dma-names = "rx", "tx";
		clocks = <&bpmp_clks TEGRA194_CLK_UARTA>,
			<&bpmp_clks TEGRA194_CLK_PLLP_OUT0>;
		clock-names = "serial", "parent";
		assigned-clocks = <&bpmp_clks TEGRA194_CLK_UARTA>;
		assigned-clock-parents = <&bpmp_clks TEGRA194_CLK_PLLP_OUT0>;
		resets = <&bpmp_resets TEGRA194_RESET_UARTA>;
		reset-names = "serial";
		nvidia,adjust-baud-rates = <115200 115200 100>;
		status = "disabled";
	};

Hi,

I am using the Xavier NX devkit.
I’m seeing a memory leak when UART runs with DMA, so I want to use UART in PIO (non-DMA) mode instead. I will try removing the DMA-related entries in the device tree.

Thanks.

Incidentally, many of the UARTs have both the legacy and the DMA drivers available simultaneously. The legacy driver produces files of the name “/dev/ttyS#”, whereas the DMA drivers produce “/dev/ttyTHS#” naming convention. I would never recommend using both simultaneously, or switching between them in a running application, but technically speaking you can have both of those present and you will only use the one your program opens. Take a look at the “serial@...address...” set for your UART and see if there are two entries. In theory you could do as mentioned and remove an entry (removing THS, or “Tegra High Speed”), or simply use the other entry. In the case of some sort of memory leak I would have to wonder if maybe there is an interaction between both drivers running together doing this.

I have updated the device tree to switch from the high-speed UART (HSUART) to the standard UART by using the following configuration:

uarta: serial@3100000 {
    compatible = "nvidia,tegra20-uart";
    reg = <0x0 0x03100000 0x0 0x10000>;
    reg-shift = <2>;
    interrupts = <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>;
    clocks = <&bpmp TEGRA194_CLK_UARTA>;
    clock-names = "serial";
    resets = <&bpmp TEGRA194_RESET_UARTA>;
    reset-names = "serial";
    status = "okay";
};

After switching from HSUART to the standard UART configuration, the issue has been resolved.

Thank you.