public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: linux-omap-open-source@linux.omap.com
Subject: [patch linux-omap-git] fix SPI_CPHA related errors
Date: Tue, 22 May 2007 22:32:27 -0700	[thread overview]
Message-ID: <200705222232.27584.david-b@pacbell.net> (raw)

The OMAP SPI controller drivers handle SPI_CPHA incorrectly.
It should mean:

  CPHA=0 ... sample at leading edge of clock
  CPHA=1 ... sample at trailing edge of clock

This fixes them, and the protocol drivers which depended on the wrong
meaning.  Separate ads7846 and omap_uwire patches are going upstream,
already since those drivers were already pushed there.  The tsc2102
code already had this right ... strange.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/input/touchscreen/tsc2046_ts.c |    2 +-
 drivers/spi/omap2_mcspi.c              |    4 ++--
 drivers/spi/tsc2101.c                  |    2 +-
 drivers/spi/tsc2301-core.c             |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

--- o26.orig/drivers/spi/omap2_mcspi.c	2007-05-22 22:19:10.000000000 -0700
+++ o26/drivers/spi/omap2_mcspi.c	2007-05-22 22:20:31.000000000 -0700
@@ -550,9 +550,9 @@ static int omap2_mcspi_setup_transfer(st
 	else
 		l &= ~OMAP2_MCSPI_CHCONF_POL;
 	if (spi->mode & SPI_CPHA)
-		l &= ~OMAP2_MCSPI_CHCONF_PHA;
-	else
 		l |= OMAP2_MCSPI_CHCONF_PHA;
+	else
+		l &= ~OMAP2_MCSPI_CHCONF_PHA;
 	mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, l);
 
 	dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s inverted\n",
--- o26.orig/drivers/spi/tsc2101.c	2007-05-22 22:19:10.000000000 -0700
+++ o26/drivers/spi/tsc2101.c	2007-05-22 22:20:31.000000000 -0700
@@ -237,7 +237,7 @@ static int tsc2101_probe(struct spi_devi
 
 	mutex_init(&tsc2101->mutex);
 
-	spi->mode = SPI_MODE_0;
+	spi->mode = SPI_MODE_1;
 	spi->bits_per_word = 16;
 	if ((r = spi_setup(spi)) < 0) {
 		dev_err(&spi->dev, "SPI setup failed\n");
--- o26.orig/drivers/spi/tsc2301-core.c	2007-05-22 22:19:10.000000000 -0700
+++ o26/drivers/spi/tsc2301-core.c	2007-05-22 22:20:31.000000000 -0700
@@ -170,7 +170,7 @@ static int __devinit tsc2301_probe(struc
 	} else
 		tsc->reset_gpio = -1;
 
-	spi->mode = SPI_MODE_0;
+	spi->mode = SPI_MODE_1;
 	spi->bits_per_word = 16;
 	/* The max speed might've been defined by the board-specific
 	 * struct */
--- o26.orig/drivers/input/touchscreen/tsc2046_ts.c	2007-05-22 22:19:10.000000000 -0700
+++ o26/drivers/input/touchscreen/tsc2046_ts.c	2007-05-22 22:20:31.000000000 -0700
@@ -499,7 +499,7 @@ static int __devinit tsc2046_probe(struc
 	tsc->spi = spi;
 	spi->dev.power.power_state = PMSG_ON;
 
-	spi->mode = SPI_MODE_1;
+	spi->mode = SPI_MODE_0;
 	spi->bits_per_word = 16;
 
 	/*

             reply	other threads:[~2007-05-23  5:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-23  5:32 David Brownell [this message]
2007-05-23 16:50 ` [patch linux-omap-git] fix SPI_CPHA related errors Kevin Hilman
2007-05-25  0:36   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200705222232.27584.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-omap-open-source@linux.omap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox