devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alban Bedel <albeu@free.fr>
To: linux-spi@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Ralf Baechle <ralf@linux-mips.org>,
	Mark Brown <broonie@kernel.org>, Alban Bedel <albeu@free.fr>,
	Gabor Juhos <juhosg@openwrt.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mips@linux-mips.org
Subject: [PATCH 4/4] spi: spi-ath79: Set the initial state of CS0
Date: Fri, 24 Apr 2015 16:19:24 +0200	[thread overview]
Message-ID: <1429885164-28501-5-git-send-email-albeu@free.fr> (raw)
In-Reply-To: <1429885164-28501-1-git-send-email-albeu@free.fr>

The internal chip select CS0 wasn't initialized properly to work with
CS HIGH chips.

Signed-off-by: Alban Bedel <albeu@free.fr>
---
 drivers/spi/spi-ath79.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index b37bedd..bf1f9b3 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -115,6 +115,7 @@ static void ath79_spi_disable(struct ath79_spi *sp)
 
 static int ath79_spi_setup_cs(struct spi_device *spi)
 {
+	struct ath79_spi *sp = ath79_spidev_to_sp(spi);
 	int status;
 
 	if (spi->chip_select && !gpio_is_valid(spi->cs_gpio))
@@ -132,6 +133,13 @@ static int ath79_spi_setup_cs(struct spi_device *spi)
 
 		status = gpio_request_one(spi->cs_gpio, flags,
 					  dev_name(&spi->dev));
+	} else {
+		if (spi->mode & SPI_CS_HIGH)
+			sp->ioc_base &= ~AR71XX_SPI_IOC_CS0;
+		else
+			sp->ioc_base |= AR71XX_SPI_IOC_CS0;
+
+		ath79_spi_wr(sp, AR71XX_SPI_REG_IOC, sp->ioc_base);
 	}
 
 	return status;
-- 
2.0.0

      parent reply	other threads:[~2015-04-24 14:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 14:19 [PATCH 0/4] spi: spi-ath79: Devicetree support and misc fixes Alban Bedel
2015-04-24 14:19 ` [PATCH 1/4] devicetree: add binding documentation for the AR7100 SPI controller Alban Bedel
     [not found]   ` <1429885164-28501-2-git-send-email-albeu-GANU6spQydw@public.gmane.org>
2015-04-24 17:37     ` Sergei Shtylyov
     [not found]       ` <553A7F62.80108-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2015-05-07 21:18         ` [PATCH] devicetree: Misc fix for the AR7100 SPI controller binding Alban Bedel
     [not found] ` <1429885164-28501-1-git-send-email-albeu-GANU6spQydw@public.gmane.org>
2015-04-24 14:19   ` [PATCH 2/4] spi: spi-ath79: Add device tree support Alban Bedel
2015-04-24 17:58   ` [PATCH 0/4] spi: spi-ath79: Devicetree support and misc fixes Mark Brown
2015-04-24 14:19 ` [PATCH 3/4] spi: spi-ath79: Use clk_prepare_enable and clk_disable_unprepare Alban Bedel
2015-04-24 14:19 ` Alban Bedel [this message]

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=1429885164-28501-5-git-send-email-albeu@free.fr \
    --to=albeu@free.fr \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=juhosg@openwrt.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=ralf@linux-mips.org \
    --cc=robh+dt@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).