summaryrefslogtreecommitdiff
path: root/src/drivers/spi/tpm/tpm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/spi/tpm/tpm.c')
-rw-r--r--src/drivers/spi/tpm/tpm.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/drivers/spi/tpm/tpm.c b/src/drivers/spi/tpm/tpm.c
index 01f04f4a36..13f44f9448 100644
--- a/src/drivers/spi/tpm/tpm.c
+++ b/src/drivers/spi/tpm/tpm.c
@@ -394,7 +394,7 @@ static const uint32_t supported_did_vids[] = {
0x0000104a /* ST33HTPH2E32 */
};
-int tpm2_init(struct spi_slave *spi_if)
+tpm_result_t tpm2_init(struct spi_slave *spi_if)
{
uint32_t did_vid, status, intf_id;
uint8_t cmd;
@@ -433,7 +433,7 @@ int tpm2_init(struct spi_slave *spi_if)
if (!retries) {
printk(BIOS_ERR, "\n%s: Failed to connect to the TPM\n",
__func__);
- return -1;
+ return TPM_CB_FAIL;
}
printk(BIOS_INFO, " done!\n");
@@ -444,11 +444,11 @@ int tpm2_init(struct spi_slave *spi_if)
if (tpm2_read_reg(TPM_INTF_ID_REG, &intf_id, sizeof(intf_id)) != CB_SUCCESS) {
printk(BIOS_ERR, "\n%s: Failed to read interface ID register\n",
__func__);
- return -1;
+ return TPM_CB_FAIL;
}
if ((be32toh(intf_id) & 0xF) == 0xF) {
printk(BIOS_DEBUG, "\n%s: Not a TPM2 device\n", __func__);
- return -1;
+ return TPM_CB_FAIL;
}
}
@@ -459,16 +459,16 @@ int tpm2_init(struct spi_slave *spi_if)
* initialization after reset.
*/
if (tpm2_claim_locality() != CB_SUCCESS)
- return -1;
+ return TPM_CB_FAIL;
if (read_tpm_sts(&status) != CB_SUCCESS) {
printk(BIOS_ERR, "Reading status reg failed\n");
- return -1;
+ return TPM_CB_FAIL;
}
if ((status & TPM_STS_FAMILY_MASK) != TPM_STS_FAMILY_TPM_2_0) {
printk(BIOS_ERR, "unexpected TPM family value, status: %#x\n",
status);
- return -1;
+ return TPM_CB_FAIL;
}
/*
@@ -492,7 +492,7 @@ int tpm2_init(struct spi_slave *spi_if)
cr50_set_board_cfg();
}
}
- return 0;
+ return TPM_SUCCESS;
}
/*