DragonBoard I2C driver problem in debian 16.09

Hi All!

In a project I added an I2C TPM device to my Dragonboard.
I modified the kernel so it contains its driver module and also integrate it in the device-tree so it is automatically loaded at boot.
The system detects the device with i2cdetect.
When I start to communicate with the device some of the commands are working but others came back with error.
I am using the tpm-tools to communicate with the board. So there should not be any coding error on my side…

Strace output of the error:

socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET6, sin6_port=htons(30003), inet_pton(AF_INET6, “::1”, &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
sendto(3, “\0\0\0\34\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\34”, 28, 0, NULL, 0) = 28
recvfrom(3, “\0\0\0&\0\0\0\0\0\0\0\2\0\0\0\2\0\0\0\34\0\0\0\10\0\0\0\36”, 28, 0, NULL, NULL) = 28
recvfrom(3, “\3\3\240N\20\2\0\0\0\2”, 10, 0, NULL, NULL) = 10
openat(AT_FDCWD, “/dev/urandom”, O_RDONLY) = 4
fstat(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), …}) = 0
ioctl(4, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, 0x7fe038fb18) = -1 EINVAL (Invalid argument)
mmap(NULL, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9f2ab000
read(4,[ 512.087572] i2c_quirk_error: 143 callbacks suppressed
“\221\221\316g0\342p\177\377\r\255)\f\31Jc(\356\241\2d\276\3173\261\217Q\363x\235\375\30”…, 4096) = 4096
close(4) = 0
munmap(0x7f9f2ab000, 65536) = 0
sendto(3, “\0\0\0006\0\0\0002\0\0\0\2\0\0\0\2\0\0\0\34\0\0\0\30\0\0\0\36\3\6\240N”…, 54, 0, NULL, 0) = 54
recvfrom(3, [ 512.240984] i2c i2c-0: adapter quirk: msg too long (addr 0x0020, size 304, read)
[ 512.278265] i2c i2c-0: adapter quirk: msg too long (addr 0x0020, size 304, read)
[ 512.278455] i2c i2c-0: adapter quirk: msg too long (addr 0x0020, size 304, read)
[ 512.285228] i2c i2c-0: adapter quirk: msg too long (addr 0x0020, size 304, read)
[ 512.293822] i2c i2c-0: adapter quirk: msg too long (addr 0x0020, size 304, read)
[ 512.299753] i2c i2c-0: adapter quirk: msg too long (addr 0x0020, size 304, read)
[ 512.307455] i2c i2c-0: adapter quirk: msg too long (addr 0x0020, size 304, read)
[ 512.315649] i2c i2c-0: adapter quirk: msg too long (addr 0x0020, size 304, read)
[ 512.394588] tpm_i2c_infineon 0-0020: Unable to read remainder of result
[ 512.398923] tpm_i2c_infineon 0-0020: tpm_transmit: tpm_recv: error -62
TCSD TDDL ERROR: write to device /dev/tpm0 failed: Timer expired
“\0\0\0\34\0\0\20\207\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0”, 28, 0, NULL, NULL) = 28
write(2, “Tspi_TPM_TakeOwnership failed: 0”…, 83Tspi_TPM_TakeOwnership failed: 0x00001087 - layer=tddl, code=0087 (135), I/O error
) = 83

Does anyone experienced similar misbehaviour of the I2C?
Any help is welcomed!

Hi

Which TPM module you are using? ST/Infineon?

Hi

Infineon SLB9645.

You mentioned some commands are working but others aren’t - can you give specific examples?

The error sounds like happened at i2c core. Usually TPM operations require long I2C transfers. From your provided log it seems tripping off at the adapter quirk/msg size.

Hi,

If I ask the version of the device by command tpm_version it responds with the correct output without error messages.

Update:

Tried to use the other I2C bus on the LS connector (I2C1).
Same error…

Hi there,

So the i2c-qup driver for that release has a quirk erroneously set on the max_read_len. Anything over 256 bytes will fail. I looked at the later kernels and it looks like it is fixed in the 4.9 kernels and is definitely fixed in mainline linux kernel.

So if you use the 17.04 the fix is in there. If you want to stick with 16.09, you’ll need a patch. If you want a patch, I can fix one up for you to try.

Up to you,

Andy

1 Like

Hi Andy,
thank you for coming back!
We will try the latest revision and let you know our results!
Dieter

Hi agross!

I finally got to test the system with the new release (4.9.34), seems like having the same error but with different error message:

connect(3, {sa_family=AF_INET6, sin6_port=htons(30003), inet_pton(AF_INET6, “::1”, &sin6_addr), sin6_flowinfo=htonl(0), sin6_scope_id=0}, 28) = 0
sendto(3, “\0\0\0\34\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\34\0\0\0\0\0\0\0\34”, 28, 0, NULL, 0) = 28
recvfrom(3, “\0\0\0&\0\0\0\0\0\0\0\2\0\0\0\2\0\0\0\34\0\0\0\10\0\0\0\36”, 28, 0, NULL, NULL) = 28
recvfrom(3, “\3\3\240\252\211\6\0\0\0\2”, 10, 0, NULL, NULL) = 10
openat(AT_FDCWD, “/dev/urandom”, O_RDONLY) = 4
fstat(4, {st_mode=S_IFCHR|0666, st_rdev=makedev(1, 9), …}) = 0
ioctl(4, TCGETS, 0xffffd2c3c7b8) = -1 EINVAL (Invalid argument)
read(4, “\305_C\252\242\314\365\21\7\265R\275O\25f\231Y\332\337\3663p%\234\337(\27\221\36f \324”…, 4096) = 4096
close(4) = 0
sendto(3, “\0\0\0006\0\0\0002\0\0\0\2\0\0\0\2\0\0\0\34\0\0\0\30\0\0\0\36\3\6\240\252”…, 54, 0, NULL, 0) = 54
recvfrom(3, TCSD TDDL ERROR: write to device /dev/tpm0 failed: Timer expired
“\0\0\0\34\0\0\20\207\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0”, 28, 0, NULL, NULL) = 28
write(2, “Tspi_TPM_TakeOwnership failed: 0”…, 83Tspi_TPM_TakeOwnership failed: 0x00001087 - layer=tddl, code=0087 (135), I/O error
) = 83

Please, if you have any other idea let me know!
Attila

Hi,

Update:
I used the latest version (17.06.1). With the original driver the error was still occurred. After that the idea was to crosscheck the DB410 I2C driver. The device tree and kernel was modified, so one of the I2C(0) port was using GPIO_I2C driver instead. And the error disappeared. We will also post a detailed error report for the Linaro team to fix.

BR
Attila