TPM 1.2 at U-BOOT, TK1

This topic is related to my previous question.[https://devtalk.nvidia.com/default/topic/1014122/jetson-tk1/tpm-1-2-at-u-boot/]
Not valid answer yet.

  • target: Jetson-TK1
  • L4T: R21.5
  • TPM: Infineon slb9645tt on GEN2 I2C(3.3V)
    • proved with Exynos5422, Arduino, RP etc.
    • after Kernel boot-up on TK1, it works well.
    • SCL, SDA, 3.3V, GND connected.
  • U-Boot: 2014.10

During investigation, I figured out this TPM module reacts to I2C speed very seriously.
Though default I2C speed is 100000, I had to down to 30000.
At 30000 or under, TPM chip answers to I2C commands as follow:

Tegra124 (Jetson TK1) # i2c speed 30000
Setting bus speed to 30000 Hz

Tegra124 (Jetson TK1) # i2c md 0x20 0 0xa0
0000: a1 40 06 00 00 ff d1 15 1a 00 ff ff ff ff ff ff    .@..............
0010: 81 ff ff ff ff ff d1 15 1a 00 ff ff ff ff ff ff    ................
0020: 81 ff ff ff ff ff d1 15 1a 00 ff ff ff ff ff ff    ................
0030: 81 ff ff ff ff ff d1 15 1a 00 ff ff ff ff ff ff    ................
0040: 81 ff ff ff ff ff d1 15 1a 00 ff ff ff ff ff ff    ................
0050: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
0060: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
0070: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................
0080: ff ff ff ff 00 ff ff ff ff ff ff ff ff ff ff ff    ................
0090: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff    ................

Therefore, I can trust Tegra’s primitive I2C driver works well.

However, it does not operate at TPM commands properly;

Tegra124 (Jetson TK1) # tpm init
(+) i2c_probe done
Tegra124 (Jetson TK1) # tpm startup TPM_ST_CLEAR
ERROR: tpm_transmit: tpm_send: error 4294967291

at drivers/tpm/tpm.c:396/tpm_transmit()

This error message occurs in tpm_transmit() of drivers/tpm/tpm.c .

rc = chip->vendor.send(chip, (u8 *)buf, count);

I cannot step forward any more here.

Any idea to test would be appreciated.

Thanks,

Hi mispan
Could you try to read the of the reg in the tpm_tis_i2c_send() to verify the i2c is working during that period.

Thanks ShaneCCC,

I’m investigating a little bit more.
Now, I figured out regs in the TPM can be accessed during operation through I2C.

Problem to init TPM is iic_tpm_write_generic() after get_burstcount() in the tpm_tis_i2c_send() function.
When I input tpm startup TPM_ST_CLEAR command after tpm init command, tpm command will send STARTUP command pattern.
But iic_tpm_write function passes 0 as an addr and alen parameters. These values are kicked out at tegra_i2c_write() function.

static int iic_tpm_write_generic(u8 addr, u8 *buffer, size_t len,
                unsigned int sleep_time, u8 max_count)
{
...
        for (count = 0; count < max_count; count++) {
                rc = i2c_write(tpm_dev.addr, <b>0, 0</b>, tpm_dev.buf, len + 1);
                if (rc == 0)
                        break;  /* Success, break to skip sleep */
                udelay(sleep_time);
        }
...
}
/* Write bytes */
static int tegra_i2c_write(struct i2c_adapter *adap, uchar chip, uint addr,
                        int alen, uchar *buffer, int len)
{
...
        if (!i2c_addr_ok(addr, alen)) {
                printf("i2c_write: Bad address %x.%d.\n", addr, alen);
                return 1;
        }
...
}

When I modified to pass 0x5 and 0x1 for addr and alen for i2c_write in iic_tpm_write_generic forcely,
send_recv_packets() does return 0x88, not VALID status. and failed tpm_tis_i2c_send function.

Any mistakes I did during this test??

  • FYI, if I do warm reset at Linux shell, tpm locality can be acquired well. But after cold reset, it fails.
    Would it be related to this issue?

mispan
Could you print the add and len and try access in the linux console check if this reg can access normally.

Thanks ShaneCCC for your interest and help.

I did not test it whether TPM REGs are able to be accessed on Linux yet.

BTW, I doubt that 2014.10 U-Boot of L4T 21.5 supports slb9645tt TPM chip.
Because, mainline U-Boot changed TPM message format from 2015.10 release.
iic_tpm_write_generic() in “u-boot/drivers/tpm/tpm_tis_i2c.c”

To make sure, I tested mainline U-Boot as this link;
https://devtalk.nvidia.com/default/topic/802953/jetson-tk1/how-to-compile-amp-install-mainline-u-boot-/?offset=9#5181455
but serial console does not show anything.

How about backporting this TPM driver from 2015.10 to 2014.10 U-Boot?

mipsan

@mipsan
Sorry, I don’t have much information about the U-Boot to tell you is it worth to try or not.

T

Thanks @ShaneCCC,

This issue was cleared by terms of Infineon’s support.

Tegra I2C Driver for TPM should be modified to support slb9645tt TPM chip.

Thanks,