linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Werner <andreas.werner@men.de>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-spi@vger.kernel.org>, <broonie@kernel.org>
Subject: [PATCH] spi/spi-fsl-espi.c: Add spi cs polarity support
Date: Mon, 7 Dec 2015 08:07:16 +0100	[thread overview]
Message-ID: <20151207070657.GA25586@awelinux> (raw)

Add CS polarity flag to be able to set the CS polarity
via the DT property spi-cs-high.

Signed-off-by: Andreas Werner <andreas.werner@men.de>
---
 drivers/spi/spi-fsl-espi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c
index c27124a..2dc70953 100644
--- a/drivers/spi/spi-fsl-espi.c
+++ b/drivers/spi/spi-fsl-espi.c
@@ -495,7 +495,7 @@ static int fsl_espi_setup(struct spi_device *spi)
 			&reg_base->csmode[spi->chip_select]);
 	/* mask out bits we are going to set */
 	cs->hw_mode &= ~(CSMODE_CP_BEGIN_EDGECLK | CSMODE_CI_INACTIVEHIGH
-			 | CSMODE_REV);
+			 | CSMODE_REV | CSMODE_POL_1);
 
 	if (spi->mode & SPI_CPHA)
 		cs->hw_mode |= CSMODE_CP_BEGIN_EDGECLK;
@@ -503,6 +503,8 @@ static int fsl_espi_setup(struct spi_device *spi)
 		cs->hw_mode |= CSMODE_CI_INACTIVEHIGH;
 	if (!(spi->mode & SPI_LSB_FIRST))
 		cs->hw_mode |= CSMODE_REV;
+	if (!(spi->mode & SPI_CS_HIGH))
+		cs->hw_mode |= CSMODE_POL_1;
 
 	/* Handle the loop mode */
 	loop_mode = mpc8xxx_spi_read_reg(&reg_base->mode);
-- 
2.6.2

             reply	other threads:[~2015-12-07  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07  7:07 Andreas Werner [this message]
2016-01-06 13:00 ` [PATCH] spi/spi-fsl-espi.c: Add spi cs polarity support Andreas Werner
     [not found]   ` <1452085240-9582-1-git-send-email-andy-KIP9bFwF4MjQTulR1yJuvA@public.gmane.org>
2016-01-06 17:31     ` 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=20151207070657.GA25586@awelinux \
    --to=andreas.werner@men.de \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.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).