Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3039297imm; Mon, 16 Jul 2018 20:22:19 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcq0cwpoL7bwka6KufHyS8Ywwc5Ve7Rw+KvsbxPYyCH3Ymq1k9PnwgfNCtNKVt7TpbjYbMH X-Received: by 2002:a17:902:7482:: with SMTP id h2-v6mr19398784pll.185.1531797739142; Mon, 16 Jul 2018 20:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531797739; cv=none; d=google.com; s=arc-20160816; b=XOdvGSOrwPXyb9EUsH8zu385J9GbGgRZ90L6tN3jFYtMrq7PKN85ak3YYOwUFZeD7r ydYFA+vJ6vyraSOhc41h1vtytNNxGWMtozdp6JfC5C3rhfQogeUMr1AO1PXbBiUUnMhu aFpvI9aMH2YmoPSdApLxtwKFfGaxlIhBlUIfLIokX+cFsTGnvOk9GH1AEfkxukG8XNb3 Q5HThtrMdaQ/EghtVQzOmHZbBHVMj54edPdGGl/0xfIFw23D9LCW83mpY5QrSJDLwfw8 7H1sXScuaJnMpNa8XbjKXELd9aYF0Y83UdV3SXVi5Ncpxjnp4YYbOlhAI1wXQEbdl6Qb S04A== 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:arc-authentication-results; bh=PpySnLgWn8bmOGf6XZtjVve5MFCY3xE3AGy+5AFs+Yg=; b=CI4+jElJuG0L/EgO8mpMFtdALg/flwZjSBzNi5/vLo2GpBR8jWJ6dqoNsRp2ONVuQ2 zHPomi8LhocRkW0Mm0VOLObndmF9rGNA9WuiD2fUNmHzhsW6XtNXugSML3YLw/23kqu+ 7R2rgaoGi7DmTF0MZcu+mv6vqNKxleofaatJCFItp8KSdzxi/AE+APCnY5vCp4BC9zmp ZoD8hNUgq21ea/FDZujHja6lOqx4FkT58JQy3fJdAK2GsZj8+EXqGMQmoI04FmbU0Ryb nAaUuTF4mIhuR8lfQpqrBqZhKY1c1GLmGcrw1R2zhuhhYdsrUsXl58GQZr0Y9SGJoZ+T +MPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=w5L7aCUf; 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 65-v6si21659700pfe.49.2018.07.16.20.22.04; Mon, 16 Jul 2018 20:22:19 -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=w5L7aCUf; 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 S1730999AbeGQDvl (ORCPT + 99 others); Mon, 16 Jul 2018 23:51:41 -0400 Received: from vern.gendns.com ([206.190.152.46]:35644 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729927AbeGQDvl (ORCPT ); Mon, 16 Jul 2018 23:51:41 -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=PpySnLgWn8bmOGf6XZtjVve5MFCY3xE3AGy+5AFs+Yg=; b=w5L7aCUfvZTyAKMOvIu1uYgPX yQ3637D8kgMp6ncCZ4fNyCowxgSacMKHPekyyOMSRMOIsWO6EsIbL5ZUapiW9xwqO8k2Z811MvKV0 pFg52JxVq+oapikn9Dg3CrZ1i7L5JmnI/VUzSc+jnHLOix3o1cUsh9dJ2AxVKpyH0ltQX4gyqYZvs Bp7K+x/Mul0CwhIHxlXqCU30jvOyunl4rwxdLRQi41o/Sz0kbh+8XVCgM293jfi0dvS9+2f51Zb6b OBnZ78qNAprBjRKNk64gLhesS6WFuzft64EJsE9K0BRPEs5zHMXnctB5HHwdhz7pH5aWmMl98arAw 9xuNzdekg==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:53228 helo=freyr.lechnology.com) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1ffGY8-00CnnZ-KS; Mon, 16 Jul 2018 23:21:16 -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 , linux-kernel@vger.kernel.org Subject: [PATCH 3/4] spi: spi-davinci: Add support for SPI_CS_WORD Date: Mon, 16 Jul 2018 22:20:51 -0500 Message-Id: <20180717032052.12273-4-david@lechnology.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180717032052.12273-1-david@lechnology.com> References: <20180717032052.12273-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 adds support for the SPI_CS_WORD flag to the TI DaVinci SPI driver. This mode can be used as long as we are using the hardware chip select and not a GPIO chip select. Signed-off-by: David Lechner --- drivers/spi/spi-davinci.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 577084bb911b..8e4b869b50fd 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c @@ -232,7 +232,8 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value) !(spi->mode & SPI_CS_HIGH)); } else { if (value == BITBANG_CS_ACTIVE) { - spidat1 |= SPIDAT1_CSHOLD_MASK; + if (!(spi->mode & SPI_CS_WORD)) + spidat1 |= SPIDAT1_CSHOLD_MASK; spidat1 &= ~(0x1 << chip_sel); } } @@ -449,8 +450,12 @@ static int davinci_spi_setup(struct spi_device *spi) return retval; } - if (internal_cs) + if (internal_cs) { set_io_bits(dspi->base + SPIPC0, 1 << spi->chip_select); + } else if (spi->mode & SPI_CS_WORD) { + dev_err(&spi->dev, "SPI_CS_WORD can't be use with GPIO CS\n"); + return -EINVAL; + } } if (spi->mode & SPI_READY) @@ -985,7 +990,7 @@ static int davinci_spi_probe(struct platform_device *pdev) dspi->prescaler_limit = pdata->prescaler_limit; dspi->version = pdata->version; - dspi->bitbang.flags = SPI_NO_CS | SPI_LSB_FIRST | SPI_LOOP; + dspi->bitbang.flags = SPI_NO_CS | SPI_LSB_FIRST | SPI_LOOP | SPI_CS_WORD; if (dspi->version == SPI_VERSION_2) dspi->bitbang.flags |= SPI_READY; -- 2.17.1