Keep `uart1_tx` low at boot

Hello,

I’ve written a custom driver that grabs the UART1_TX (<&tegra_main_gpio TEGRA_GPIO(R, 2) 0x00>) pin on the Jetson AGX Xavier devkit’s 40-pin header and sets it to low.

I need this pin to stay low until I manually set it to high from userspace. However, my driver is not loaded until ~25s after the Jetson has booted. Immediately after receiving power, the Jetson will set this pin to high. I believe it is being captured and used by the UART driver. How do I prevent this pin from being set to high while the Xavier is booting? I cannot use a different pin. Currently running L4T 35.2.1

Some kernel logs:

root@jetson-agx-xavier-devkit:~ $ dmesg | grep -i gpio
[    0.991184] gpio gpiochip0: gpio-line-names specifies 210 line names but there are 224 lines on the chip
...
[    0.992976] gpiochip_setup_dev: registered GPIOs 288 to 511 on device: gpiochip0 (tegra-gpio)
[    1.002309] gpio gpiochip1: gpio-line-names specifies 30 line names but there are 40 lines on the chip
...
[    1.002976] gpiochip_setup_dev: registered GPIOs 248 to 287 on device: gpiochip1 (tegra-gpio-aon)
...
[    1.202837] gpiochip_setup_dev: registered GPIOs 240 to 247 on device: gpiochip2 (max77620-gpio)
[    1.881252] gpio tegra-gpio wake71 for gpio=98(M:2)
[    4.439810] gpio tegra-gpio-aon wake25 for gpio=32(EE:0)
[    4.496308] gpio tegra-gpio-aon wake48 for gpio=10(BB:2)
[   17.211942] FAN:gpio request success.
[   17.212031] FAN: can't find tach_gpio
[   17.315072] sdhci-tegra 3400000.sdhci: Got CD GPIO
[   17.386606] gpio tegra-gpio wake8 for gpio=55(G:7)
[   19.270228] gpio tegra-gpio wake12 for gpio=149(S:5)
[   21.191829] gpio tegra-gpio wake67 for gpio=48(G:0)
[   21.191926] gpio tegra-gpio-aon wake29 for gpio=36(EE:4)
[   21.192050] input: gpio-keys as /devices/gpio-keys/input/input5
[   24.029266] my-gpio-driver: (INFO) my_gpio_driver_probe
[   24.029408] my-gpio-driver: (INFO) Attempting to configure 1 pins
[   24.032756] my-gpio-driver: (INFO) Set pi_pin->miscdev.name to my-gpio-driver!uart1-tx
[   24.032874] my-gpio-driver: (INFO) Initialized uart1-tx as output-low
[   24.032877] my-gpio-driver: (INFO) Acquired GPIO
[   24.207613] my-gpio-driver: (INFO) Probe successful.
[   25.683750] gpio tegra-gpio wake20 for gpio=52(G:4)

Excerpt from my overlay file:

    my-gpio-driver {
        compatible = "nvidia,my-gpio-driver";
        status = "okay";

        uart1-tx {
            pin-name = "uart1-tx";
            pgpio-gpios = <&tegra_main_gpio TEGRA_GPIO(R, 2) 0x00>;
            output-low;
        };
    };

Hi,
Do you use pinmux spreadsheet to set the pin to GPIO and initial state to low? Generally it shall work well if the pin is configured correctly in the spreadsheet.

Is it possible to make this change by patching the devicetree directly?

@DaneLLL we used the spreadsheet to update tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg and this does bring the pin to low earlier, but the pin is still being set to high for about 10 seconds after boot.

From inspecting the serial console and watching pinout of uart1_tx, I can tell that the pin is set high somewhere in here:

