linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/6] SPI omap2_mcspi.c: Use the transfer speed_hz value if provided
@ 2010-03-12 15:22 Scott Ellis
  2010-05-24 14:44 ` Scott Ellis
  0 siblings, 1 reply; 2+ messages in thread
From: Scott Ellis @ 2010-03-12 15:22 UTC (permalink / raw)
  To: spi-devel-general
  Cc: David Brownell, Grant Likely, Tony Lindgren, Andrew Morton,
	Roman Tereshonkov, linux-omap, Aaro Koskinen, Kevin Hilman

omap2_mcspi_setup_transfer() gets called if a transfer has a non-zero
speed_hz value but it is never used in the function to override the
speed. 

This patch enables its use.

Signed-off-by: Scott Ellis <scott@jumpnowtek.com>

 drivers/spi/omap2_mcspi.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

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;






^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-24 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-12 15:22 [PATCH 4/6] SPI omap2_mcspi.c: Use the transfer speed_hz value if provided Scott Ellis
2010-05-24 14:44 ` Scott Ellis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).