From patchwork Fri May 7 14:51:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5Lmx55+z?= X-Patchwork-Id: 432759 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CECABC43460 for ; Fri, 7 May 2021 14:51:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84A9A61019 for ; Fri, 7 May 2021 14:51:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237684AbhEGOwc (ORCPT ); Fri, 7 May 2021 10:52:32 -0400 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:33345 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234601AbhEGOwc (ORCPT ); Fri, 7 May 2021 10:52:32 -0400 X-Alimail-AntiSpam: AC=PASS; BC=-1|-1; BR=01201311R881e4; CH=green; DM=||false|; DS=||; FP=0|-1|-1|-1|0|-1|-1|-1; HT=e01e04420; MF=zhangliguang@linux.alibaba.com; NM=1; PH=DS; RN=4; SR=0; TI=SMTPD_---0UY3o8Jd_1620399079; Received: from localhost(mailfrom:zhangliguang@linux.alibaba.com fp:SMTPD_---0UY3o8Jd_1620399079) by smtp.aliyun-inc.com(127.0.0.1); Fri, 07 May 2021 22:51:30 +0800 From: Liguang Zhang To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Liguang Zhang Subject: [PATCH] spi: set right CS polarity depend on gpiolib Date: Fri, 7 May 2021 22:51:17 +0800 Message-Id: <20210507145117.43221-1-zhangliguang@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org After a kernel upgrade from 4.19 to 5.10, we found that tpm flow control always causes TIMEOUT which caused by wrong CS polarity setting depend on gpiolib. Signed-off-by: Liguang Zhang --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index ba425b9c7700..9ee2b92b4506 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -816,7 +816,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable, bool force) if (!(spi->mode & SPI_NO_CS)) { if (spi->cs_gpiod) /* polarity handled by gpiolib */ - gpiod_set_value_cansleep(spi->cs_gpiod, activate); + gpiod_set_value_cansleep(spi->cs_gpiod, !enable); else /* * invert the enable line, as active low is