Hello,

Bumping this to add a question.

(Note that this is a learning exercise for me and that I hope that socialising it helps me, future me and
others in understanding how this works, so please excuse the entry-level questions and feel free to
ignore the discussion.)

I booted the same hardware under Raspbian to compare functionality.

The TPM chip was recognised using the same configuration in config.txt, as I was expecting[1].
So my question is, given that the hardware is the same, and that "the primary purpose of Device Tree in Linux is to provide a way to describe non-discoverable hardware"[2], what causes the device to not be recognised under Fedora IoT?
Or, in other words, where should I be looking? Out-of-tree RPi Foundation kernel patches?
Something else specific to Fedora IoT kernel or boot process?

I'm certainly not looking for an in-depth response (or rather, I definitely am, but don't expect anyone to provide it),
and appreciate pointers to documentation to work on it myself.

Thanks for reading this far.

[1]: https://lukehinds.com/2019/09/20/tpm-software-on-a-raspberry-pi-3-model-b-with-infineon-optiga-slb-9670-tpm-2-0/
[2]: https://elinux.org/Device_Tree_Reference#What_Is_Device_Tree






On Thu, May 21, 2020 at 1:29 PM David Sastre <d.sastre.medina@gmail.com> wrote:
Hello,

I posted this info on IRC, but re-posting here so I don't miss responses.

On an RPi3B+ I have plugged in an Infineon Optiga SLB9670 TPM and a DS3231 RTC.
I have activated the relevant overlays:

# tail -3 /boot/efi/config.txt
dtoverlay=i2c-rtc,ds3231
dtparam=spi=on
dtoverlay=tpm-slb9670


Upon reboot, I can see the RTC comes up and works fine:

# dmesg | grep -i rtc0
[    7.168331] hctosys: unable to open rtc device (rtc0)
[   15.831043] rtc-ds1307 1-0068: registered as rtc0

# hwclock --show
2020-05-21 12:41:53.438656+02:00
# timedatectl
               Local time: Thu 2020-05-21 12:41:56 CEST
           Universal time: Thu 2020-05-21 10:41:56 UTC
                 RTC time: Thu 2020-05-21 10:41:56
                Time zone: Europe/Madrid (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no


However, the TPM is not detected:

# dmesg | grep -i tpm
[    7.117891] ima: No TPM chip found, activating TPM-bypass!

I have also tried manually applying the overlay to check if there was a problem with that:

# fdtoverlay -v -i bcm2710-rpi-3-b-plus.dtb -o /var/opt/test.dtb overlays/tpm-slb9670.dtbo

It's probably relevant, but exceeds my understanding of the problem:

[   33.793093] ------------[ cut here ]------------
[   33.798151] /soc/spi@7e204000/spidev@0: buggy DT: spidev listed directly in DT
[   33.803446] WARNING: CPU: 1 PID: 680 at drivers/spi/spidev.c:733 spidev_probe+0x228/0x270 [spidev]
[   33.813566] Modules linked in: soundcore spidev(+) raspberrypi_hwmon raspberrypi_cpufreq bcm2835_thermal vchiq(C) spi_bcm2835 bcm2835_wdt bcm2835_rng leds_gpio lz4 zram br_netfilter bridge stp llc drm ip_tables uas usb_storage smsc95xx
usbnet mii rfkill rtc_ds1307 mmc_block dwc2 gpio_raspberrypi_exp sdhci_iproc udc_core sdhci_pltfm sdhci i2c_bcm2835 bcm2835 bcm2835_dma crct10dif_ce phy_generic pkcs8_key_parser fuse aes_neon_bs
[   33.844943] CPU: 1 PID: 680 Comm: systemd-udevd Tainted: G         C        5.6.13-300.fc32.aarch64 #1
[   33.855299] Hardware name: raspberrypi rpi/rpi, BIOS 2019.10 10/09/2019
[   33.860557] pstate: 40400005 (nZcv daif +PAN -UAO)
[   33.865805] pc : spidev_probe+0x228/0x270 [spidev]
[   33.871001] lr : spidev_probe+0x228/0x270 [spidev]
[   33.876012] sp : ffff800010303a20
[   33.876021] x29: ffff800010303a20 x28: ffff00003400c080
[   33.876029] x27: ffffdd00ed0e1ff8 x26: ffffdd00ed0e1fc0
[   33.890393] x25: 0000000000000020 x24: ffffdd00b29ea380
[   33.890405] x23: ffffdd00b29ea058 x22: 0000000000000000
[   33.890412] x21: ffffdd00b29ea038 x20: ffff00002a96d800
[   33.890419] x19: 0000000000000000 x18: 0000000000000000
[   33.890425] x17: 0000000000000000 x16: ffffdd00ec4faae4
[   33.890432] x15: 0000000000000001 x14: 0000000000000a40
[   33.890439] x13: ffffdd00ed1b0798 x12: 0000000000000001
[   33.890446] x11: ffff80001110a820 x10: 0000000000000008
[   33.890452] x9 : ffffdd00ec65a270 x8 : 0000000000000001
[   33.890459] x7 : 0000000000aaaaaa x6 : 0000000000000001
[   33.890465] x5 : 0000000000000000 x4 : ffff00003dd2aa10
[   33.890472] x3 : ffff00003dd38bc8 x2 : ffff00003dd2aa10
[   33.890478] x1 : ffff22ff504a0000 x0 : 0000000000000042
[   33.890488] Call trace:
[   33.890520]  spidev_probe+0x228/0x270 [spidev]
[   33.890537]  spi_drv_probe+0x84/0xe0
[   33.890551]  really_probe+0xe4/0x490
[   33.890559]  driver_probe_device+0xe8/0x130
[   33.890568]  device_driver_attach+0xbc/0xc4
[   33.890576]  __driver_attach+0xa4/0x16c
[   33.890585]  bus_for_each_dev+0x64/0xa0
[   33.890593]  driver_attach+0x28/0x30
[   33.890600]  bus_add_driver+0x148/0x240
[   33.890609]  driver_register+0x7c/0x124
[   33.890617]  __spi_register_driver+0x60/0x70
[   33.890631]  spidev_init+0xa8/0x1000 [spidev]
[   33.890640]  do_one_initcall+0x38/0x1f0
[   33.890652]  do_init_module+0x5c/0x290
[   33.890661]  load_module+0x5f4/0x79c
[   33.890669]  __do_sys_init_module+0xd4/0x140
[   33.890678]  __arm64_sys_init_module+0x20/0x30
[   33.890687]  el0_svc_common.constprop.0+0x78/0x180
[   33.890692]  do_el0_svc+0x28/0x90
[   33.890702]  el0_sync_handler+0x15c/0x200
[   33.890708]  el0_sync+0x164/0x180
[   33.890714] ---[ end trace 660631be62f36086 ]---


Any help or pointers appreciated. Thanks!