From patchwork Thu Dec 26 09:21:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kongxinwei X-Patchwork-Id: 182449 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp1478148ild; Thu, 26 Dec 2019 01:21:45 -0800 (PST) X-Google-Smtp-Source: APXvYqzz/fiE2kvFfqudtAGq4oy/FzbStJqe2hOfl9suu0en+YxJMshPqAgwbCjcBq+iqs5gSPxL X-Received: by 2002:a05:6830:1689:: with SMTP id k9mr51243965otr.311.1577352105724; Thu, 26 Dec 2019 01:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577352105; cv=none; d=google.com; s=arc-20160816; b=k+R3/WUijgUcED1rJGUzjVYVhBHMBXFrHTzRTeryFekHrB/trr9lz/pi7o2UxwQmwl KrH8XCp+5PvTWixSpiHybUHKHIFGICGfDBzIoFu9BlxF/V7bIj7iAMETvkf/hYijZOD1 f+e+pHUQeqS4QOzY4ukUp/g7fT+GqjjxXrhAXWVslZAJwC9ZowXEG55zsW7RkCEn3Pxs J3zAJYD7odyle3WeN4y3AbR6z5qcsmmcEiIQU3ttF1A1ypq+7D9JAdKyYhVz1Jvivyts nlHBkmqxLDmcErr9iUtOtOmUxjMiI+cUoOMM3szEar1BaZev+7tpyQrJra9rJr7JPqc1 VxoQ== 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=hZJT2Xct+/VsMrYhcR6EyegKLEbFA2ZZHwokQ2kaHPI=; b=AyNvK30lkyNu6FBH4nz53pjRSTVDje1FAEDM3ROEz4lYCY1EAiwWgn6DwzgnrsVWuF NCx5SXgBoF6+kH2IGeBcvWutsRSfRwob08W3HYnS8K4tDVm0m1cGQ8iWS3H7mgJgM238 t0NmqkgmnC5DS6kPua2xff2I4xSAEh1x8s5mw9JXqTimaoRAELPwEh+DpnZfnFppqzAt W5zrV21uQdmPISGGbY/2SDOQiEz6xOT4kPiF8jJxV47Xz67mYnQq0SuqZr4uPW7pRUfN CYDyM1p1ht1bAQd78F63Wjzo4bCSRGX3zfEDeMJJ+jOMqYW4ai3pgVCCW1sh38dcG/df y0Lw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-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 9si3609398oiz.237.2019.12.26.01.21.45; Thu, 26 Dec 2019 01:21:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-spi-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-spi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-spi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726109AbfLZJVo (ORCPT + 2 others); Thu, 26 Dec 2019 04:21:44 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:8193 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725878AbfLZJVo (ORCPT ); Thu, 26 Dec 2019 04:21:44 -0500 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id D85C7F4F8B1FEB2C7C16; Thu, 26 Dec 2019 17:21:42 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Thu, 26 Dec 2019 17:21:32 +0800 From: Xinwei Kong To: , , CC: , Xinwei Kong , fengsheng Subject: [PATCH] spi: dw: use "smp_mb()" to avoid sending spi data error Date: Thu, 26 Dec 2019 17:21:28 +0800 Message-ID: <1577352088-35856-1-git-send-email-kong.kongxinwei@hisilicon.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org this patch will add memory barrier to ensure this "struct dw_spi *dws" to complete data setting before enabling this SPI hardware interrupt. eg: it will fix to this following low possibility error in testing environment which using SPI control to connect TPM Modules kernel: tpm tpm0: Operation Timed out kernel: tpm tpm0: tpm_relinquish_locality: : error -1 Signed-off-by: fengsheng Signed-off-by: Xinwei Kong --- drivers/spi/spi-dw.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.7.4 diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index a92aa5c..d0d77a2 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -288,6 +288,8 @@ static int dw_spi_transfer_one(struct spi_controller *master, dws->rx_end = dws->rx + transfer->len; dws->len = transfer->len; + smp_mb(); + spi_enable_chip(dws, 0); /* Handle per transfer options for bpw and speed */