From: Valdis Kletnieks Date: Thu, 16 Oct 2008 05:04:35 +0000 (-0700) Subject: tpm: work around bug in Broadcom BCM0102 chipset X-Git-Tag: v2.6.28-rc1~335 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=292cf4a8a989cb564a6a5f0ba7a66e08a095afa1;p=linux-2.6-omap-h63xx.git tpm: work around bug in Broadcom BCM0102 chipset Patch tpm-correct-tpm-timeouts-to-jiffies-conversion reveals a bug in the Broadcom BCM0102 TPM chipset used in the Dell Latitude D820 - although most of the timeouts are returned in usecs as per the spec, one is apparently returned in msecs, which results in a too-small value leading to a timeout when the code treats it as usecs. To prevent a regression, we check for the known too-short value and adjust it to a value that makes things work. Signed-off-by: Valdis Kletnieks Cc: Marcin Obara Cc: Marcel Selhorst Cc: Kylene Jo Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 6b5a0e0127a..aa899cec6b3 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -557,6 +557,13 @@ duration: usecs_to_jiffies(be32_to_cpu (*((__be32 *) (data + TPM_GET_CAP_RET_UINT32_1_IDX)))); + /* The Broadcom BCM0102 chipset in a Dell Latitude D820 gets the above + * value wrong and apparently reports msecs rather than usecs. So we + * fix up the resulting too-small TPM_SHORT value to make things work. + */ + if (chip->vendor.duration[TPM_SHORT] < (HZ/100)) + chip->vendor.duration[TPM_SHORT] = HZ; + chip->vendor.duration[TPM_MEDIUM] = usecs_to_jiffies(be32_to_cpu (*((__be32 *) (data +