iMX8 with Infineon SLB9670 TPM module

Hi,
I’m having a problem while trying to enable SLB9670 TPM module on Apalis iMX8 connected to SPI0.
I’ve enabled kernel modules: tpm, tpm_tis_core, tpm_tis_spi and chaged device tree as follows, but nothing happens during system startup (from dmesg log) and there is no tpm0 device in /dev. We also changed CS pin to GPIO4.

Device tree:

&iomuxc {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_cam1_gpios>, <&pinctrl_dap1_gpios>,
		    <&pinctrl_esai0_gpios>, <&pinctrl_fec2_gpios>,
		    <&pinctrl_gpio3>, <&pinctrl_gpio_usbh_oc_n>, <&pinctrl_lpuart1ctrl>,
		    <&pinctrl_lvds0_i2c0_gpio>, <&pinctrl_lvds1_i2c0_gpios>,
		    <&pinctrl_mipi_dsi_0_1_en>, <&pinctrl_mipi_dsi1_gpios>,
		    <&pinctrl_mlb_gpios>, <&pinctrl_qspi1a_gpios>,
		    <&pinctrl_sata1_act>, <&pinctrl_sim0_gpios>,
		    <&pinctrl_usdhc1_gpios>;
};

&lpspi0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_lpspi0 &pinctrl_gpio4>;
	#address-cells = <1>;
	#size-cells = <0>;
    cs-gpios = <&lsio_gpio0 13 GPIO_ACTIVE_LOW>;

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

    tpm0: slb9670@0{
        compatible = "infineon,slb9670";
        reg = <0>;
        #address-cells = <1>;
        #size-cells = <0>;
        spi-max-frequency = <30000000>;
        status = "okay";
    };
};

Is there something I’m missing in device tree file?

Hi @matay1 ,

Thanks for reaching out.

Could you please append the dmesg log you generated?

Furthermore, can you confirm that your modified device tree is actually applied?
Did you see it being applied during booting?

Best Regards
Kevin

Yes, device tree is applied for sure. I can see it applied during booting and there is also node visible:

cat /sys/devices/platform/bus@5a000000/5a000000.spi/spi_master/spi0/spi0.0/modalias 
spi:slb9670

I can also see that CS pin is changing it’s state during booting.

dmesg.txt (37.7 KB)

Hi @matay1!

Sorry for my late response.

Searching for the driver compatibility on linux-toradex kernel, I could find an example of how to enable the Infineon SLB9670 driver on kernel documentation (tpm_tis_spi.txt « tpm « security « bindings « devicetree « Documentation - linux-toradex.git - Linux kernel for Apalis and Colibri modules).

There I can see that it is changing two parameters:

  • compatible.
  • spi-max-frequency.

I see that you made more changes to your device tree. You can set the “status” without problems, but I am not sure about the “reg” value. Can you explain what you want to accomplish by that?

Looking at the datasheet of SLB9670, I could see that the maximum frequency for the SPI is 22.5 MHz using 1.8V (which is the voltage of iMX8 modules). So you can try to lower the frequency in your device tree to see if that works.

Best regards,

Hi @hfranco.tx,

I tried using overlay from your link:

 tpm_tis@0 {
            compatible = "infineon,slb9670";
            spi-max-frequency = <10000000>;
 };

But without reg property I’m getting error in dmesg:

spi_master spi0: /bus@5a000000/spi@5a000000/tpm_tis@0 has no valid 'reg' property (-22)
spi_master spi0: Failed to create SPI device for /bus@5a000000/spi@5a000000/tpm_tis@0

So I put back “reg = <0>;” inside tpm_tis node. I’ve also tried different spi-max-frequency values (20 MHz, 1MHz, 500 kHz) but still no output from tpm_tis_spi module.

Regards,
Mateusz

Hi @matay1!

It seems right to me, I can’t see any errors that could be causing this problem.
Unfortunately, I don’t have this hardware to try it here. Can you check the TPM signals with an oscilloscope to check if it’s correct? Also, have you posted something on Infineon forums about this issue?

Best regards,

I haven’t tested TPM signals with an oscilloscope yet, but it seems that I’ve managed to get the module working.
First, I enabled the spidev node again, tried it out with wolfTPM library and it seemed to work well from the very beggining. So then, after doing some research and debugging on tpm_tis_spi library I’ve noticed that, despite getting a proper response from the module, the transfer function was somehow misinterpreting it. So I made a few changes to the way it sends and receives frames, recompiled tpm_tis_spi module, and now /dev/tpm0 is visible. I’ve also run some tests with tpm2-tss and tpm2-tools and everything seems to work well.

Nevertheless, I’m still wondering why I had to make such changes in order for the module to work, but as you mentioned - I guess it’s more like the question to post on Infineon forum. Anyway, thank you for your time and reply.

Best regards,
Mateusz

@matay1 Does it work for you now?

We are also thinking of ordering some eval TMP kit of same Infineon chip to be used with our verdin imx8m Plus SOM.