[0000.344] I> Welcome to MB2(TBoot-BPMP) (version: 00.00.2018.32-mobile-6fc80c72)
[0000.344] I> DMA Heap @ [0x526fa000 - 0x52ffa000]
[0000.345] I> Default Heap @ [0xd486400 - 0xd48a400]
[0000.345] E> DEVICE_PROD: Invalid value data = 70020000, size = 0.
[0000.351] W> device prod register failed
[0000.355] I> gpio framework initialized
[0000.359] I> tegrabl_gpio_driver_register: register 'nvidia,tegra194-gpio' driver
[0000.366] I> tegrabl_gpio_driver_register: register 'nvidia,tegra194-gpio-aon' driver
[0000.374] I> No valid sdcard_params in mb1_bct
[0000.378] I> Boot-device: eMMC
[0000.381] I> Boot_device: SDMMC_BOOT instance: 3
[0000.390] I> sdmmc-3 params source = boot args
[0000.391] I> sdmmc bdev is already initialized
[0000.394] I> sdmmc-3 params source = boot args
[0000.428] I> Found 17 partitions in SDMMC_BOOT (instance 3)
[0000.444] I> Found 35 partitions in SDMMC_USER (instance 3)
[0000.445] W> No valid slot number is found in scratch register
[0000.445] W> Return default slot: _a
[0000.446] I> Active Boot chain : 0
[0000.452] I> parsing oem signed section of bpmp-fw header done
[0000.459] I> bpmp-fw binary init read from storage
[0000.460] I> oem authentication of bpmp-fw header done
[0000.462] I> bpmp-fw binary done read from storage
[0000.463] I> bpmp-fw: Authentication init Done
[0000.470] I> parsing oem signed section of cpubl header done
[0000.476] I> cpubl binary init read from

and the pin is set back to low soon after the “bootconsole [tegra_comb_uart0] disabled” message is sent:

    0.000000] earlycon: tegra_comb_uart0 at MMIO32 0x000000000c168000 (options '')
