Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5123152ybl; Tue, 14 Jan 2020 03:59:04 -0800 (PST) X-Google-Smtp-Source: APXvYqxpboamHkra1pbPgBOVxeNLE+wKrmxdZY+NXrbHDvZ7LDyB7To7YfY29I75x4wTqfMTEY+W X-Received: by 2002:a54:4501:: with SMTP id l1mr15384790oil.101.1579003144527; Tue, 14 Jan 2020 03:59:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579003144; cv=none; d=google.com; s=arc-20160816; b=OkMGULff6c8tN6l+O0xjpl81u8w6bY4oO4YFzCUm6yN2vWhtgu0un0zvpdZEA7bjtN eTARa85IghXGY15g0ShnXDQOX1f4LFSnnQz4DNJy6XnLhC8UWtS2ya5XfOlbMWP5iJD/ 4yRJGbmy/GdLg6UXrU+2RhjPgds4ueK2olRDW7I1vTnDLGD3WaFgmsbsCoD6R7hZE2S1 DavhNGyk9QhvEegHa0OSQ5cIET6fYlTs6OuYDA0WjMWURfuR2WpO4sNDF55jYJsR9w4m jnYcdFVa8etNzsLIwog6aJI8LZ0KGT36SPVYxAeEb6ZZoZg8/L/RxuyvFdHtuQ97bTV1 1fhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=XmyCRRASj8xY9QZ+CD765w1XTIKpzGXNHVTMQGqrsu8=; b=iNY9ODwoBLwgtdHWHDPkJYn25/NOY8x5hGtOMeecLZA4/CtqzSeRgA3yGzHvybFbT5 1e4mbh6gtIFEXwLYJADHCME8yLcXV5PdUGFRW9hlaON+YbJqAnypSaG0l7FFRCCbITZC AXMbKAp9xBwJpQHWHyCrQYp2sBh8MmYdnK1OvdKul2JzEOgshuz8BS1k21vVq+EopkHC YOy3jfzmO58sihOxLpq48JzeetPHSSZQwJXGkf1Ui76K7tGy/WBX6V5paAfqE1n5miK4 KcCixAgnmCy68gADk2zqJRVpShDpaBxk3FVg7EaV97h4M4AvXbNouOtlsGM/ccGR29wL tWOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w9si537011otk.91.2020.01.14.03.58.53; Tue, 14 Jan 2020 03:59:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729665AbgANL4u (ORCPT + 99 others); Tue, 14 Jan 2020 06:56:50 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:9172 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725956AbgANL4u (ORCPT ); Tue, 14 Jan 2020 06:56:50 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D9E49CC318F77E6BF210; Tue, 14 Jan 2020 19:56:46 +0800 (CST) Received: from huawei.com (10.175.107.192) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.439.0; Tue, 14 Jan 2020 19:56:38 +0800 From: wanghongzhe To: CC: , , , Subject: [PATCH] tpm: tpm_tis_spi: set cs_change = 0 when timesout Date: Tue, 14 Jan 2020 20:31:59 +0800 Message-ID: <1579005119-16318-1-git-send-email-wanghongzhe@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.107.192] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org when i reach TPM_RETRY, the cs cannot change back to 'high'.So the TPM chips thinks this communication is not over. And next times communication cannot be effective because the communications mixed up with the last time. Signed-off-by: wanghongzhe --- drivers/char/tpm/tpm_tis_spi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/char/tpm/tpm_tis_spi.c b/drivers/char/tpm/tpm_tis_spi.c index d1754fd..a1ae4f6 100644 --- a/drivers/char/tpm/tpm_tis_spi.c +++ b/drivers/char/tpm/tpm_tis_spi.c @@ -67,7 +67,14 @@ static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy, } if (i == TPM_RETRY) + { + spi_xfer.cs_change = 0; + spi_xfer->len = 1; + spi_message_init(&m); + spi_message_add_tail(spi_xfer, &m); + ret = spi_sync_locked(phy->spi_device, &m); return -ETIMEDOUT; + } } return 0; -- 1.7.12.4