diff mbox series

tpm2: tis_spi: add linux compatible fallback string

Message ID 20200610145039.5346-1-bruno.thomsen@gmail.com
State Superseded
Headers show
Series tpm2: tis_spi: add linux compatible fallback string | expand

Commit Message

Bruno Thomsen June 10, 2020, 2:50 p.m. UTC
This solves a compatibility issue with Linux device trees
that contain TPMv2.x hardware. So it's easier to import DTSs
from upstream kernel when migrating board init from C code
to device tree.

The issue is that fallback binding is different between Linux
and u-Boot.

Linux: "tcg,tpm_tis-spi"
U-Boot: "tis,tpm2-spi"

Signed-off-by: Bruno Thomsen <bruno.thomsen at gmail.com>
---
 doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt | 2 +-
 drivers/tpm/tpm2_tis_spi.c                     | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Tom Rini June 10, 2020, 3:11 p.m. UTC | #1
On Wed, Jun 10, 2020 at 04:50:39PM +0200, Bruno Thomsen wrote:
> This solves a compatibility issue with Linux device trees
> that contain TPMv2.x hardware. So it's easier to import DTSs
> from upstream kernel when migrating board init from C code
> to device tree.
> 
> The issue is that fallback binding is different between Linux
> and u-Boot.
> 
> Linux: "tcg,tpm_tis-spi"
> U-Boot: "tis,tpm2-spi"
> 
> Signed-off-by: Bruno Thomsen <bruno.thomsen at gmail.com>
> ---
>  doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt | 2 +-
>  drivers/tpm/tpm2_tis_spi.c                     | 4 ++++
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
> index b48a15112d..b0bc9d6a65 100644
> --- a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
> +++ b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
> @@ -2,7 +2,7 @@ ST33TPHF20 SPI TPMv2.0 bindings
>  -------------------------------
>  
>  Required properties:
> -- compatible		: Should be "tis,tpm2-spi"
> +- compatible		: Should be "tis,tpm2-spi" or "tcg,tpm_tis-spi"
>  - reg			: SPI Chip select
>  
>  Optional properties:
> diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c
> index 36016de4a6..73e5b6aab4 100644
> --- a/drivers/tpm/tpm2_tis_spi.c
> +++ b/drivers/tpm/tpm2_tis_spi.c
> @@ -679,6 +679,10 @@ static const struct udevice_id tpm_tis_spi_ids[] = {
>  		.compatible = "tis,tpm2-spi",
>  		.data = (ulong)&tpm_tis_std_chip_data,
>  	},
> +	{
> +		.compatible = "tcg,tpm_tis-spi",
> +		.data = (ulong)&tpm_tis_std_chip_data,
> +	},
>  	{ }
>  };

Do we have any known users of the other compatible?  I don't see any
in-tree so we should lean towards just using the one in Linux.  Thanks!
diff mbox series

Patch

diff --git a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
index b48a15112d..b0bc9d6a65 100644
--- a/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
+++ b/doc/device-tree-bindings/tpm2/tis-tpm2-spi.txt
@@ -2,7 +2,7 @@  ST33TPHF20 SPI TPMv2.0 bindings
 -------------------------------
 
 Required properties:
-- compatible		: Should be "tis,tpm2-spi"
+- compatible		: Should be "tis,tpm2-spi" or "tcg,tpm_tis-spi"
 - reg			: SPI Chip select
 
 Optional properties:
diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c
index 36016de4a6..73e5b6aab4 100644
--- a/drivers/tpm/tpm2_tis_spi.c
+++ b/drivers/tpm/tpm2_tis_spi.c
@@ -679,6 +679,10 @@  static const struct udevice_id tpm_tis_spi_ids[] = {
 		.compatible = "tis,tpm2-spi",
 		.data = (ulong)&tpm_tis_std_chip_data,
 	},
+	{
+		.compatible = "tcg,tpm_tis-spi",
+		.data = (ulong)&tpm_tis_std_chip_data,
+	},
 	{ }
 };