[    0.000000] bootconsole [tegra_comb_uart0] enabled
[    0.000000] OF: reserved mem: initialized node ramoops_carveout, compatible id nvidia,ramoops
[    0.000000] OF: reserved mem: initialized node vpr-carveout, compatible id nvidia,vpr-carveout
[    0.000000] OF: reserved mem: initialized node grid-of-semaphores, compatible id nvidia,gosmem
[    0.000000] cma: Reserved 64 MiB at 0x00000000c2000000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.0 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.1
[    0.000000] percpu: Embedded 24 pages/cpu s57752 r8192 d32360 u98304
[    0.000000] Speculative Store Bypass Disable mitigation not required
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8194536
[    0.000000] Kernel command line: console=ttyTCU0,115200 console=tty0 fbcon=map:0 video=tegrafb no_console_suspend=1 earlycon=tegra_comb_uart,mmio32,0x0c168000 gpt rootfs.slot_suffix= usbcore.old_scheme_first=1 tegraid=19.1.2.0.0 maxcpus=8 boot.slot_suffix= boot.ratchetvalues=0.4.2 root=/dev/mmcblk0p1 vpr_resize sdhci_tegra.en_boot_part_access=1  
[    0.000000] log_buf_len individual max cpu contribution: 32768 bytes
[    0.000000] log_buf_len total cpu_extra contributions: 229376 bytes
[    0.000000] log_buf_len min size: 32768 bytes
[    0.000000] log_buf_len: 262144 bytes
[    0.000000] early log buf free: 30264(92%)
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 4194304 (order: 13, 33554432 bytes)
[    0.000000] Inode-cache hash table entries: 2097152 (order: 12, 16777216 bytes)
[    0.000000] Memory: 31923940K/33298432K available (16190K kernel code, 2960K rwdata, 10100K rodata, 13504K init, 610K bss, 620828K reserved, 753664K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbebfff0000   (   250 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8009050000   ( 16192 KB)
[    0.000000]     .rodata : 0xffffff8009050000 - 0xffffff8009a40000   ( 10176 KB)
[    0.000000]       .init : 0xffffff8009a40000 - 0xffffff800a770000   ( 13504 KB)
[    0.000000]       .data : 0xffffff800a770000 - 0xffffff800aa54008   (  2961 KB)
[    0.000000]        .bss : 0xffffff800aa54008 - 0xffffff800aaecb5c   (   611 KB)
[    0.000000]     fixed   : 0xffffffbefe7fd000 - 0xffffffbefec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbefee00000 - 0xffffffbeffe00000   (    16 MB)
[    0.000000]     vmemmap : 0xffffffbf00000000 - 0xffffffc000000000   (     4 GB maximum)
[    0.000000]               0xffffffbf00000000 - 0xffffffbf20000000   (   512 MB actual)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc800000000   ( 32768 MB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	Build-time adjustment of leaf fanout to 64.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=8.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=8
[    0.000000] NR_IRQS:64 nr_irqs:64 0
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] arm_arch_timer: Architected cp15 timer(s) running at 31.25MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xe6a171046, max_idle_ns: 881590405314 ns
[    0.000007] sched_clock: 56 bits at 31MHz, resolution 32ns, wraps every 4398046511088ns
[    0.008557] Console: colour dummy device 80x25
[    0.012712] console [tty0] enabled
[    0.016094] bootconsole [tegra_comb_uart0] disabled
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.253-l4t-r32.7+gac2a37e8219a (oe-user@oe-host) (gcc version 11.2.0 (GCC) ) #1 SMP PREEMPT Fri Mar 11 13:27:19 UTC 2022
[    0.000000] Boot CPU: AArch64 Processor [4e0f0040]
[    0.000000] OF: fdt:memory scan node memory, reg size 48,
[    0.000000] OF: fdt: - 80000000 ,  2c000000
[    0.000000] OF: fdt: - ac200000 ,  44800000
[    0.000000] OF: fdt: - 100000000 ,  780000000
[    0.000000] earlycon: tegra_comb_uart0 at MMIO32 0x000000000c168000 (options '')
[    0.000000] bootconsole [tegra_comb_uart0] enabled
[    0.000000] OF: reserved mem: initialized node ramoops_carveout, compatible id nvidia,ramoops
[    0.000000] OF: reserved mem: initialized node vpr-carveout, compatible id nvidia,vpr-carveout
[    0.000000] OF: reserved mem: initialized node grid-of-semaphores, compatible id nvidia,gosmem
[    0.000000] cma: Reserved 64 MiB at 0x00000000c2000000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.0 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.1
[    0.000000] percpu: Embedded 24 pages/cpu s57752 r8192 d32360 u98304
[    0.000000] Speculative Store Bypass Disable mitigation not required
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8194536
[    0.000000] Kernel command line: console=ttyTCU0,115200 console=tty0 fbcon=map:0 video=tegrafb no_console_suspend=1 earlycon=tegra_comb_uart,mmio32,0x0c168000 gpt rootfs.slot_suffix= usbcore.old_scheme_first=1 tegraid=19.1.2.0.0 maxcpus=8 boot.slot_suffix= boot.ratchetvalues=0.4.2 root=/dev/mmcblk0p1 vpr_resize sdhci_tegra.en_boot_part_access=1  
[    0.000000] log_buf_len individual max cpu contribution: 32768 bytes
[    0.000000] log_buf_len total cpu_extra contributions: 229376 bytes
[    0.000000] log_buf_len min size: 32768 bytes
[    0.000000] log_buf_len: 262144 bytes
[    0.000000] early log buf free: 30264(92%)
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 4194304 (order: 13, 33554432 bytes)
[    0.000000] Inode-cache hash table entries: 2097152 (order: 12, 16777216 bytes)
[    0.000000] Memory: 31923940K/33298432K available (16190K kernel code, 2960K rwdata, 10100K rodata, 13504K init, 610K bss, 620828K reserved, 753664K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     modules : 0xffffff8000000000 - 0xffffff8008000000   (   128 MB)
[    0.000000]     vmalloc : 0xffffff8008000000 - 0xffffffbebfff0000   (   250 GB)
[    0.000000]       .text : 0xffffff8008080000 - 0xffffff8009050000   ( 16192 KB)
[    0.000000]     .rodata : 0xffffff8009050000 - 0xffffff8009a40000   ( 10176 KB)
[    0.000000]       .init : 0xffffff8009a40000 - 0xffffff800a770000   ( 13504 KB)
[    0.000000]       .data : 0xffffff800a770000 - 0xffffff800aa54008   (  2961 KB)
[    0.000000]        .bss : 0xffffff800aa54008 - 0xffffff800aaecb5c   (   611 KB)
[    0.000000]     fixed   : 0xffffffbefe7fd000 - 0xffffffbefec00000   (  4108 KB)
[    0.000000]     PCI I/O : 0xffffffbefee00000 - 0xffffffbeffe00000   (    16 MB)
[    0.000000]     vmemmap : 0xffffffbf00000000 - 0xffffffc000000000   (     4 GB maximum)
[    0.000000]               0xffffffbf00000000 - 0xffffffbf20000000   (   512 MB actual)
[    0.000000]     memory  : 0xffffffc000000000 - 0xffffffc800000000   ( 32768 MB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	Build-time adjustment of leaf fanout to 64.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=8.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=8
[    0.000000] NR_IRQS:64 nr_irqs:64 0
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] arm_arch_timer: Architected cp15 timer(s) running at 31.25MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xe6a171046, max_idle_ns: 881590405314 ns
[    0.000007] sched_clock: 56 bits at 31MHz, resolution 32ns, wraps every 4398046511088ns
[    0.008557] Console: colour dummy device 80x25

Hi,
Please check if status of the serial port is disabled:

$ xxd /proc/device-tree/serial@3100000/status

If not, please disable it in device tree and re-flash the system for a try.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.