linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: "Chris Brandt" <chris.brandt@renesas.com>,
	linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
	"Mark Brown" <broonie@kernel.org>,
	"Jan Kundrát" <jan.kundrat@cesnet.cz>
Subject: Applied "spi: rspi: Add support for GPIO chip selects" to the spi tree
Date: Wed, 08 Jan 2020 15:59:08 +0000	[thread overview]
Message-ID: <applied-20200102133822.29346-7-geert+renesas@glider.be> (raw)
In-Reply-To: <20200102133822.29346-7-geert+renesas@glider.be>

The patch

   spi: rspi: Add support for GPIO chip selects

has been applied to the spi tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.6

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

From 144d8f9781e60d89dfd614210d2cedbefbba8885 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert+renesas@glider.be>
Date: Thu, 2 Jan 2020 14:38:22 +0100
Subject: [PATCH] spi: rspi: Add support for GPIO chip selects

Add support for GPIO chip selects using GPIO descriptors.  As the RSPI
controller always drives a native chip select when performing a
transfer, at least one native chip select must be left unused.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20200102133822.29346-7-geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-rspi.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c
index 2f5a856a9319..85575d45901c 100644
--- a/drivers/spi/spi-rspi.c
+++ b/drivers/spi/spi-rspi.c
@@ -242,6 +242,7 @@ struct spi_ops {
 	u16 mode_bits;
 	u16 flags;
 	u16 fifo_size;
+	u8 num_hw_ss;
 };
 
 /*
@@ -934,7 +935,8 @@ static int rspi_prepare_message(struct spi_controller *ctlr,
 		rspi->spcmd |= SPCMD_CPHA;
 
 	/* Configure slave signal to assert */
-	rspi->spcmd |= SPCMD_SSLA(spi->chip_select);
+	rspi->spcmd |= SPCMD_SSLA(spi->cs_gpiod ? rspi->ctlr->unused_native_cs
+						: spi->chip_select);
 
 	/* CMOS output mode and MOSI signal from previous transfer */
 	rspi->sppcr = 0;
@@ -1123,6 +1125,7 @@ static const struct spi_ops rspi_ops = {
 	.mode_bits =		SPI_CPHA | SPI_CPOL | SPI_LOOP,
 	.flags =		SPI_CONTROLLER_MUST_TX,
 	.fifo_size =		8,
+	.num_hw_ss =		2,
 };
 
 static const struct spi_ops rspi_rz_ops = {
@@ -1131,6 +1134,7 @@ static const struct spi_ops rspi_rz_ops = {
 	.mode_bits =		SPI_CPHA | SPI_CPOL | SPI_LOOP,
 	.flags =		SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX,
 	.fifo_size =		8,	/* 8 for TX, 32 for RX */
+	.num_hw_ss =		1,
 };
 
 static const struct spi_ops qspi_ops = {
@@ -1141,6 +1145,7 @@ static const struct spi_ops qspi_ops = {
 				SPI_RX_DUAL | SPI_RX_QUAD,
 	.flags =		SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX,
 	.fifo_size =		32,
+	.num_hw_ss =		1,
 };
 
 #ifdef CONFIG_OF
@@ -1256,6 +1261,8 @@ static int rspi_probe(struct platform_device *pdev)
 	ctlr->mode_bits = ops->mode_bits;
 	ctlr->flags = ops->flags;
 	ctlr->dev.of_node = pdev->dev.of_node;
+	ctlr->use_gpio_descriptors = true;
+	ctlr->max_native_cs = rspi->ops->num_hw_ss;
 
 	ret = platform_get_irq_byname_optional(pdev, "rx");
 	if (ret < 0) {
-- 
2.20.1


      reply	other threads:[~2020-01-08 15:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02 13:38 [PATCH 0/6] spi: rspi: Add support for multiple native and GPIO chip selects Geert Uytterhoeven
2020-01-02 13:38 ` [PATCH 1/6] spi: Add generic support for unused native cs with cs-gpios Geert Uytterhoeven
2020-01-08 15:59   ` Applied "spi: Add generic support for unused native cs with cs-gpios" to the spi tree Mark Brown
2020-01-02 13:38 ` [PATCH 2/6] spi: sh-msiof: Convert to generic unused native cs handling Geert Uytterhoeven
2020-01-08 15:59   ` Applied "spi: sh-msiof: Convert to generic unused native cs handling." to the spi tree Mark Brown
2020-01-02 13:38 ` [PATCH 3/6] spi: rspi: Use dev_warn_once() instead of open-coding Geert Uytterhoeven
2020-01-08 15:59   ` Applied "spi: rspi: Use dev_warn_once() instead of open-coding" to the spi tree Mark Brown
2020-01-02 13:38 ` [PATCH 4/6] spi: rspi: Remove set_config_register() macro Geert Uytterhoeven
2020-01-08 15:59   ` Applied "spi: rspi: Remove set_config_register() macro" to the spi tree Mark Brown
2020-01-02 13:38 ` [PATCH 5/6] spi: rspi: Add support for multiple native chip selects Geert Uytterhoeven
2020-01-08 15:59   ` Applied "spi: rspi: Add support for multiple native chip selects" to the spi tree Mark Brown
2020-01-02 13:38 ` [PATCH 6/6] spi: rspi: Add support for GPIO chip selects Geert Uytterhoeven
2020-01-08 15:59   ` Mark Brown [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=applied-20200102133822.29346-7-geert+renesas@glider.be \
    --to=broonie@kernel.org \
    --cc=chris.brandt@renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=jan.kundrat@cesnet.cz \
    --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).