From patchwork Mon Mar 8 11:50:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Ellis X-Patchwork-Id: 84056 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 o28DLVJT030906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 8 Mar 2010 13:22:07 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 1Noctm-0005wd-T9; Mon, 08 Mar 2010 13:21:30 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1Noctl-0005wP-4U for spi-devel-general@lists.sourceforge.net; Mon, 08 Mar 2010 13:21:29 +0000 X-ACL-Warn: Received: from pan.gwi.net ([207.5.128.165]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1Noctk-0003q2-4o for spi-devel-general@lists.sourceforge.net; Mon, 08 Mar 2010 13:21:29 +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 o28BoV82097924; Mon, 8 Mar 2010 06:50:31 -0500 (EST) (envelope-from scott@jumpnowtek.com) From: Scott Ellis To: linux-omap@vger.kernel.org Date: Mon, 08 Mar 2010 06:50:30 -0500 Message-ID: <1268049030.2558.72.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: 1Noctk-0003q2-4o Cc: tony@atomide.com, khilman@deeprootsystems.com, spi-devel-general@lists.sourceforge.net Subject: [spi-devel-general] [PATCH] omap2_mcspi.c : Use transaction speed 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]); Mon, 08 Mar 2010 13:22:07 +0000 (UTC) diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index a73127b..a622560 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c @@ -587,6 +587,7 @@ 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; @@ -596,9 +597,12 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, cs->word_len = word_len; - if (spi->max_speed_hz) { + if (t != NULL && t->speed_hz) + speed_hz = t->speed_hz; + + if (speed_hz) { while (div <= OMAP2_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 = OMAP2_MCSPI_MAX_CLK_DIV;