From patchwork Fri Jul 13 12:43:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 1195451 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork1.kernel.org (Postfix) with ESMTP id 63A903FC4C for ; Fri, 13 Jul 2012 12:40:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1SpfAE-0001Eq-3k; Fri, 13 Jul 2012 12:40:06 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1SpfAC-0001El-P6 for spi-devel-general@lists.sourceforge.net; Fri, 13 Jul 2012 12:40:04 +0000 X-ACL-Warn: Received: from smtp-out-151.synserver.de ([212.40.185.151]) by sog-mx-2.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1SpfAA-0004D2-QU for spi-devel-general@lists.sourceforge.net; Fri, 13 Jul 2012 12:40:04 +0000 Received: (qmail 5803 invoked by uid 0); 13 Jul 2012 12:39:56 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 4982 Received: from p5491f465.dip.t-dialin.net (HELO lars-adi-laptop.analog.com) [84.145.244.101] by 217.119.54.87 with SMTP; 13 Jul 2012 12:39:55 -0000 From: Lars-Peter Clausen To: Grant Likely Subject: [PATCH] spi: Add support for specifing 3-wire mode via device tree Date: Fri, 13 Jul 2012 14:43:47 +0200 Message-Id: <1342183427-23430-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.7.10.4 X-Spam-Score: -0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1SpfAA-0004D2-QU Cc: spi-devel-general@lists.sourceforge.net, devicetree-discuss@lists.ozlabs.org, Lars-Peter Clausen , Michael Hennerich , Rob Herring X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net This patch allows to specify that a SPI device is connected in 3-wire mode via the device tree. Signed-off-by: Lars-Peter Clausen Acked-by: Rob Herring --- Documentation/devicetree/bindings/spi/spi-bus.txt | 2 ++ drivers/spi/spi.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/spi/spi-bus.txt b/Documentation/devicetree/bindings/spi/spi-bus.txt index e782add..46f2f3b 100644 --- a/Documentation/devicetree/bindings/spi/spi-bus.txt +++ b/Documentation/devicetree/bindings/spi/spi-bus.txt @@ -33,6 +33,8 @@ contain the following properties. shifted clock phase (CPHA) mode - spi-cs-high - (optional) Empty property indicating device requires chip select active high +- spi-3wire - (optional) Empty property indicating device requires + 3-wire mode. SPI example for an MPC5200 SPI bus: spi@f00 { diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index fc0da39..09da7de 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -856,6 +856,8 @@ static void of_register_spi_devices(struct spi_master *master) spi->mode |= SPI_CPOL; if (of_find_property(nc, "spi-cs-high", NULL)) spi->mode |= SPI_CS_HIGH; + if (of_find_property(nc, "spi-3wire", NULL)) + spi->mode |= SPI_3WIRE; /* Device speed */ prop = of_get_property(nc, "spi-max-frequency", &len);