From patchwork Wed Nov 23 05:46:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 698064 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tNrtf3sX2z9svs for ; Wed, 23 Nov 2016 16:46:34 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tNrtf32CfzDvsx for ; Wed, 23 Nov 2016 16:46:34 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tNrtF5JqmzDvqn for ; Wed, 23 Nov 2016 16:46:13 +1100 (AEDT) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAN5hfrD010709 for ; Wed, 23 Nov 2016 00:46:11 -0500 Received: from e32.co.us.ibm.com (e32.co.us.ibm.com [32.97.110.150]) by mx0a-001b2d01.pphosted.com with ESMTP id 26w2fsmn56-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 23 Nov 2016 00:46:11 -0500 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 22 Nov 2016 22:46:10 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e32.co.us.ibm.com (192.168.1.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 22 Nov 2016 22:46:07 -0700 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id C50231FF0026 for ; Tue, 22 Nov 2016 22:45:46 -0700 (MST) Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAN5k3jq14745960; Tue, 22 Nov 2016 22:46:07 -0700 Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 657A1BE038; Tue, 22 Nov 2016 22:46:07 -0700 (MST) Received: from birb.localdomain (unknown [9.185.16.166]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP id EAF6FBE04A; Tue, 22 Nov 2016 22:46:06 -0700 (MST) Received: by birb.localdomain (Postfix, from userid 1000) id B445B229DB45; Wed, 23 Nov 2016 16:46:03 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Wed, 23 Nov 2016 16:46:00 +1100 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1479879962-1943-1-git-send-email-stewart@linux.vnet.ibm.com> References: <1479879962-1943-1-git-send-email-stewart@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112305-0004-0000-0000-000010EADA80 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006127; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00784202; UDB=6.00378800; IPR=6.00561819; BA=6.00004904; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013413; XFM=3.00000011; UTC=2016-11-23 05:46:08 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112305-0005-0000-0000-00007AD10EEC Message-Id: <1479879962-1943-2-git-send-email-stewart@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-23_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611230105 Subject: [Skiboot] [PATCH 2/4] tpm_i2c_interface: set timeout before each request X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" The i2c code manipulates req->timeout, so it has to be reset before re-sending. Signed-off-by: Stewart Smith Tested-by: Claudio Carvalho --- libstb/drivers/tpm_i2c_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libstb/drivers/tpm_i2c_interface.c b/libstb/drivers/tpm_i2c_interface.c index 4d136fd..89f5ba6 100644 --- a/libstb/drivers/tpm_i2c_interface.c +++ b/libstb/drivers/tpm_i2c_interface.c @@ -99,11 +99,11 @@ int tpm_i2c_request_send(int tpm_bus_id, int tpm_dev_addr, int read_write, * since the I2C master's timeout is too short (1ms per byte). */ timeout = (buflen + offset_bytes + 2) * I2C_BYTE_TIMEOUT_MS; - i2c_set_req_timeout(req, timeout); for (retries = 0; retries <= TPM_MAX_NACK_RETRIES; retries++) { rc = 1; waited = 0; + i2c_set_req_timeout(req, timeout); i2c_queue_req(req); do {