From: Aidan <[email protected]>

Add a "sandbox,tpm-spi" slave on the existing sandbox SPI bus and
a matching "sandbox,tpm-spi-emul" emulator node, so the sandbox
unit-test target can exercise SPI-attached TPM code paths without
real hardware.

The slave device sits on CS 1 (CS 0 is the SPI-NOR flash emulator
that other sandbox tests use), and the slave's sandbox,emul
phandle points at the emulator node added at the root of the
sandbox device tree.

Signed-off-by: Aidan Garske <[email protected]>
---
 arch/sandbox/dts/sandbox.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

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@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.49.0

Reply via email to