Linux-Aspeed Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH V5 13/15] spi: spi-zynqmp-gqspi: Add stacked memories support in GQSPI driver
Date: Mon, 6 Mar 2023 22:51:07 +0530	[thread overview]
Message-ID: <20230306172109.595464-14-amit.kumar-mahapatra@amd.com> (raw)
In-Reply-To: <20230306172109.595464-1-amit.kumar-mahapatra@amd.com>

GQSPI supports two chip select CS0 & CS1. Update the driver to
assert/de-assert the appropriate chip select as per the bits set in
qspi->cs_index_mask.

Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
---
 drivers/spi/spi-zynqmp-gqspi.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-zynqmp-gqspi.c b/drivers/spi/spi-zynqmp-gqspi.c
index 319cdd5a0bdc..4759f704bf5c 100644
--- a/drivers/spi/spi-zynqmp-gqspi.c
+++ b/drivers/spi/spi-zynqmp-gqspi.c
@@ -156,6 +156,9 @@
 #define GQSPI_FREQ_100MHZ	100000000
 #define GQSPI_FREQ_150MHZ	150000000
 
+#define GQSPI_SELECT_LOWER_CS  BIT(0)
+#define GQSPI_SELECT_UPPER_CS  BIT(1)
+
 #define SPI_AUTOSUSPEND_TIMEOUT		3000
 enum mode_type {GQSPI_MODE_IO, GQSPI_MODE_DMA};
 
@@ -467,15 +470,17 @@ static void zynqmp_qspi_chipselect(struct spi_device *qspi, bool is_high)
 
 	genfifoentry |= GQSPI_GENFIFO_MODE_SPI;
 
+	if (qspi->cs_index_mask & GQSPI_SELECT_UPPER_CS) {
+		zynqmp_gqspi_selectslave(xqspi,
+					 GQSPI_SELECT_FLASH_CS_UPPER,
+					 GQSPI_SELECT_FLASH_BUS_LOWER);
+	} else if (qspi->cs_index_mask & GQSPI_SELECT_LOWER_CS) {
+		zynqmp_gqspi_selectslave(xqspi,
+					 GQSPI_SELECT_FLASH_CS_LOWER,
+					 GQSPI_SELECT_FLASH_BUS_LOWER);
+	}
+	genfifoentry |= xqspi->genfifobus;
 	if (!is_high) {
-		if (!spi_get_chipselect(qspi, 0)) {
-			xqspi->genfifobus = GQSPI_GENFIFO_BUS_LOWER;
-			xqspi->genfifocs = GQSPI_GENFIFO_CS_LOWER;
-		} else {
-			xqspi->genfifobus = GQSPI_GENFIFO_BUS_UPPER;
-			xqspi->genfifocs = GQSPI_GENFIFO_CS_UPPER;
-		}
-		genfifoentry |= xqspi->genfifobus;
 		genfifoentry |= xqspi->genfifocs;
 		genfifoentry |= GQSPI_GENFIFO_CS_SETUP;
 	} else {
-- 
2.25.1


  parent reply	other threads:[~2023-03-06 17:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-06 17:20 [PATCH V5 00/15] spi: Add support for stacked/parallel memories Amit Kumar Mahapatra
2023-03-06 17:20 ` [PATCH V5 01/15] spi: Replace all spi->chip_select and spi->cs_gpiod references with function call Amit Kumar Mahapatra
2023-03-06 17:32   ` Mark Brown
2023-03-06 21:27   ` Mark Brown
2023-03-06 17:20 ` [PATCH V5 02/15] net: " Amit Kumar Mahapatra
2023-03-06 17:20 ` [PATCH V5 03/15] iio: imu: " Amit Kumar Mahapatra
2023-03-06 17:20 ` [PATCH V5 04/15] mtd: devices: " Amit Kumar Mahapatra
2023-03-06 17:20 ` [PATCH V5 05/15] staging: " Amit Kumar Mahapatra
2023-03-06 17:21 ` [PATCH V5 06/15] platform/x86: serial-multi-instantiate: " Amit Kumar Mahapatra
2023-03-06 17:21 ` [PATCH V5 07/15] powerpc/83xx/mpc832x_rdb: Replace all spi->chip_select " Amit Kumar Mahapatra
2023-03-06 17:21 ` [PATCH V5 08/15] ALSA: hda: cs35l41: " Amit Kumar Mahapatra
2023-03-06 17:21 ` [PATCH V5 09/15] spi: Add stacked and parallel memories support in SPI core Amit Kumar Mahapatra
2023-03-06 20:00   ` Jonas Gorski
2023-03-07 11:09     ` Mahapatra, Amit Kumar
2023-03-06 17:21 ` [PATCH V5 10/15] mtd: spi-nor: Convert macros with inline functions Amit Kumar Mahapatra
2023-03-06 17:21 ` [PATCH V5 11/15] mtd: spi-nor: Add APIs to set/get nor->params Amit Kumar Mahapatra
2023-03-06 17:21 ` [PATCH V5 12/15] mtd: spi-nor: Add stacked memories support in spi-nor Amit Kumar Mahapatra
2023-03-06 17:21 ` Amit Kumar Mahapatra [this message]
2023-03-06 17:21 ` [PATCH V5 14/15] mtd: spi-nor: Add parallel " Amit Kumar Mahapatra
2023-03-06 17:21 ` [PATCH V5 15/15] spi: spi-zynqmp-gqspi: Add parallel memories support in GQSPI driver Amit Kumar Mahapatra
2023-03-13 16:49 ` (subset) [PATCH V5 00/15] spi: Add support for stacked/parallel memories 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=20230306172109.595464-14-amit.kumar-mahapatra@amd.com \
    --to=amit.kumar-mahapatra@amd.com \
    --cc=linux-aspeed@lists.ozlabs.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