cancel
Showing results for 
Search instead for 
Did you mean: 

Problem when using STPM4RasPi

RVall.1
Associate

Hi,

I'm trying to use the ST33 Arm-based TPM connected to a Raspberry Pi 3 (STPM4RasPi) but there is an error on the initialization of the TPM. I have a kernel NULL pointer dereference which prevents the TPM to start.

I used this documentation https://www.st.com/resource/en/data_brief/stpm4raspi.pdf to make it work by using I2C.

The problem comes from linux/drivers/char/tpm/st33zp24/i2c.c where the st33zp24_i2c_of_request_resources() function is called during the probe.

The NULL pointer "chip" is set beginning and returned by i2c_get_clientdata() function and then called which produces the error.

static int st33zp24_i2c_of_request_resources(struct i2c_client *client)
{
     struct tpm_chip *chip = i2c_get_clientdata(client);
     struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
     .
     .
     .
}

My dmesg:

[    3.893762] i2c /dev entries driver
[    4.360828] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    4.480421] systemd-journald[92]: Received request to flush runtime journal from PID 1
[    5.114239] i2c-bcm2835 3f804000.i2c: Could not read clock-frequency property
[    5.114994] Unable to handle kernel NULL pointer dereference at virtual address 00000054
[    5.115291] pgd = b8f1c000
[    5.115378] [00000054] *pgd=00000000
[    5.115495] Internal error: Oops: 5 [#1] SMP ARM
[    5.115631] Modules linked in: i2c_bcm2835(+) uio_pdrv_genirq uio fixed i2c_dev ip_tables x_tables ipv6
[    5.115935] CPU: 2 PID: 131 Comm: systemd-udevd Not tainted 4.14.114-v7+ #12
[    5.116147] Hardware name: BCM2835
[    5.116271] task: b8c62d00 task.stack: b8ec8000
[    5.116421] PC is at st33zp24_i2c_probe+0xfc/0x1c4
[    5.116565] LR is at _raw_spin_unlock_irqrestore+0x3c/0x70

I am currently using Linux version 4.14.114-v7+ on the RPi, I also tried to go to same commit as the document but it doesn't change anything.

To fix this problem I tried to change value of the ".compatible" in the driver:

static const struct of_device_id of_st33zp24_i2c_match[] = {
            {   .compatible = "st,st33zp24-i2c", },
            {}
};

to

static const struct of_device_id of_st33zp24_i2c_match[] = {
            {   .compatible = "st,st33htpm-i2c", },
            {}
};

I did tried this because the Data Brief asks to put in the device tree's ".compatible" to "st,st33htpm-i2c".

I also tried to change in include/linux/platform_data/st33zp24.h the "#define TPM_ST33_I2C" from "st33zp24-i2c" to "st33htpm-i2c".

Thank you in advance for your responses !

Ronan

0 REPLIES 0