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: 84055 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 o28DLUxh030899 for ; Mon, 8 Mar 2010 13:21:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753701Ab0CHNVa (ORCPT ); Mon, 8 Mar 2010 08:21:30 -0500 Received: from pan.gwi.net ([207.5.128.165]:3781 "EHLO pan.gwi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463Ab0CHNV3 (ORCPT ); Mon, 8 Mar 2010 08:21:29 -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 o28BoV82097924; Mon, 8 Mar 2010 06:50:31 -0500 (EST) (envelope-from scott@jumpnowtek.com) Subject: [PATCH] omap2_mcspi.c : Use transaction speed if provided From: Scott Ellis To: linux-omap@vger.kernel.org Cc: tony@atomide.com, khilman@deeprootsystems.com, spi-devel-general@lists.sourceforge.net 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 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]); Mon, 08 Mar 2010 13:21:30 +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;