Thor Jetpack 7.1 Jetson Linux 38.4 enable TPM fail

Hello NVIDIA team

I am working on a custom board featuring the Thor T4000 running JetPack 7.1. I am trying to enable TPM over the SPI interface (spi1 / spi@810c590000), but I encountered a probe timeout error during boot:

[   12.666099] tpm_tis_spi: probe of spi0.0 failed with error -110

Pinmux setting

spi1_sck_pj7 {
				nvidia,pins = "spi1_sck_pj7";
				nvidia,function = "spi1_sck";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};

			spi1_miso_pk0 {
				nvidia,pins = "spi1_miso_pk0";
				nvidia,function = "spi1_din";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};

			spi1_mosi_pk1 {
				nvidia,pins = "spi1_mosi_pk1";
				nvidia,function = "spi1_dout";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};

			spi1_cs0_pk2 {
				nvidia,pins = "spi1_cs0_pk2";
				nvidia,function = "spi1_cs0";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};

			spi1_cs1_pk3 {
				nvidia,pins = "spi1_cs1_pk3";
				nvidia,function = "spi1_cs1";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,drv-type = <TEGRA_PIN_1X_DRIVER>;
				nvidia,e-io-od = <TEGRA_PIN_DISABLE>;
				nvidia,e-lpbk = <TEGRA_PIN_DISABLE>;
			};

Device-tree (decompile)

spi@810c590000 {
			compatible = "nvidia,tegra234-spi\0nvidia,tegra210-spi";
			status = "okay";
			#address-cells = <0x01>;
			#size-cells = <0x00>;
			reg = <0x81 0xc590000 0x00 0x10000>;
			interrupts = <0x00 0xa4 0x04>;
			dma-coherent;
			dma-names = "rx\0tx";
			dmas = <0x133 0x09 0x09 0x809 0x133 0x09 0x13 0x809>;
			iommus = <0x05 0x809>;
			clocks = <0x02 0x2a 0x02 0x16>;
			clock-names = "spi";
			assigned-clocks = <0x02 0x2a>;
			assigned-clock-parents = <0x02 0x16>;
			resets = <0x02 0x24>;
			reset-names = "spi";
			num-cs = <0x01>;
			phandle = <0x2ae>;

			prod-settings {
				#prod-cells = <0x04>;

				prod {
					prod = <0x00 0x194 0x80000000 0x00>;
				};
			};

			spi@0 {
				compatible = "tegra-spidev";
				reg = <0x00>;
				spi-max-frequency = <0x2faf080>;
				status = "disabled";
			};

			tpm@0 {
				compatible = "infineon,slb9670\0tcg,tpm_tis-spi";
				reg = <0x00>;
				spi-max-frequency = <0xf4240>;
				status = "okay";
			};
		};

Device-tree (customer board)

spi@810c590000 {
			status = "okay";
			num-cs = <1>;
			// cs-gpios = <&gpio_main TEGRA264_MAIN_GPIO(K, 2) GPIO_ACTIVE_LOW>;

			spi@0 {
        		status = "disabled";
    		};

			tpm@0 {
				compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
				reg = <0>;
				//spi-max-frequency = <10000000>;
				spi-max-frequency = <1000000>;
				status = "okay";
			};
		};

dmesg as attatched

dmesg_tmpFail.txt (122.0 KB)

Any suggestions or pointers on how to resolve or debug this issue would be greatly appreciated.

Thank you

Hi @pohsuan.hsu

In your dmesg output, I see some entries:


Potest: tpm_tis_core_init

that I don’t recognize. I think they’re related to enabling driver debugging. If they’re not, you could try enabling it. You should be able to enable it with:

echo -n “file drivers/spi/spi-tegra114.c +p” > /sys/kernel/debug/dynamic_debug/control

echo 8 > /proc/sys/kernel/printk

Although you might need to use a different file name with Jetpack 7.

Additionally, I see you’re using Jetpack 7.1. You could try Jetpack 7.2 and see if the problem persists.

Looking through other forum comments, I see that Nvidia previously shared a patch that might be of interest to you:

If you have any further questions, feel free to ask.

Best Regards,

Isaac Barrios
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Hi pohsuan.hsu,

Have you verified SPI loopback test before porting SPI-TPM?

Have you enabled HW-based CS?

Please add more logs in tpm driver to debug for this error further.

Hello isacc.barrios

Thank you very much for sharing this!

I have applied the patch (0001-spi-debug-SPI-issue-for-Thor-with-r38.4-20260525.patch), but unfortunately, it doesn’t seem to resolve the issue in my environment. The probe of spi0.1 failed with error -110 error still persists.

