summaryrefslogtreecommitdiff
path: root/drivers/tpm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tpm')
-rw-r--r--drivers/tpm/Kconfig7
-rw-r--r--drivers/tpm/tpm-uclass.c3
-rw-r--r--drivers/tpm/tpm2_tis_sandbox.c5
-rw-r--r--drivers/tpm/tpm2_tis_spi.c4
4 files changed, 10 insertions, 9 deletions
diff --git a/drivers/tpm/Kconfig b/drivers/tpm/Kconfig
index da1ed8fd87..782a620f91 100644
--- a/drivers/tpm/Kconfig
+++ b/drivers/tpm/Kconfig
@@ -4,9 +4,6 @@
menu "TPM support"
-comment "Please select only one TPM revision"
- depends on TPM_V1 && TPM_V2
-
config TPM_V1
bool "TPMv1.x support"
depends on TPM
@@ -15,7 +12,7 @@ config TPM_V1
Major TPM versions are not compatible at all, choose either
one or the other. This option enables TPMv1.x drivers/commands.
-if TPM_V1 && !TPM_V2
+if TPM_V1
config TPM_TIS_SANDBOX
bool "Enable sandbox TPM driver"
@@ -127,7 +124,7 @@ config TPM_V2
Major TPM versions are not compatible at all, choose either
one or the other. This option enables TPMv2.x drivers/commands.
-if TPM_V2 && !TPM_V1
+if TPM_V2
config TPM2_TIS_SANDBOX
bool "Enable sandbox TPMv2.x driver"
diff --git a/drivers/tpm/tpm-uclass.c b/drivers/tpm/tpm-uclass.c
index 412697eedc..c83f53ab86 100644
--- a/drivers/tpm/tpm-uclass.c
+++ b/drivers/tpm/tpm-uclass.c
@@ -7,11 +7,8 @@
#include <common.h>
#include <dm.h>
#include <linux/unaligned/be_byteshift.h>
-#if defined(CONFIG_TPM_V1)
#include <tpm-v1.h>
-#elif defined(CONFIG_TPM_V2)
#include <tpm-v2.h>
-#endif
#include "tpm_internal.h"
int tpm_open(struct udevice *dev)
diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
index 3240cc5dba..66f6c9ba82 100644
--- a/drivers/tpm/tpm2_tis_sandbox.c
+++ b/drivers/tpm/tpm2_tis_sandbox.c
@@ -232,7 +232,7 @@ static int sandbox_tpm2_fill_buf(u8 **recv, size_t *recv_len, u16 tag, u32 rc)
*recv += sizeof(rc);
/* Add trailing \0 */
- *recv = '\0';
+ *recv = NULL;
return 0;
}
@@ -590,6 +590,9 @@ static int sandbox_tpm2_probe(struct udevice *dev)
struct sandbox_tpm2 *tpm = dev_get_priv(dev);
struct tpm_chip_priv *priv = dev_get_uclass_priv(dev);
+ /* Use the TPM v2 stack */
+ priv->version = TPM_V2;
+
memset(tpm, 0, sizeof(*tpm));
priv->pcr_count = 32;
diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c
index c5d17a679d..8878130bd7 100644
--- a/drivers/tpm/tpm2_tis_spi.c
+++ b/drivers/tpm/tpm2_tis_spi.c
@@ -510,6 +510,7 @@ static int tpm_tis_spi_cleanup(struct udevice *dev)
static int tpm_tis_spi_open(struct udevice *dev)
{
struct tpm_chip *chip = dev_get_priv(dev);
+ struct tpm_chip_priv *priv = dev_get_uclass_priv(dev);
if (chip->is_open)
return -EBUSY;
@@ -575,6 +576,9 @@ static int tpm_tis_spi_probe(struct udevice *dev)
struct tpm_chip *chip = dev_get_priv(dev);
int ret;
+ /* Use the TPM v2 stack */
+ priv->version = TPM_V2;
+
if (IS_ENABLED(CONFIG_DM_GPIO)) {
struct gpio_desc reset_gpio;