summaryrefslogtreecommitdiff
path: root/lib/tpm.c
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2015-10-06 22:54:43 +0200
committerSimon Glass <sjg@chromium.org>2015-10-23 09:42:28 -0600
commitc2b0f600a1707450ef985e28363893987f36fd8a (patch)
tree981149157b60b2df47424e14a7ebdd71cefde480 /lib/tpm.c
parent302c5dba0a6eeb5846b628d3d59978dc0751def9 (diff)
dm: tpm: Remove every compilation switch for TPM driver model
As every TPM drivers support UCLASS_TPM, we can only rely on DM_TPM functions. This simplify a bit the code. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/tpm.c')
-rw-r--r--lib/tpm.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/lib/tpm.c b/lib/tpm.c
index 5d5f707e372..8a622162740 100644
--- a/lib/tpm.c
+++ b/lib/tpm.c
@@ -7,7 +7,6 @@
#include <common.h>
#include <dm.h>
-#include <tis.h>
#include <tpm.h>
#include <asm/unaligned.h>
#include <u-boot/sha1.h>
@@ -230,6 +229,8 @@ static uint32_t tpm_return_code(const void *response)
static uint32_t tpm_sendrecv_command(const void *command,
void *response, size_t *size_ptr)
{
+ struct udevice *dev;
+ int ret;
uint8_t response_buffer[COMMAND_BUFFER_SIZE];
size_t response_length;
uint32_t err;
@@ -240,19 +241,13 @@ static uint32_t tpm_sendrecv_command(const void *command,
response = response_buffer;
response_length = sizeof(response_buffer);
}
-#ifdef CONFIG_DM_TPM
- struct udevice *dev;
- int ret;
ret = uclass_first_device(UCLASS_TPM, &dev);
if (ret)
return ret;
err = tpm_xfer(dev, command, tpm_command_size(command),
response, &response_length);
-#else
- err = tis_sendrecv(command, tpm_command_size(command),
- response, &response_length);
-#endif
+
if (err < 0)
return TPM_LIB_ERROR;
if (size_ptr)
@@ -264,21 +259,12 @@ static uint32_t tpm_sendrecv_command(const void *command,
int tpm_init(void)
{
int err;
-
-#ifdef CONFIG_DM_TPM
struct udevice *dev;
err = uclass_first_device(UCLASS_TPM, &dev);
if (err)
return err;
return tpm_open(dev);
-#else
- err = tis_init();
- if (err)
- return err;
-
- return tis_open();
-#endif
}
uint32_t tpm_startup(enum tpm_startup_type mode)