diff options
author | Simon Glass <sjg@chromium.org> | 2015-08-22 18:31:26 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-08-31 07:57:27 -0600 |
commit | 605152a80371c494b1735f6ef8d296e141b1eadf (patch) | |
tree | 88ebccd79c2608bc4e8916467b302d85b15f2614 /drivers/tpm | |
parent | 13932b09bb19898a5c64bf7a48448855200c63f5 (diff) | |
download | u-boot-imx-605152a80371c494b1735f6ef8d296e141b1eadf.zip u-boot-imx-605152a80371c494b1735f6ef8d296e141b1eadf.tar.gz u-boot-imx-605152a80371c494b1735f6ef8d296e141b1eadf.tar.bz2 |
tpm: tpm_tis_i2c: Merge struct tpm into tpm_chip
There are too many structures storing the same sort of information. Move the
fields from struct tpm into struct tpm_chip and remove the former struct.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers/tpm')
-rw-r--r-- | drivers/tpm/tpm_tis_i2c.c | 24 | ||||
-rw-r--r-- | drivers/tpm/tpm_tis_i2c.h | 1 |
2 files changed, 10 insertions, 15 deletions
diff --git a/drivers/tpm/tpm_tis_i2c.c b/drivers/tpm/tpm_tis_i2c.c index 81a3bb5..046e282 100644 --- a/drivers/tpm/tpm_tis_i2c.c +++ b/drivers/tpm/tpm_tis_i2c.c @@ -375,12 +375,6 @@ static const u8 tpm_ordinal_duration[TPM_MAX_ORDINAL] = { TPM_MEDIUM, }; -/* TPM configuration */ -struct tpm { - struct udevice *dev; - char inited; -} tpm; - static struct tpm_chip g_chip; /* @@ -976,7 +970,7 @@ static void tpm_close(void) * @param dev Returns a configuration of TPM device * @return 0 if ok, -1 on error */ -static int tpm_decode_config(struct tpm *dev) +static int tpm_decode_config(struct tpm_chip *chip) { const void *blob = gd->fdt_blob; struct udevice *bus; @@ -1021,7 +1015,7 @@ static int tpm_decode_config(struct tpm *dev) * TODO(sjg@chromium.org): Older TPMs will need to use the older method * in iic_tpm_read() so the offset length needs to be 0 here. */ - ret = i2c_get_chip(bus, chip_addr, 1, &dev->dev); + ret = i2c_get_chip(bus, chip_addr, 1, &chip->dev); if (ret) { debug("Cannot find device for node '%s: ret=%d'\n", fdt_get_name(blob, node, NULL), ret); @@ -1033,15 +1027,15 @@ static int tpm_decode_config(struct tpm *dev) int tis_init(void) { - if (tpm.inited) + if (g_chip.inited) return 0; - if (tpm_decode_config(&tpm)) + if (tpm_decode_config(&g_chip)) return -1; debug("%s: done\n", __func__); - tpm.inited = 1; + g_chip.inited = 1; return 0; } @@ -1050,17 +1044,17 @@ int tis_open(void) { int rc; - if (!tpm.inited) + if (!g_chip.inited) return -1; - rc = tpm_open_dev(tpm.dev); + rc = tpm_open_dev(g_chip.dev); return rc; } int tis_close(void) { - if (!tpm.inited) + if (!g_chip.inited) return -1; tpm_close(); @@ -1074,7 +1068,7 @@ int tis_sendrecv(const uint8_t *sendbuf, size_t sbuf_size, int len; uint8_t buf[4096]; - if (!tpm.inited) + if (!g_chip.inited) return -1; if (sizeof(buf) < sbuf_size) diff --git a/drivers/tpm/tpm_tis_i2c.h b/drivers/tpm/tpm_tis_i2c.h index 0fec464..161e63b 100644 --- a/drivers/tpm/tpm_tis_i2c.h +++ b/drivers/tpm/tpm_tis_i2c.h @@ -43,6 +43,7 @@ enum i2c_chip_type { }; struct tpm_chip { + bool inited; int is_open; u8 req_complete_mask; u8 req_complete_val; |