nvidia@tegra-ubuntu:~$ sudo dmesg | grep -Ei "TPM|SPI|CS-FIX"
[sudo] password for nvidia:
[    0.000000] GICv3: 960 SPIs implemented
[    0.000000] GICv3: 1024 Extended SPIs implemented
[   10.654782] systemd[1]: systemd 255.4-1ubuntu8.11 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
[   11.075216] systemd[1]: systemd-pcrextend.socket - TPM2 PCR Extension (Varlink) was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   11.287472] systemd[1]: systemd-pcrlock-file-system.service - Lock File Systems to TPM2 PCR Policy was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   11.303618] systemd[1]: systemd-pcrlock-machine-id.service - Lock Machine ID to TPM2 PCR Policy was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   11.318574] systemd[1]: systemd-pcrmachine.service - TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   11.343399] systemd[1]: systemd-tpm2-setup-early.service - TPM2 SRK Setup (Early) was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   12.040055] spi-tegra114 c6c0000.spi: Adding to iommu group 35
[   12.116850] spi-tegra114 c6c0000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   12.272943] spi-tegra114 810c590000.spi: Adding to iommu group 37
[   12.292180] spi-tegra114 810c590000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   12.348002] spi-tegra114 810c440000.spi: Adding to iommu group 40
[   12.377492] spi-tegra114 810c440000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   12.382279] spi-tegra114 810c450000.spi: Adding to iommu group 41
[   12.587044] spi-tegra114 810c450000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   12.655593] spi-tegra114 810c590000.spi: [CS-FIX-6151170-v1] first message dispatched; CS decision logic active
[   12.788412] tpm_tis_spi: probe of spi0.1 failed with error -110
nvidia@tegra-ubuntu:~$

I Modify device-tree as following

spi@0 is the node I try SPI loop back test

spi@810c590000 {
			status = "okay";
			num-cs = <1>;
			cs-gpios = <&gpio_main TEGRA264_MAIN_GPIO(K, 2) GPIO_ACTIVE_LOW>;

			spi@0 {
        		status = "okay";
				compatible = "tegra-spidev";
				reg = <0x0>;
				spi-max-frequency = <1000000>;
    		};

			tpm@1 {
				compatible = "tcg,tpm_tis-spi";
				reg = <0x1>;
				//spi-max-frequency = <10000000>;
				spi-max-frequency = <1000000>;
				status = "okay";
			};
		};

Additionally, I tried enabling the debug logs using the following command, but encountered an error:

root@tegra-ubuntu:/home/nvidia# echo -n “file drivers/spi/spi-tegra114.c +p” > /sys/kernel/debug/dynamic_debug/control
bash: /sys/kernel/debug/dynamic_debug/control: No such file or directory

To fix this, I added CONFIG_DYNAMIC_DEBUG=y and CONFIG_DYNAMIC_DEBUG_CORE=y to my defconfig rebuilt the kernel and flashing Thor , the system failed to boot into the OS.

here is my build kernel command

make -C kernel ARCH=arm64 -j$(nproc)
sudo -E make install -C kernel

Am I missing any steps to properly enable the debug messages?

Potest: tpm_tis_core_init

I added a custom debug message to trace the execution flow and better understand how tpm_tis_spi operates.

Thanks for your help again!

Hello KevinFFF

Thanks for your reply!

I performed an SPI loopback test by shorting MOSI and MISO on spidev0.0, and the loopback test successfully.

nvidia@tegra-ubuntu:~/Desktop/SPITest$ sudo ./spidev_test -D /dev/spidev0.0 -v -p "HelloWorld123456789abcdef"
[sudo] password for nvidia:
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 48 65 6C 6C 6F 57 6F 72 6C 64 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 __ __ __ __ __ __ __  | HelloWorld123456789abcdef
RX | 48 65 6C 6C 6F 57 6F 72 6C 64 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66 __ __ __ __ __ __ __  | HelloWorld123456789abcdef
nvidia@tegra-ubuntu:~/Desktop/SPITest$

I modify the device tree as following

		spi@810c590000 {
			status = "okay";
			num-cs = <1>;
			cs-gpios = <&gpio_main TEGRA264_MAIN_GPIO(K, 2) GPIO_ACTIVE_LOW>;

			spi@0 {
        		status = "okay";
				compatible = "tegra-spidev";
				reg = <0x0>;
				spi-max-frequency = <1000000>;
    		};

			tpm@1 {
				compatible = "tcg,tpm_tis-spi";
				reg = <0x1>;
				//spi-max-frequency = <10000000>;
				spi-max-frequency = <1000000>;
				status = "okay";
			};
		};

Note: This Device Tree configuration was used strictly for the SPI loopback test. On my actual board, there is only a TPM device connected to spi@810c590000.

Here is my tpm debug message

