[[PATCH v2] tpm: Add wolfTPM library support for TPM 2.0 04/12] dts: add TPM device tree nodes for RPi4, QEMU, and sandbox
David Garske
david at wolfssl.com
Mon Mar 16 19:14:33 CET 2026
From: Aidan <aidan at wolfssl.com>
Add device tree entries for TPM devices across three platforms:
bcm2711-rpi-4-b.dts:
Add SPI0 node with Infineon SLB9670/9672 TPM on CE1 (GPIO7),
matching the standard Linux tpm-slb9670 overlay. Add spi0 alias
so wolfTPM finds the bus at index 0.
bcm2711-rpi-4-b-u-boot.dtsi (new file):
Add soft-SPI (GPIO bit-bang) fallback node for TPM communication.
This uses spi-gpio with GPIO11/10/9/7 and provides an alternative
to the hardware SPI driver when pinctrl naming differs between
U-Boot and Linux device trees.
qemu-arm64.dts:
Add MMIO-based TPM TIS node at 0x0c000000 for QEMU virt machine
with swtpm. This allows wolfTPM testing via QEMU without hardware.
sandbox.dtsi:
Add sandbox TPM SPI device (sandbox,tpm-spi) on SPI bus CS1 with
a phandle reference to a sandbox TPM SPI emulator node. This
enables wolfTPM SPI HAL testing in the sandbox environment.
Signed-off-by: Aidan Garske <aidan at wolfssl.com>
---
arch/arm/dts/bcm2711-rpi-4-b-u-boot.dtsi | 54 ++++++++++++++++++++++++
arch/arm/dts/bcm2711-rpi-4-b.dts | 20 +++++++++
arch/arm/dts/qemu-arm64.dts | 4 ++
arch/sandbox/dts/sandbox.dtsi | 11 +++++
4 files changed, 89 insertions(+)
create mode 100644 arch/arm/dts/bcm2711-rpi-4-b-u-boot.dtsi
diff --git a/arch/arm/dts/bcm2711-rpi-4-b-u-boot.dtsi b/arch/arm/dts/bcm2711-rpi-4-b-u-boot.dtsi
new file mode 100644
index 00000000000..c38276abee9
--- /dev/null
+++ b/arch/arm/dts/bcm2711-rpi-4-b-u-boot.dtsi
@@ -0,0 +1,54 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * U-Boot specific additions for Raspberry Pi 4 Model B
+ *
+ * Adds soft SPI support for Infineon SLB9670/9672 TPM HAT
+ * connected to SPI0 CE1 (GPIO 7)
+ *
+ * Uses GPIO bit-banging instead of hardware SPI to avoid
+ * GPIO chip naming issues (pinctrl-bcm2835 vs pinctrl-bcm2711)
+ */
+
+#include "bcm283x-u-boot.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ aliases {
+ spi0 = &soft_spi;
+ };
+
+ soft_spi: soft-spi {
+ compatible = "spi-gpio";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+ bootph-all;
+
+ /*
+ * GPIO pins for SPI0 on Raspberry Pi 4:
+ * GPIO 11 = SCLK
+ * GPIO 10 = MOSI
+ * GPIO 9 = MISO
+ * GPIO 7 = CE1 (chip select for TPM)
+ */
+ gpio-sck = <&gpio 11 GPIO_ACTIVE_HIGH>;
+ gpio-mosi = <&gpio 10 GPIO_ACTIVE_HIGH>;
+ gpio-miso = <&gpio 9 GPIO_ACTIVE_HIGH>;
+ cs-gpios = <&gpio 7 GPIO_ACTIVE_LOW>;
+ num-chipselects = <1>;
+ spi-delay-us = <1>;
+
+ /* Infineon SLB9672 TPM on CS1 */
+ tpm at 0 {
+ compatible = "infineon,slb9672", "tcg,tpm-tis-spi";
+ reg = <0>;
+ spi-max-frequency = <10000000>;
+ status = "okay";
+ bootph-all;
+ };
+ };
+};
+
+&gpio {
+ bootph-all;
+};
diff --git a/arch/arm/dts/bcm2711-rpi-4-b.dts b/arch/arm/dts/bcm2711-rpi-4-b.dts
index 72ce80fbf26..a09276dc279 100644
--- a/arch/arm/dts/bcm2711-rpi-4-b.dts
+++ b/arch/arm/dts/bcm2711-rpi-4-b.dts
@@ -8,6 +8,11 @@
compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
model = "Raspberry Pi 4 Model B";
+ /* Alias hardware SPI as spi0 so wolfTPM finds it at bus 0 */
+ aliases {
+ spi0 = &spi;
+ };
+
chosen {
/* 8250 auxiliary UART instead of pl011 */
stdout-path = "serial1:115200n8";
@@ -54,6 +59,21 @@
enable-active-high;
gpio = <&expgpio 6 GPIO_ACTIVE_HIGH>;
};
+
+};
+
+/* Hardware SPI with TPM - matches Linux tpm-slb9670 overlay */
+&spi {
+ status = "okay";
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_gpio7>;
+
+ /* Infineon SLB9670/9672 TPM 2.0 on CE1 (GPIO7) */
+ tpm at 1 {
+ compatible = "infineon,slb9670", "tcg,tpm_tis-spi";
+ reg = <1>; /* CE1 */
+ spi-max-frequency = <32000000>;
+ };
};
&ddc0 {
diff --git a/arch/arm/dts/qemu-arm64.dts b/arch/arm/dts/qemu-arm64.dts
index 95fcf53ed74..e74d036a532 100644
--- a/arch/arm/dts/qemu-arm64.dts
+++ b/arch/arm/dts/qemu-arm64.dts
@@ -12,4 +12,8 @@
#endif
/ {
+ tpm at 0c000000 {
+ compatible = "tcg,tpm-tis-mmio";
+ reg = <0x0 0x0c000000 0x0 0x5000>;
+ };
};
diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi
index 02b03894eaf..2fdd7f0e942 100644
--- a/arch/sandbox/dts/sandbox.dtsi
+++ b/arch/sandbox/dts/sandbox.dtsi
@@ -286,6 +286,17 @@
spi-max-frequency = <40000000>;
sandbox,filename = "spi.bin";
};
+
+ tpm_spi: tpm at 1 {
+ reg = <1>;
+ compatible = "sandbox,tpm-spi";
+ spi-max-frequency = <10000000>;
+ sandbox,emul = <&tpm_spi_emul>;
+ };
+ };
+
+ tpm_spi_emul: tpm-spi-emul {
+ compatible = "sandbox,tpm-spi-emul";
};
spl-test {
--
2.43.0
More information about the U-Boot
mailing list