How to enable and test TPM2.0 module in Xavier?

I refer to the

tegra194-p2888-0001-p2822-0000.dts (361.8 KB)

The driver appears to be running

[ 0.904443] GPIO line 256 (tpm-rst-pin) hogged as output/high
[ 1.813707] [TPM]tpm_tis_spi_probe:
[ 1.813714] [TPM]tpm_tis_spi_probe:tpm_tis_core_init 1

but don’t see any spi or tpm device
How to test that tpm is working

20220601_xavier_htb_kernel.log (79.4 KB)

Is your TPM module the same as the reference one?
Have you work with your hardware engineer to probe the signaling for verification.

I see

CS is main issue during TPM bringup. Need to define as “cs-gpios”. ???
How to define “cs-gpios” ?

Could you trace the …/kernel/kernel-4.9/drivers/spi/spi-gpio.c to confirm the configure.

enable spi pinmux
bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg

can see /dev/tpm0
user@user-desktop:~$ ls /dev/tpm0
/dev/tpm0

but kernel show error message

[ 0.887624] GPIO line 256 (tpm-rst-pin) hogged as output/high
[ 1.787232] tpm_tis_spi spi0.0: 2.0 TPM (device-id 0x1B, rev-id 22)
[ 1.806754] tpm tpm0: A TPM error (256) occurred continue selftest

test tpm error

$ eltt2 -t

Error opening the device.
Unexpected error: 0x0000000D

Looks like known issue.

https://ml01.01.org/hyperkitty/list/tpm2@lists.01.org/thread/SEZLLTQ57VE775BJNM4JQIB5EFZ2Z4NU/

I upgraded to JETPACK SDK 5.0.1

root@user-desktop:/home/user# dmesg | grep tpm
[ 7.923214] gpio-313 (tpm-rst-pin): hogged as output/high

but in JETPACK SDK 4.6.1
[ 0.887624] GPIO line 256 (tpm-rst-pin) hogged as output/high

Why are the GPIO tpm-rst-pin numbers different ???

Could be the gpio base is different for these two release.

sudo cat /sys/kernel/debug/pinctrl/2430000.pinmux/gpio-ranges
	tpm-rst-pin {
		gpio-hog;
		//GPIO8 GPIO3_PBB.00
		gpios = <TEGRA194_AON_GPIO(BB, 0) GPIO_ACTIVE_HIGH>;
		label = "tpm-rst-pin";
		output-high;
		status = "okay";
	};

JETPACK SDK 5.0.1
root@user-desktop:/home/user# dmesg | grep tpm
[ 7.923214] gpio-313 (tpm-rst-pin): hogged as output/high

cat /sys/kernel/debug/pinctrl/2430000.pinmux/gpio-ranges

GPIO ranges handled:
167: tegra194-gpio GPIOS [502 - 502] PINS {197}
168: tegra194-gpio GPIOS [503 - 503] PINS {198}

cat /sys/kernel/debug/gpio

gpiochip2: GPIOs 305-334, parent: platform/c2f0000.gpio, tegra194-gpio-aon:

gpio-312 (PAA.07 )
gpio-313 (PBB.00 )


JETPACK SDK 4.6.1

[ 0.887624] GPIO line 256 (tpm-rst-pin) hogged as output/high

cat /sys/kernel/debug/pinctrl/2430000.pinmux/gpio-r
GPIO ranges handled:
0: tegra-gpio GPIOS [288 - 495] PINS [0 - 207]
208: tegra-gpio GPIOS [496 - 511] PINS [248 - 263]
0: tegra-gpio-aon GPIOS [248 - 287] PINS [208 - 247]

cat /sys/kernel/debug/gpio
gpiochip1: GPIOs 248-287, parent: platform/c2f0000.gpio, tegra-gpio-aon:
gpio-256 (GPIO8 |tpm-rst-pin ) out hi

It seems that there is a change in the GPIO number definition
But it should still control the same pin

Strange problem now
After 4.6.1 upgrade to 5.0.1
TPM functionality doesn’t seem to work
Can’t see device… neither spi nor tpm drivers are working

Did you configure the SPI PINS. Have you check SPI loopback test?

Some doubts about tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg
It seems that these files must be modified together when modifying pinmux

./bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg
./bootloader/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg
./sources/hardware/nvidia/platform/t19x/galen/bct/pinmux/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg

What are the differences between these files??

The ./bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg should be the correct one to modify.
The ./bootloader/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg shouldn’t exit.

You can modify from the source and replace the ./bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg or just modify it directly.