nvidia@tegra-ubuntu:~/Desktop/SPITest$ sudo dmesg | grep -Ei "TPM|SPI|CS-FIX"
[    0.000000] GICv3: 960 SPIs implemented
[    0.000000] GICv3: 1024 Extended SPIs implemented
[   10.654782] systemd[1]: systemd 255.4-1ubuntu8.11 running in system mode (+PAM +AUDIT +SELINUX +APPARMOR +IMA +SMACK +SECCOMP +GCRYPT -GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN +IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 -PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD -BPF_FRAMEWORK -XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified)
[   11.075216] systemd[1]: systemd-pcrextend.socket - TPM2 PCR Extension (Varlink) was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   11.287472] systemd[1]: systemd-pcrlock-file-system.service - Lock File Systems to TPM2 PCR Policy was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   11.303618] systemd[1]: systemd-pcrlock-machine-id.service - Lock Machine ID to TPM2 PCR Policy was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   11.318574] systemd[1]: systemd-pcrmachine.service - TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   11.343399] systemd[1]: systemd-tpm2-setup-early.service - TPM2 SRK Setup (Early) was skipped because of an unmet condition check (ConditionSecurity=measured-uki).
[   12.040055] spi-tegra114 c6c0000.spi: Adding to iommu group 35
[   12.116850] spi-tegra114 c6c0000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   12.272943] spi-tegra114 810c590000.spi: Adding to iommu group 37
[   12.292180] spi-tegra114 810c590000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   12.348002] spi-tegra114 810c440000.spi: Adding to iommu group 40
[   12.377492] spi-tegra114 810c440000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   12.382279] spi-tegra114 810c450000.spi: Adding to iommu group 41
[   12.587044] spi-tegra114 810c450000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   12.655593] spi-tegra114 810c590000.spi: [CS-FIX-6151170-v1] first message dispatched; CS decision logic active
[   12.788412] tpm_tis_spi: probe of spi0.1 failed with error -110
nvidia@tegra-ubuntu:~/Desktop/SPITest$

Please add more logs in tpm driver to debug for this error further.

How can I enable dynamic debug logging for the tpm_tis_spi driver?

This might work:

sudo modprobe -r tpm_tis_spi
sudo modprobe tpm_tis_spi dyndbg=+p


# Or to make persistent create and add:

/etc/modprobe.d/tpm-debug.conf

options tpm_tis_spi dyndbg=+p
options tpm_tis_core dyndbg=+p
cat /sys/kernel/debug/tracing/available_events |grep -i spi
spi:spi_transfer_stop
spi:spi_transfer_start
spi:spi_message_done
spi:spi_message_start
spi:spi_message_submit
spi:spi_set_cs
spi:spi_setup
spi:spi_controller_busy
spi:spi_controller_idle

So, it means that you have configured the pinmux for SPI correctly.

Please share the connection between the TPM and the Thor.
Do you use HW-based SPI1_CS1? or SW-based CS specified by cs-gpios?

Hello KevinFFF

Attached is the circuit diagram for TPM and Thor

TPM:

Thor:

Do you use HW-based SPI1_CS1? or SW-based CS specified by cs-gpios?

I think I’m using SW-based CS, as I’ve added the cs-gpios property to the Device Tree

		spi@810c590000 {
			status = "okay";
			num-cs = <1>;
			cs-gpios = <0>, 
			<&gpio_main TEGRA264_MAIN_GPIO(K, 2) GPIO_ACTIVE_LOW>;

			spi@0 {
        		status = "disabled";
				compatible = "tegra-spidev";
				reg = <0x0>;
				spi-max-frequency = <20000000>;
    		};

			tpm@0 {
				compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
				reg = <0x0>;
				spi-max-frequency = <20000000>;
				//spi-max-frequency = <1000000>;
				status = "okay";
			};
		};
[   12.219705] spi-tegra114 810c590000.spi: Adding to iommu group 39
[   12.307269] spi-tegra114 810c590000.spi: [CS-FIX-6151170-v1] driver loaded: single-xfer HW CS (cs_change=0), multi-xfer SW CS, bus-locked SW CS preserved (NVbug 6151170)
[   13.119408] spi-tegra114 810c590000.spi: [CS-FIX-6151170-v1] first message dispatched; CS decision logic active

However, I am a bit confused by the GPIO debug output. I configured PK.02 for the SPI CS (which corresponds to SPI1_CS0 on hardware), but /sys/kernel/debug/gpio shows it as CS1:

nvidia@tegra-ubuntu:~$ sudo cat /sys/kernel/debug/gpio | grep PK.02gpio-645 (PK.02               |spi0 CS1            ) out hi ACTIVE LOW

Do you short SPI1_CS1_N and SPI1_CS0_N in your case?

It is caused from that you specified 0 for CS0, and PK.02 for CS1 in device tree.

Do you short SPI1_CS1_N and SPI1_CS0_N in your case?

No, SPI1_CS1_N and SPI1_CS0_N are not shorted together. SPI1_CS1_N is currently floating.

It is caused from that you specified 0 for CS0, and PK.02 for CS1 in device tree.

So in my case, should I update the Device Tree cs-gpios property as follows?

cs-gpios = <&gpio_main TEGRA264_MAIN_GPIO(K, 2) GPIO_ACTIVE_LOW>, <&gpio_main TEGRA264_MAIN_GPIO(K, 3) GPIO_ACTIVE_LOW>;

Okay, so the grey R422 is optional in your case.

Correct, please specify PK.02 for CS0 and PK.03 for CS1 based on the current connection if you use SW-based CS.