linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: 21cnbao@gmail.com (Barry Song)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] spi: sirf: make GPIO chipselect function work well
Date: Mon, 14 Apr 2014 14:29:59 +0800	[thread overview]
Message-ID: <1397457001-5266-4-git-send-email-21cnbao@gmail.com> (raw)
In-Reply-To: <1397457001-5266-1-git-send-email-21cnbao@gmail.com>

From: Qipan Li <Qipan.Li@csr.com>

orignal GPIO chipslect is not standard because it don't take care to the
chipselect signal: BITBANG_CS_ACTIVE and BITBANG_CS_INACTIVE.

Signed-off-by: Qipan Li <Qipan.Li@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 drivers/spi/spi-sirf.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c
index 9b30743..67d8909 100644
--- a/drivers/spi/spi-sirf.c
+++ b/drivers/spi/spi-sirf.c
@@ -470,7 +470,16 @@ static void spi_sirfsoc_chipselect(struct spi_device *spi, int value)
 		writel(regval, sspi->base + SIRFSOC_SPI_CTRL);
 	} else {
 		int gpio = sspi->chipselect[spi->chip_select];
-		gpio_direction_output(gpio, spi->mode & SPI_CS_HIGH ? 0 : 1);
+		switch (value) {
+		case BITBANG_CS_ACTIVE:
+			gpio_direction_output(gpio,
+					spi->mode & SPI_CS_HIGH ? 1 : 0);
+			break;
+		case BITBANG_CS_INACTIVE:
+			gpio_direction_output(gpio,
+					spi->mode & SPI_CS_HIGH ? 0 : 1);
+			break;
+		}
 	}
 }
 
-- 
1.7.5.4

  parent reply	other threads:[~2014-04-14  6:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-14  6:29 [PATCH 0/5] spi : sirf: some chip-select, DMA and checkpatch fixes Barry Song
2014-04-14  6:29 ` [PATCH 1/5] spi: sirf: correct TXFIFO empty interrupt status bit Barry Song
2014-04-14 20:02   ` Mark Brown
2014-04-14  6:29 ` [PATCH 2/5] spi: sirf: set SPI controller in RISC IO chipselect mode Barry Song
2014-04-14 20:03   ` Mark Brown
2014-04-14  6:29 ` Barry Song [this message]
2014-04-14 20:03   ` [PATCH 3/5] spi: sirf: make GPIO chipselect function work well Mark Brown
2014-04-14  6:30 ` [PATCH 4/5] spi: sirf: fix line over 80 characters style issue Barry Song
2014-04-14 20:04   ` Mark Brown
2014-04-14  6:30 ` [PATCH 5/5] spi: sirf: fix spi full-duplex DMA transferring issue Barry Song
2014-04-14 20:06   ` Mark Brown
2014-04-15  1:43     ` Barry Song
2014-04-15  9:26       ` Mark Brown
2014-04-15  9:57         ` Barry Song
2014-04-15 10:12           ` Mark Brown

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=1397457001-5266-4-git-send-email-21cnbao@gmail.com \
    --to=21cnbao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).