SPI infineon TPM 2.0 cs-gpios not correct work on Jetpack 5.0.2 and 5.1

Hi all

We recently upgraded Xavier AGX from Jetpack 4.6 to 5.0.2 or even 5.1

Among them, the function of SPI TPM has been able to work normally in Jetpack 4.6.

However, when we upgraded to 5.0.2, we found that the TPM, which was working normally, could not be initialized.

We have confirmed the status of the Pinmux spi register with busybox, and also confirmed that the SPI pins are not occupied by other devices in the Device Tree.

By measuring the SPI pin signal and comparing the status of Jetpack 4.6.0, we found that the problem lies in cs-gpios, and we came to the following conclusions.

In SPI Device Tree, we have two ways to set cs-gpio, and the two cannot coexist.

  • cs-gpios
  • enable-hw-based-cs

spidev defaults to using enable-hw-based-cs to control cs, but using enable-hw-based-cs in TPM will cause problems

The picture below is the waveform generated by the spi pin when Jetpack 4.6.0 uses two different settings alternately in the device tree.

  • Use “enable-hw-based-cs” to try the SPI waveform of initial TPM:

We force return -1 to return after tpm_tis_core.ko executes the first spi action, so as to observe the different SPI waveforms when the Device Tree is set differently.

Please observe the blue CS pin waveform.

When enable-hw-based-cs is used, cs will be pulled up in the middle of two clks until the next clk is sent.

When using cs-gpios, the low potential of the cs pin will be maintained until the two clk executions are completed before being pulled up.

We have inquired about the window of the Infineon TPM, and determined that the action of cs-gpios is in line with the behavior of the TPM. Enable-hw-based-cs pulls up the cs too early, causing the TPM to not act normally.

However, now when we upgrade Xavier AGX to Jetpack 5.0.2, we found that if “cs-gpios” is set in Device Tree, the cs pin sent by spi will not have any action, and it will keep pulling High.

When we change the setting to “enable-hw-based-cs”, the cs pin has an action, and it will pull low when clk is sent, but just like the conclusion just now, the cs pin of “enable-hw-based-cs” The behavior cannot be initial TPM Chip, we have confirmed this with an oscilloscope.

We have read the documentation about cs-gpios settings in Jetpack 5.0.2, and according to my understanding, there should be no change in usage.

I even tried to upgrade Xavier AGX to Jetpack version 5.1, the situation is the same, set cs-gpios, the cs pin can’t work at all.

We also have the Orin AGX module on hand and have the same problem when using the SPI TPM, so I don’t think it’s a problem with SOM or Xavier AGX alone.

Does the function of cs-gpios change in Jetpack 5.0.2 or above, does the setting method change? Or do I need to set it up in another way?

Does anyone have any suggestion or method?

Best Regards
Jack Lan

1 Like

Please does anyone have an idea?

Hi,
Please also try the other properties:
SPI CS doesn't work - #7 by DaneLLL

If it still does not generate expected CS signal, please check discussion in this topic for customizing the driver code:
Xavier NX spi cs problems and timing - #8 by DaneLLL

Hi DaneLLL

I tried the information you provided, but this is only to modify the problem that CS cannot adjust Timming.

Our problem is not that the cs pin does not work when using “enable-hw-based-cs”.

But the behavior of “enable-hw-based-cs” does not meet the requirements of TPM. In the past, Jetpack 4.6.0 using cs-gpios can work normally and meet the requirements of TPM.

However, after using Jetpack 5.0.2 or even 5.1, the cs pin does not work at all when using cs-gpios, but the cs pin will work when using “enable-hw-based-cs”, but the behavior cannot meet our needs.

In addition, when I traced spi-tegra114.c, I found that when “enable-hw-based-cs” is used to execute the tpm spi command, the judgment will execute the part in the yellow box, and when using “cs-gpios”, it will run to the part in the red box. But cs-gpios will not have any action, as shown in the figure below:

Best Regards
Jack Lan

Sorry for the late response, is this still an issue to support? Thanks

Hi Kayccc

Yes! we need your help

Best Regards
Jack Lan

hi jack_lan,

seems We have the same issue .our tpm can work in jetpack 4.6 but 5.02/5.1 too.
so far,we also have no idea.