From patchwork Wed Aug 7 15:44:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 2840391 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 22A74BF535 for ; Wed, 7 Aug 2013 16:16:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F19F4203C4 for ; Wed, 7 Aug 2013 16:15:58 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 678FB2037B for ; Wed, 7 Aug 2013 16:15:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1V76Oy-0000uI-FE; Wed, 07 Aug 2013 16:15:56 +0000 Received: from sog-mx-3.v43.ch3.sourceforge.com ([172.29.43.193] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1V76Ox-0000uD-KF for spi-devel-general@lists.sourceforge.net; Wed, 07 Aug 2013 16:15:55 +0000 Received: from pegase1.c-s.fr ([93.17.236.30] helo=mailhub1.si.c-s.fr) by sog-mx-3.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1V76Ow-0007W4-0l for spi-devel-general@lists.sourceforge.net; Wed, 07 Aug 2013 16:15:55 +0000 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 839621C855B; Wed, 7 Aug 2013 17:44:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from mailhub1.si.c-s.fr ([192.168.12.234]) by localhost (mailhub1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id veiZArlxUOrP; Wed, 7 Aug 2013 17:44:47 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 6B85B1C8505; Wed, 7 Aug 2013 17:44:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5B711C7392; Wed, 7 Aug 2013 17:44:47 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id W0TpLGdaRAtn; Wed, 7 Aug 2013 17:44:47 +0200 (CEST) Received: from localhost.localdomain (unknown [172.25.231.7]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by messagerie.si.c-s.fr (Postfix) with ESMTP id 344C3C7391; Wed, 7 Aug 2013 17:44:47 +0200 (CEST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.13.8/8.13.8) with ESMTP id r77FikWJ006652; Wed, 7 Aug 2013 17:44:46 +0200 Received: (from root@localhost) by localhost.localdomain (8.13.8/8.13.8/Submit) id r77Fij2Y006649; Wed, 7 Aug 2013 17:44:45 +0200 Date: Wed, 7 Aug 2013 17:44:45 +0200 Message-Id: <201308071544.r77Fij2Y006649@localhost.localdomain> From: Christophe Leroy To: Grant Likely , Rob Herring Subject: [PATCH] SPI: Set SPI bits per words in an OF DeviceTree SPI node X-Spam-Score: -0.0 (/) X-Headers-End: 1V76Ow-0007W4-0l Cc: stigge@antcom.de, spi-devel-general@lists.sourceforge.net, devicetree-discuss@lists.ozlabs.org, linux-kernel@vger.kernel.org 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 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch allows to set up the bits per word together with all other SPI parameters in the SPI Node of the OF device tree In the node, you then have to include the 'spi-bits' property. Exemple: fpga-loader@7 { compatible = "cs,fpga-loader"; spi-max-frequency = <10000000>; reg = <7>; spi-cs-high; spi-bits = <16>; }; Signed-off-by: Christophe Leroy ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite! It's a free troubleshooting tool designed for production. Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk --- linux-3.8.13/drivers/spi/spi.c 2013-05-11 22:57:46.000000000 +0200 +++ linux/drivers/spi/spi.c 2013-08-06 18:19:30.000000000 +0200 @@ -870,6 +870,11 @@ if (of_find_property(nc, "spi-3wire", NULL)) spi->mode |= SPI_3WIRE; + /* Bits per word */ + prop = of_get_property(nc, "spi-bits", &len); + if (prop && len >= sizeof(*prop)) + spi->bits_per_word = prop[0]; + /* Device speed */ prop = of_get_property(nc, "spi-max-frequency", &len); if (!prop || len < sizeof(*prop)) {