bsp_dev
September 23, 2024, 1:13pm
1
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.
bsp_dev
September 24, 2024, 7:09am
5
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
bsp_dev
September 24, 2024, 7:10am
6
Hi @proventusnova ,
the output is empty
Could you add more debug logs in tpm_tis_spi driver to get the reason of error -110?
bsp_dev
September 26, 2024, 11:58am
8
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)
I load: tpm_tis_core.ko
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)
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?
bsp_dev
September 30, 2024, 8:27am
10
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.
bsp_dev
October 14, 2024, 9:48am
13
Currently its not possible for us to short the MISO and MOSI. Our hardware guys can confirm that they see SPI clk and communication atemps from the SoM via scope. Is this helpful?
It can help to verify loopback test.
It’s okay to check the waveform from scope.
Is there any unexpected behavior you observed from scope?
bsp_dev
October 24, 2024, 10:52am
15
Yes. We noticed that we perform the requests to the TPM but its not responding.
(We see valid spi communication and clock)
okay, if you’ve confirmed SPI working as expected, then you should start porting TPM module.
Have you gotten the porting guide from your vendor?
bsp_dev
October 28, 2024, 8:10pm
17
Yes. I did as it says. It uses in kernel driver: tpm_tis_core and tpm_tis_spi.
The vendor’s only instruction is to modify the dt as follows:
and use the driver.
Please share the current dmesg with above configurations in device tree.
bsp_dev
October 29, 2024, 8:52am
19
This is the vendor’s public instructions for using the driver with its TPM module:
https://www.st.com/resource/en/application_note/an5714-integrating-the-stsafetpm-trusted-platform-modules-with-linux-stmicroelectronics.pdf
I loaded the drivers as kernel modules.
dmesg log:
dmesg.log (63.9 KB)
It seems the tpm is not responding for some reason.
Sorry that we don’t have this module so that we can not verify them on the devkit and share you the exact steps for porting.
[ 178.135850] tpm_tis_core: no symbol version for module_layout
Above error may be caused from mis-match with kernel release.
How did you build this module?
Please share the result of the following command on your board.
$ uname -r
$ cat /etc/nv_tegra_release
$ cat /etc/nv_boot_control.conf
bsp_dev
October 30, 2024, 5:38pm
22
@KevinFFF , Maybe for testing, I should disable other spi devices or spi buses and see if the problem solved?
If so, can you tell me which ones to put on disable?
this is my dmesg from above messages:
[ 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
maybe something conflicts as proventusnova said