TPM (SLB9670) initialization failed on i.MX8 ECSPI2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TPM (SLB9670) initialization failed on i.MX8 ECSPI2

4,105 Views
rohitdubey
Contributor III

Hi,

I'm working on getting the Infineon SLB9670 to work on the ECSPI2 bus of an IMX8MQ processor on the 4.19.35 kernel built using Yocto. The device seems to get detected on the bus ( there's a "spi1.0" node in the  /sys/bus/spi/devices directory), but for some reason, it is never associated with the TPM module and hence fails to come up as a TPM in the /dev directory.

After some printk debugging, I noticed that it fails to detect the valid bit being set on the TPM ( in wait_startup (tpm_tis_core)) and therefore doesn't initialize the device any further.

Probing the signals, I do see TPM replying with 00 01, but module fails to detect this. All the other pins seem to be behaving as expected, so this seems like a device tree or kernel problem.

I'm at a loss of what else to try and would appreciate any suggestions on how to get it to work.

Here's the device tree section, (originally taken from another post and modified) :

 
pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
    MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x00000116
    MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x00000116
    MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x00001916
    MX8MM_IOMUXC_ECSPI2_SS0_ECSPI2_SS0 0x00000116
    >;
};
//
//
&ecspi2 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
fsl,spi-num-chipselects = <1>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
tpm0: slb9670@0 {
    compatible = "infineon,slb9670";
    reg = <0>;
    spi-max-frequency = <38000000>;
    };
};

The kernel modules we're using are tpm, tpm_tis_core and tpm_tis_spi and we're not using interrupts:

Screenshot from 2020-02-10 11-11-59.png

I'd truly appreciate if anyone can help figure out what we've done wrong and how to fix it. I'll be happy to provide any further information.

Thanks & Regards,

Rohit

Tags (2)
5 Replies

3,777 Views
kunalkotecha1
Senior Contributor II

Hi rohitdubey ,

It seems that TPM IC is in reset mode. You can check the datasheet and see that it requires a active high to work in normal mode. For this you need to add the pinmux for reset pin in the "pinctrl_ecspi2" with internal pull-up. Once the TPM is in normal mode it should come out of "wait_startup".

Regards,

Kunal

0 Kudos

3,777 Views
rohitdubey
Contributor III

Hi kunal.kotecha@volansystech.com

Thanks for your reply. We found the issue and it seemed to be related to the way nxp processors handle the SPI Chip Select GPIO lines. From the kernel documentation :

- cs-gpios : GPIOs to use as chip selects, see spi-bus.txt. While the native chip
select lines can be used, they appear to always generate a pulse between each
word of a transfer.  Most use cases will require GPIO based chip selects to
generate a valid transaction.‍‍‍‍

We declared the pin as a GPIO and it works as expected. For anyone else encountering the same issue, here's the working device tree entry:

pinctrl_ecspi2: ecspi2grp {
    fsl,pins = <
        MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x00000116
        MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x00000116
        MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x00001916
    >;
};
//
//
pinctrl_spi2_ss0: spi2_ss0 {
    fsl,pins = <
        MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13 0x116
    >;
};
//
//
&ecspi2 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_ecspi2>, <&pinctrl_spi2_ss0>;
    cs-gpios = <&gpio5 13 0>;
    status = "okay";

    tpm0: slb9670@0 {
        compatible = "infineon,slb9670";
        reg = <0>;
        spi-max-frequency = <38000000>;
    };
};


Thanks & regards,

Rohit

3,777 Views
nickbourdon
Contributor III

Hi Rohit,

my device tree is nearly identical to yours, but the spi-imx driver never attempts to communicate with the TPM (chip select stays high). I assume the problem is with my defconfig. I've included TCG_TPM, TCG_TIS_CORE, and TCG_TIS_SPI. Did you have to add anything else to get it working? 

Thanks, 

Nick

0 Kudos

3,777 Views
rohitdubey
Contributor III

Hi Nick,

For the modules, those modules were enough for me, all I had to do was make the modules autoload ( add them to /etc/modules-load.d/ ) at boot. Are you sure the modules are loaded when the board boots? Also, do you see any messages from the SPI bus being probed during boot?

Regards,

Rohit

3,777 Views
nickbourdon
Contributor III

Hi Rohit,

thanks for your response. That is exactly what solved my problem. I'm building with Yocto so I just added the following line to my machine file and now everything comes up automatically.

KERNEL_MODULE_AUTOLOAD += " tpm tpm_tis_core tpm_tis_spi "

Thanks again!

Nick