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: 85302 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2CFLx9o024668 for ; Fri, 12 Mar 2010 15:22:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934232Ab0CLPWJ (ORCPT ); Fri, 12 Mar 2010 10:22:09 -0500 Received: from pan.gwi.net ([207.5.128.165]:3498 "EHLO pan.gwi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934020Ab0CLPWH (ORCPT ); Fri, 12 Mar 2010 10:22:07 -0500 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) Subject: [PATCH 4/6] SPI omap2_mcspi.c: Use the transfer speed_hz value if provided From: Scott Ellis To: spi-devel-general@lists.sourceforge.net Cc: David Brownell , Grant Likely , Tony Lindgren , Andrew Morton , Roman Tereshonkov , linux-omap@vger.kernel.org, Aaro Koskinen , Kevin Hilman 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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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:13 +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;