summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-12-20 14:59:35 -0800
committerSimon Glass <sjg@chromium.org>2012-01-05 19:27:43 -0800
commitfe7814fabf738769d20491cbfa8c98b454bc621c (patch)
tree0edccdebfa6ee3eef4bcbb972071202c3332273e /drivers
parent8f5f2bf0c56bd1d024f11f872db09f02fb6ad03a (diff)
slb9635_i2c: Do writes in one transaction
Since burst_length is now set up at init time, it can never be < 0, and we don't need to write the last byte in a separate I2C transaction. BUG=chromium-os:22938 TEST=build and boot on Kaen Change-Id: I0050dd49ba151ee267f2790b550c0ffea4cd976f Reviewed-on: https://gerrit.chromium.org/gerrit/13375 Commit-Ready: Simon Glass <sjg@chromium.org> Reviewed-by: 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.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/tpm/slb9635_i2c/tpm_tis_i2c.c b/drivers/tpm/slb9635_i2c/tpm_tis_i2c.c
index aea3c26435..d07140f031 100644
--- a/drivers/tpm/slb9635_i2c/tpm_tis_i2c.c
+++ b/drivers/tpm/slb9635_i2c/tpm_tis_i2c.c
@@ -336,10 +336,6 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
while (size < count) {
burstcnt = get_burstcount(chip);
- /* burstcount < 0 = tpm is busy */
- if (burstcnt < 0)
- return burstcnt;
-
/* limit received data to max. left */
if (burstcnt > (count - size))
burstcnt = count - size;
@@ -430,13 +426,9 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
burstcnt = get_burstcount(chip);
- /* burstcount < 0 = tpm is busy */
- if (burstcnt < 0)
- return burstcnt;
-
- while (count < len - 1) {
- if (burstcnt > (len-1-count))
- burstcnt = len-1-count;
+ while (count < len) {
+ if (burstcnt > (len - count))
+ burstcnt = len - count;
#ifdef CONFIG_TPM_I2C_BURST_LIMITATION
if (retry && burstcnt > CONFIG_TPM_I2C_BURST_LIMITATION)
@@ -460,8 +452,6 @@ static int tpm_tis_i2c_send(struct tpm_chip *chip, u8 *buf, size_t len)
}
- /* write last byte */
- iic_tpm_write(TPM_DATA_FIFO(chip->vendor.locality), &(buf[count]), 1);
wait_for_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c, &status);
if ((status & TPM_STS_DATA_EXPECT) != 0) {
rc = -EIO;