Enable SPI TPM 2.0 with tpm_tis_spi

Hi,
It’s my first time working with SPI and I’m trying to enable the SPI TPM2.0 with the in-tree kernel driver: tpm_tis_spi

I asked for help here:

The modified dt is:
final_dt.txt (424.8 KB)

I get the following dmesg:

$ sudo dmesg | grep spi
[ 13.600994] spi-tegra114 3210000.spi: Adding to iommu group 2
[ 13.608920] spi-tegra114 3210000.spi: chipselect 0 already in use
[ 13.614453] tpm_tis_spi: probe of spi0.0 failed with error -110
[ 13.616233] spi_master spi0: spi_device register error /spi@3210000/spi@0
[ 13.630181] spi_master spi0: Failed to create SPI device for /spi@3210000/spi@0
[ 13.645826] spi-tegra114 3230000.spi: Adding to iommu group 2

I understand the driver’s probe function failed but I don’t understand why.
I verified that the SPI channel is indeed 0 and chip select is 0 as well.
I noticed there are several spi drivers in the dt. Maybe there is a conflict?

Thanks

Hello @bsp_dev,

Yest, it seems like there is a conflict between spi devices.

What is the output of the following command?

ls /dev/ | grep spi

regards,
Andrew
Embedded Software Engineer at ProventusNova

Hi bsp_dev,

It seems you are working on your custom carrier board for Orin NX.
What’s your current Jetpack version in use?

Please remove the following lines in device tree since you’ve added tpm@0 for your module.

		tpm@0 {
			compatible = "tpm_tis_spi";
			reg = <0x00>;
			#address-cells = <0x01>;
			#size-cells = <0x00>;
			spi-max-frequency = <0x1f78a40>;
			status = "okay";
		};

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

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

-		spi@0 {
-			compatible = "tegra-spidev";
-			reg = <0x00>;
-			spi-max-frequency = <0x2faf080>;
-
-			controller-data {
-				nvidia,enable-hw-based-cs;
-				nvidia,rx-clk-tap-delay = <0x10>;
-				nvidia,tx-clk-tap-delay = <0x00>;
-			};
-		};

and check the dmesg again.

I removed the node from dt and now the dmesg is:

$ sudo dmesg | grep spi
[ 13.713131] spi-tegra114 3210000.spi: Adding to iommu group 2
[ 13.751439] spi-tegra114 3230000.spi: Adding to iommu group 2
[ 13.766936] tpm_tis_spi: probe of spi0.0 failed with error -110

Hi @proventusnova ,
the output is empty

Could you add more debug logs in tpm_tis_spi driver to get the reason of error -110?

  1. The TPM has 2 GPIOs set to 0 at startup: PP and RST.
    I manually set them to 1 (using sysfs)

after setting them to 1 i get the following dmesg:

[ 394.692932] irq: IRQ310: trimming hierarchy from :pmc@c360000
[ 394.703898] irq: IRQ311: trimming hierarchy from :pmc@c360000
(Don’t know if that’s good or bad)

  1. I load: tpm_tis_core.ko
  2. I load tpm_tis_spi.ko

I get the demsg:

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

I tried lowering the TPM frequency to 1Mhz for debug.

The final dt is:
final_dt.txt (424.6 KB)

  1. I execute ls /dev/spi* and get nothing. maybe i have a problem with my orin spi driver?
    dmesg | grep spi:

[ 13.468233] spi-tegra114 3210000.spi: Adding to iommu group 2
[ 13.541597] spi-tegra114 3230000.spi: Adding to iommu group 2

Which TPM 2.0 module you are using? ST33?

		tpm@0 {
			compatible = "st,st33htpm-spi";

Have you verified the SPI loopback test before connecting with your TPM module?

Yes:
TPM 2.0 with spi interface, specific module: ST33TPHF20SPI ,
website: https://www.st.com/en/secure-mcus/st33tphf20spi.html#documentation

I didn’t test SPI loopback. This is a custom carrier board and for loopback test I need the hardware guy to expose wires for me.

If you’ll say this is the only available step for us right now we’ll do it. If there is something else quicker I can perform I’ll do it.

Thanks @KevinFFF

We would suggest you verifying the SPI loopback test by simply shorting MISO and MOSI before connecting to SPI device like TPM module.

Please also request your vendor to know more details about this error.