From patchwork Thu Oct 10 13:45:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Renner X-Patchwork-Id: 3016021 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 532DC9F243 for ; Thu, 10 Oct 2013 13:46:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B15FF2011E for ; Thu, 10 Oct 2013 13:46:00 +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 F0CED2011B for ; Thu, 10 Oct 2013 13:45:55 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1VUGYs-0002Ut-Mv; Thu, 10 Oct 2013 13:45:54 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1VUGYr-0002Ui-Bj for spi-devel-general@lists.sourceforge.net; Thu, 10 Oct 2013 13:45:53 +0000 X-ACL-Warn: Received: from moutng.kundenserver.de ([212.227.126.171]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128) (Exim 4.76) id 1VUGYq-0004YF-1N for spi-devel-general@lists.sourceforge.net; Thu, 10 Oct 2013 13:45:53 +0000 Received: from [192.168.0.18] (dslb-178-004-232-224.pools.arcor-ip.net [178.4.232.224]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MYtKV-1VGqBe3xuF-00VMct; Thu, 10 Oct 2013 15:45:38 +0200 Message-ID: <5256AF84.90500@efe-gmbh.de> Date: Thu, 10 Oct 2013 15:45:40 +0200 From: Jens Renner Organization: EFE GmbH User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: spi-devel-general@lists.sourceforge.net Subject: [PATCH][RESEND] spi/xilinx: Use DT information for bits_per_word value, fix bus_num value References: <5256A186.5030708@efe-gmbh.de> In-Reply-To: <5256A186.5030708@efe-gmbh.de> X-Enigmail-Version: 1.5.2 X-Provags-ID: V02:K0:tCA46Y4ZvboNi69V3R9aABLn/Y+ULmX50NxwOjMqjAS 3n0+1p7TVvNOn/jU2B8rGyzQfUaeuODF3aaMJxfSjrEsVtpM74 zA4kW0zYzNm+9/m201PvH7qyG3/CM1IUbNxo5xpkQXfO3h9eri JRVvMQpBmOW/F0A/BP0bNHji1XFFTiIRFTwopuYyCMTi1q4Y1g tMCqoSmZJ3Kn+yYex9aixxS2mscKfbBIMZvMnAJ3RHLrY9UBg9 2z6fFeR0BCwiLWgV+0i/cWQPsNRC3RwXDoJv96wGlaj/RMmj9O P1shkPQurLMFsO65XInB1GpZreZxJyT0lur2CTVUnHenEoLEnO tWfxRzgwuxJpySfjzYjY= X-Spam-Score: 0.0 (/) X-Headers-End: 1VUGYq-0004YF-1N Cc: broonie@sirena.org.uk, Michal Simek 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: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net X-Spam-Status: No, score=-7.1 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 overrides the default value of bits_per_word with the actual value of "xlnx,num-transfer-bits" from the DTS file to allow for 16 and 32 bit word lengths. Also, bus_num always was (and probably should still be) derived from pdev->id. Otherwise this could lead to problems when using more than one SPI master. Tested on our own Spartan-6 / Microblaze platform with two SPI controllers. Signed-off-by: Jens Renner --- drivers/spi/spi-xilinx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c index 0bf1b2c..5a6d9c5 100644 --- a/drivers/spi/spi-xilinx.c +++ b/drivers/spi/spi-xilinx.c @@ -356,6 +356,8 @@ static int xilinx_spi_probe(struct platform_device *pdev) } else { of_property_read_u32(pdev->dev.of_node, "xlnx,num-ss-bits", &num_cs); + of_property_read_u32(pdev->dev.of_node, "xlnx,num-transfer-bits", + &bits_per_word); } if (!num_cs) { @@ -385,7 +387,7 @@ static int xilinx_spi_probe(struct platform_device *pdev) goto put_master; } - master->bus_num = pdev->dev.id; + master->bus_num = pdev->id; master->num_chipselect = num_cs; master->dev.of_node = pdev->dev.of_node;