[Skiboot] [PATCH 12/15] libstb/drivers/tpm_i2c_nuvoton.c: Set I2C request timeout

Stewart Smith stewart at linux.vnet.ibm.com
Wed Sep 14 19:31:39 AEST 2016


Claudio Carvalho <cclaudio at linux.vnet.ibm.com> writes:
> The I2C master's timeout is too short (1ms per byte) and we get a
> master timeout for all I2C request sent to the TPM device at
> boot time.
>
> This patch sets the I2C request timeout considering the timeout
> of 10 ms per byte.
>
> Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
> ---
>  libstb/drivers/tpm_i2c_nuvoton.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Squash into introduction of driver? Or is the difference in timeout
something we want to make note of as an important difference between
skiboot and hostboot?

>
> diff --git a/libstb/drivers/tpm_i2c_nuvoton.c b/libstb/drivers/tpm_i2c_nuvoton.c
> index b615347..4790359 100644
> --- a/libstb/drivers/tpm_i2c_nuvoton.c
> +++ b/libstb/drivers/tpm_i2c_nuvoton.c
> @@ -61,8 +61,7 @@
>  #define TCG_PTP_STS_RESPONSE_RETRY	0x02
>  #define TCG_PTP_STS_ERR_VAL		0x07
>  
> -/* from hw/p8-i2c.c */
> -#define I2C_TIMEOUT_POLL_MS	4000  /* 4s/byte timeout */
> +#define I2C_BYTE_TIMEOUT_MS		10  /* 10ms/byte timeout */
>  
>  /* TPM Driver values */
>  #define MAX_STSVALID_POLLS 	5   /* Max poll of 50ms (5*10ms) */
> @@ -133,7 +132,8 @@ static int tpm_i2c_request_send(int read_write, uint32_t offset,
>  	req->completion = i2c_request_complete;
>  	req->user_data = &rc;
>  
> -	timeout = (buflen + offset_bytes + 2) * I2C_TIMEOUT_POLL_MS;
> +	timeout = (buflen + offset_bytes + 2) * I2C_BYTE_TIMEOUT_MS;
> +	i2c_set_req_timeout(req, timeout);
>  
>  	for (retries = 0; retries <= TPM_MAX_NACK_RETRIES; retries++)
>  	{

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list