From patchwork Fri Mar 12 15:22:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Ellis X-Patchwork-Id: 85306 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2CFMJVi024736 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 12 Mar 2010 15:22:55 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nq6gs-0006Gb-RH; Fri, 12 Mar 2010 15:22:18 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Nq6gr-0006G6-Km for spi-devel-general@lists.sourceforge.net; Fri, 12 Mar 2010 15:22:17 +0000 X-ACL-Warn: Received: from pan.gwi.net ([207.5.128.165]) by sfi-mx-4.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1Nq6gq-0007ui-Rt for spi-devel-general@lists.sourceforge.net; Fri, 12 Mar 2010 15:22:17 +0000 Received: from [192.168.10.4] (66-63-88-74.static.suscom-maine.net [66.63.88.74]) by pan.gwi.net (8.13.1/8.13.1) with ESMTP id o2CFM49R033572; Fri, 12 Mar 2010 10:22:04 -0500 (EST) (envelope-from scott@jumpnowtek.com) From: Scott Ellis To: spi-devel-general@lists.sourceforge.net Date: Fri, 12 Mar 2010 10:22:04 -0500 Message-ID: <1268407324.14445.53.camel@quad> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 X-Spam-Score: 0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. _SUMMARY_ X-Headers-End: 1Nq6gq-0007ui-Rt Cc: David Brownell , Tony Lindgren , Aaro Koskinen , Kevin Hilman , Andrew Morton , linux-omap@vger.kernel.org, Roman Tereshonkov Subject: [spi-devel-general] [PATCH 4/6] SPI omap2_mcspi.c: Use the transfer speed_hz value if provided 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-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 12 Mar 2010 15:22:55 +0000 (UTC) diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 37e6d73..2a93a73 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c @@ -580,18 +580,24 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, struct spi_master *spi_cntrl; u32 l = 0, div = 0; u8 word_len = spi->bits_per_word; + u32 speed_hz = spi->max_speed_hz; mcspi = spi_master_get_devdata(spi->master); spi_cntrl = mcspi->master; - if (t != NULL && t->bits_per_word) - word_len = t->bits_per_word; + if (t != NULL) { + if (t->bits_per_word) + word_len = t->bits_per_word; + + if (t->speed_hz) + speed_hz = t->speed_hz; + } cs->word_len = word_len; - if (spi->max_speed_hz) { + if (speed_hz) { while (div <= mcspi->max_clk_div && - (OMAP2_MCSPI_MAX_FREQ/(1 << div)) > spi->max_speed_hz) + (OMAP2_MCSPI_MAX_FREQ/(1 << div)) > speed_hz) div++; } else { div = mcspi->max_clk_div;