Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5483199imm; Tue, 18 Sep 2018 10:12:11 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbRtHxoQ2eJjNYgy9OMldy9lCwgUChqwhJa5VxTMVqU/iIpiXflJXsgNR6UI1V6DNUcLQh+ X-Received: by 2002:a17:902:a9ca:: with SMTP id b10-v6mr30002704plr.198.1537290731570; Tue, 18 Sep 2018 10:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537290731; cv=none; d=google.com; s=arc-20160816; b=HdAA2dDtGUVbShpoxdQEreRyW4E8fywDwPYHhLgd41aOhg8V1si5L/y50YLPflwlV+ 41vJ1Cg0mCh5/IrU1vvIvR7yz1xPCa/GJ7r4cOPWawfIOJ8ZgB5J7gl8S2CuCWgmniqT ctrzuGiiJ9EYPR3pCUEBQEdYKybo3p8t1GM5iZoUAHySAZZ4AHfLdEzMUVoCsjh8PxbR bU5Ixq8Krsp5m/3913EUwpDJLkbmEX+YKyz8+Ncw8np0APyJP+TYit1bQEYSaCwE5GsG pTDz6BZ4AjRq1U5sC11ke83Z/25EeC3GAYYi7vEfmisXa2VPyImz4jsrTDYgZiz9a22M geyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=CVEZQfhpOax9V6w0fywqhXogT8tOUapZhE83QXy6kl4=; b=LOMqz81TM1hADchU8Ia+qYeoMNGifCBy4xN58/Uag9G6OKhJx7LXniGlO3lDC7JXJC vhbrQZJ+iPgrcJblD1ZADPj7vgeY+pESwMPVkKt67i6uLgLfB2e4sIawb4J57tCQZ8JR 3vC3aeDJhfeaaNjk3M39TbugIlgpG7hm3l3YYsI3IZ6r9zwThcgM5gHq/3Nkz8fGSI8J LxnpE0YzNDIWWip/g8Q/dC1e4WGul0Q/DZpUlO+FAPm4hgvAJem6PvAXTgHaIAswzD0w HBzu6TNpyLZOtN3IRKGL4ZEf1mUq30/t4qArEHFcLViOizAMrDz0/M+yqvdBuYSNDG5O rkZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=VX01wqp2; 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 59-v6si18187174plp.87.2018.09.18.10.11.50; Tue, 18 Sep 2018 10:12:11 -0700 (PDT) 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; dkim=fail header.i=@lechnology.com header.s=default header.b=VX01wqp2; 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 S1730427AbeIRWnE (ORCPT + 99 others); Tue, 18 Sep 2018 18:43:04 -0400 Received: from vern.gendns.com ([206.190.152.46]:51319 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730373AbeIRWnD (ORCPT ); Tue, 18 Sep 2018 18:43:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject :Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=CVEZQfhpOax9V6w0fywqhXogT8tOUapZhE83QXy6kl4=; b=VX01wqp2ekQc5sd9DU9Xtm3wz rHlWXcmbNeEZqoz/m5/juvXTxxDXFP7RC+5YF19fxiTW/Tl9bmeoMkwngcdYO7ix8owmHAxEn99JC /DFM2MdlmZQzWOuZ6xNouBa0ZBKGlRTQVuAdlYxSK1wgnl+m+M9pnmrO6knRNDuvFponbiFcuoepP HHf7nUeg9dLtDAOBx4D/eX5TMvOGDTZ6vqZtzc6Ql+0cetZkGuyft23UinIwLock7vLkaGdVbMhJK iPEvFcpAZkXarlNd8dDfN5iALfaB/PJrSyZWIwNXwnsxZvgJ1DYbZbvU/p9epiw+erWD0EJ6Ioada 0ySTcejZw==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:37876 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1g2JVB-0074xZ-SO; Tue, 18 Sep 2018 13:09:30 -0400 From: David Lechner To: linux-spi@vger.kernel.org, linux-iio@vger.kernel.org Cc: David Lechner , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Mark Brown , Geert Uytterhoeven , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] spi: always use software fallback for SPI_CS_WORD when using cs_gio Date: Tue, 18 Sep 2018 12:08:48 -0500 Message-Id: <20180918170850.2749-2-david@lechnology.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180918170850.2749-1-david@lechnology.com> References: <20180918170850.2749-1-david@lechnology.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This modifies the condition for using the software fallback implementation for SPI_CS_WORD when the SPI controller is using a GPIO for the CS line. When using a GPIO for CS, the hardware implementation won't work, so we just enable the software fallback globally in this case. Signed-off-by: David Lechner --- drivers/spi/spi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index e4fb87b304a0..03833924ca6c 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2841,11 +2841,13 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message) return -EINVAL; /* If an SPI controller does not support toggling the CS line on each - * transfer (indicated by the SPI_CS_WORD flag), we can emulate it by + * transfer (indicated by the SPI_CS_WORD flag) or we are using a GPIO + * for the CS line, we can emulate the CS-per-word hardware function by * splitting transfers into one-word transfers and ensuring that * cs_change is set for each transfer. */ - if ((spi->mode & SPI_CS_WORD) && !(ctlr->mode_bits & SPI_CS_WORD)) { + if ((spi->mode & SPI_CS_WORD) && (!(ctlr->mode_bits & SPI_CS_WORD) || + gpio_is_valid(spi->cs_gpio))) { size_t maxsize; int ret; -- 2.17.1