summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-12-20 10:41:11 -0800
committerSimon Glass <sjg@chromium.org>2012-01-06 12:45:25 -0800
commit69a2a7a4dd72cdf7550d4eb384e8b6c4df1661db (patch)
tree0fff4047e409f309af2391c5fdf4fd95e8d4c33e /drivers
parentfa271550460aec661c7e59f71593a0e4ecf10384 (diff)
Get burst length at init time
Rather than requesting the burst length on every transaction, just do it at the start. This saves 30ms on Kaen (TPM time now 325ms). BUG=chromium-os:22938 TEST=build and boot on Kaen Change-Id: I8a1b028882c28cd6089c2f7514bee285ef349f24 Reviewed-on: https://gerrit.chromium.org/gerrit/13374 Reviewed-by: Rong Chang <rongchang@chromium.org> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org> Commit-Ready: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tpm/slb9635_i2c/tpm_tis_i2c.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/tpm/slb9635_i2c/tpm_tis_i2c.c b/drivers/tpm/slb9635_i2c/tpm_tis_i2c.c
index e1b60565e4..c0d56dc503 100644
--- a/drivers/tpm/slb9635_i2c/tpm_tis_i2c.c
+++ b/drivers/tpm/slb9635_i2c/tpm_tis_i2c.c
@@ -77,6 +77,8 @@ static struct tpm_inf_dev tpm_dev = {
.addr = TPM_I2C_ADDR
};
+static int burst_count; /* maximum number of bytes in one transfer */
+
struct op_stats {
int ok;
int fail;
@@ -377,7 +379,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
int rc;
while (size < count) {
- burstcnt = get_burstcount(chip);
+ burstcnt = burst_count;
/* limit received data to max. left */
if (burstcnt > (count - size))
@@ -468,7 +470,7 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
}
}
- burstcnt = get_burstcount(chip);
+ burstcnt = burst_count;
while (count < len) {
if (burstcnt > (len - count))
@@ -577,6 +579,9 @@ int tpm_vendor_init(uint32_t dev_addr)
dev_info(dev, "1.2 TPM (device-id 0x%X)\n", vendor >> 16);
+ burst_count = get_burstcount(chip);
+ debug("burst count = %d\n", burst_count);
+
/*
* A timeout query to TPM can be placed here.
* Standard timeout values are used so far