All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brad Larson <brad@pensando.io>
To: linux-arm-kernel@lists.infradead.org
Cc: arnd@arndb.de, linus.walleij@linaro.org,
	bgolaszewski@baylibre.com, broonie@kernel.org,
	fancer.lancer@gmail.com, adrian.hunter@intel.com,
	ulf.hansson@linaro.org, olof@lixom.net, brad@pensando.io,
	dac2@pensando.io, linux-gpio@vger.kernel.org,
	linux-spi@vger.kernel.org, linux-mmc@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 08/11] spi: cadence-quadspi: Add compatible for Pensando Elba SoC
Date: Wed,  6 Apr 2022 16:36:45 -0700	[thread overview]
Message-ID: <20220406233648.21644-9-brad@pensando.io> (raw)
In-Reply-To: <20220406233648.21644-1-brad@pensando.io>

The Pensando Elba SoC has the Cadence QSPI controller integrated.

The quirk CQSPI_NEEDS_APB_AHB_HAZARD_WAR is added and if enabled
a dummy readback from the controller is performed to ensure
synchronization.

Signed-off-by: Brad Larson <brad@pensando.io>
---
Change from V3:
- Update due to spi-cadence-quadspi.c changes

 drivers/spi/spi-cadence-quadspi.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index b0c9f62ccefb..e7bcd9d8ba37 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -38,6 +38,7 @@
 #define CQSPI_DISABLE_DAC_MODE		BIT(1)
 #define CQSPI_SUPPORT_EXTERNAL_DMA	BIT(2)
 #define CQSPI_NO_SUPPORT_WR_COMPLETION	BIT(3)
+#define CQSPI_NEEDS_APB_AHB_HAZARD_WAR	BIT(4)
 
 /* Capabilities */
 #define CQSPI_SUPPORTS_OCTAL		BIT(0)
@@ -88,6 +89,7 @@ struct cqspi_st {
 	bool			use_dma_read;
 	u32			pd_dev_id;
 	bool			wr_completion;
+	bool			apb_ahb_hazard;
 };
 
 struct cqspi_driver_platdata {
@@ -1043,6 +1045,13 @@ static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata,
 	if (cqspi->wr_delay)
 		ndelay(cqspi->wr_delay);
 
+	/*
+	 * If a hazard exists between the APB and AHB interfaces, perform a
+	 * dummy readback from the controller to ensure synchronization.
+	 */
+	if (cqspi->apb_ahb_hazard)
+		(void)readl(reg_base + CQSPI_REG_INDIRECTWR);
+
 	while (remaining > 0) {
 		size_t write_words, mod_bytes;
 
@@ -1759,6 +1768,8 @@ static int cqspi_probe(struct platform_device *pdev)
 			cqspi->use_dma_read = true;
 		if (ddata->quirks & CQSPI_NO_SUPPORT_WR_COMPLETION)
 			cqspi->wr_completion = false;
+		if (ddata->quirks & CQSPI_NEEDS_APB_AHB_HAZARD_WAR)
+			cqspi->apb_ahb_hazard = true;
 
 		if (of_device_is_compatible(pdev->dev.of_node,
 					    "xlnx,versal-ospi-1.0"))
@@ -1882,6 +1893,10 @@ static const struct cqspi_driver_platdata versal_ospi = {
 	.get_dma_status = cqspi_get_versal_dma_status,
 };
 
+static const struct cqspi_driver_platdata pen_cdns_qspi = {
+	.quirks = CQSPI_NEEDS_APB_AHB_HAZARD_WAR | CQSPI_DISABLE_DAC_MODE,
+};
+
 static const struct of_device_id cqspi_dt_ids[] = {
 	{
 		.compatible = "cdns,qspi-nor",
@@ -1907,6 +1922,10 @@ static const struct of_device_id cqspi_dt_ids[] = {
 		.compatible = "intel,socfpga-qspi",
 		.data = (void *)&socfpga_qspi,
 	},
+	{
+		.compatible = "pensando,elba-qspi",
+		.data = &pen_cdns_qspi,
+	},
 	{ /* end of table */ }
 };
 
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Brad Larson <brad@pensando.io>
To: linux-arm-kernel@lists.infradead.org
Cc: arnd@arndb.de, linus.walleij@linaro.org,
	bgolaszewski@baylibre.com, broonie@kernel.org,
	fancer.lancer@gmail.com, adrian.hunter@intel.com,
	ulf.hansson@linaro.org, olof@lixom.net, brad@pensando.io,
	dac2@pensando.io, linux-gpio@vger.kernel.org,
	linux-spi@vger.kernel.org, linux-mmc@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 08/11] spi: cadence-quadspi: Add compatible for Pensando Elba SoC
Date: Wed,  6 Apr 2022 16:36:45 -0700	[thread overview]
Message-ID: <20220406233648.21644-9-brad@pensando.io> (raw)
In-Reply-To: <20220406233648.21644-1-brad@pensando.io>

The Pensando Elba SoC has the Cadence QSPI controller integrated.

The quirk CQSPI_NEEDS_APB_AHB_HAZARD_WAR is added and if enabled
a dummy readback from the controller is performed to ensure
synchronization.

Signed-off-by: Brad Larson <brad@pensando.io>
---
Change from V3:
- Update due to spi-cadence-quadspi.c changes

 drivers/spi/spi-cadence-quadspi.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index b0c9f62ccefb..e7bcd9d8ba37 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -38,6 +38,7 @@
 #define CQSPI_DISABLE_DAC_MODE		BIT(1)
 #define CQSPI_SUPPORT_EXTERNAL_DMA	BIT(2)
 #define CQSPI_NO_SUPPORT_WR_COMPLETION	BIT(3)
+#define CQSPI_NEEDS_APB_AHB_HAZARD_WAR	BIT(4)
 
 /* Capabilities */
 #define CQSPI_SUPPORTS_OCTAL		BIT(0)
@@ -88,6 +89,7 @@ struct cqspi_st {
 	bool			use_dma_read;
 	u32			pd_dev_id;
 	bool			wr_completion;
+	bool			apb_ahb_hazard;
 };
 
 struct cqspi_driver_platdata {
@@ -1043,6 +1045,13 @@ static int cqspi_indirect_write_execute(struct cqspi_flash_pdata *f_pdata,
 	if (cqspi->wr_delay)
 		ndelay(cqspi->wr_delay);
 
+	/*
+	 * If a hazard exists between the APB and AHB interfaces, perform a
+	 * dummy readback from the controller to ensure synchronization.
+	 */
+	if (cqspi->apb_ahb_hazard)
+		(void)readl(reg_base + CQSPI_REG_INDIRECTWR);
+
 	while (remaining > 0) {
 		size_t write_words, mod_bytes;
 
@@ -1759,6 +1768,8 @@ static int cqspi_probe(struct platform_device *pdev)
 			cqspi->use_dma_read = true;
 		if (ddata->quirks & CQSPI_NO_SUPPORT_WR_COMPLETION)
 			cqspi->wr_completion = false;
+		if (ddata->quirks & CQSPI_NEEDS_APB_AHB_HAZARD_WAR)
+			cqspi->apb_ahb_hazard = true;
 
 		if (of_device_is_compatible(pdev->dev.of_node,
 					    "xlnx,versal-ospi-1.0"))
@@ -1882,6 +1893,10 @@ static const struct cqspi_driver_platdata versal_ospi = {
 	.get_dma_status = cqspi_get_versal_dma_status,
 };
 
+static const struct cqspi_driver_platdata pen_cdns_qspi = {
+	.quirks = CQSPI_NEEDS_APB_AHB_HAZARD_WAR | CQSPI_DISABLE_DAC_MODE,
+};
+
 static const struct of_device_id cqspi_dt_ids[] = {
 	{
 		.compatible = "cdns,qspi-nor",
@@ -1907,6 +1922,10 @@ static const struct of_device_id cqspi_dt_ids[] = {
 		.compatible = "intel,socfpga-qspi",
 		.data = (void *)&socfpga_qspi,
 	},
+	{
+		.compatible = "pensando,elba-qspi",
+		.data = &pen_cdns_qspi,
+	},
 	{ /* end of table */ }
 };
 
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-04-06 23:37 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06 23:36 [PATCH 00/11] Support Pensando Elba SoC Brad Larson
2022-04-06 23:36 ` Brad Larson
2022-04-06 23:36 ` [PATCH 01/11] dt-bindings: arm: add Pensando boards Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-07 18:45   ` Krzysztof Kozlowski
2022-04-07 18:45     ` Krzysztof Kozlowski
2022-04-09  2:19     ` Brad Larson
2022-04-09  2:19       ` Brad Larson
2022-04-09 10:39       ` Krzysztof Kozlowski
2022-04-09 10:39         ` Krzysztof Kozlowski
2022-04-11 21:24         ` Serge Semin
2022-04-11 21:24           ` Serge Semin
2022-05-25 16:31         ` Brad Larson
2022-05-25 16:31           ` Brad Larson
2022-04-07 18:54   ` Krzysztof Kozlowski
2022-04-07 18:54     ` Krzysztof Kozlowski
2022-04-09  2:04     ` Brad Larson
2022-04-09  2:04       ` Brad Larson
2022-04-06 23:36 ` [PATCH 02/11] dt-bindings: Add vendor prefix for Pensando Systems Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-07 18:43   ` Krzysztof Kozlowski
2022-04-07 18:43     ` Krzysztof Kozlowski
2022-04-09  2:00     ` Brad Larson
2022-04-09  2:00       ` Brad Larson
2022-04-06 23:36 ` [PATCH 03/11] dt-bindings: mmc: Add Pensando Elba SoC binding Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-07  6:30   ` Arnd Bergmann
2022-04-07  6:30     ` Arnd Bergmann
2022-05-25 15:46     ` Brad Larson
2022-05-25 15:46       ` Brad Larson
2022-04-07 18:57   ` Krzysztof Kozlowski
2022-04-07 18:57     ` Krzysztof Kozlowski
2022-05-25 15:49     ` Brad Larson
2022-05-25 15:49       ` Brad Larson
2022-04-06 23:36 ` [PATCH 04/11] dt-bindings: spi: Add compatible for Pensando Elba SoC Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-07 18:59   ` Krzysztof Kozlowski
2022-04-07 18:59     ` Krzysztof Kozlowski
2022-05-25 16:58     ` Brad Larson
2022-05-25 16:58       ` Brad Larson
2022-04-12 11:37   ` Serge Semin
2022-04-12 11:37     ` Serge Semin
2022-05-25 17:03     ` Brad Larson
2022-05-25 17:03       ` Brad Larson
2022-04-06 23:36 ` [PATCH 05/11] dt-bindings: spi: dw: Add Pensando Elba SoC SPI Controller bindings Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-07 18:52   ` Krzysztof Kozlowski
2022-04-07 18:52     ` Krzysztof Kozlowski
2022-04-11 21:17     ` Serge Semin
2022-04-11 21:17       ` Serge Semin
2022-05-26  0:27     ` Brad Larson
2022-05-26  0:27       ` Brad Larson
2022-04-12 11:29   ` Serge Semin
2022-04-12 11:29     ` Serge Semin
2022-04-06 23:36 ` [PATCH 06/11] MAINTAINERS: Add entry for PENSANDO Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-06 23:36 ` [PATCH 07/11] arm64: Add config for Pensando SoC platforms Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-06 23:36 ` Brad Larson [this message]
2022-04-06 23:36   ` [PATCH 08/11] spi: cadence-quadspi: Add compatible for Pensando Elba SoC Brad Larson
2022-04-06 23:36 ` [PATCH 09/11] mmc: sdhci-cadence: Add Pensando Elba SoC support Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-07  6:45   ` Arnd Bergmann
2022-04-07  6:45     ` Arnd Bergmann
2022-04-07  7:13     ` Adrian Hunter
2022-04-07  7:13       ` Adrian Hunter
2022-04-07 17:06       ` Brad Larson
2022-04-07 17:06         ` Brad Larson
2022-04-07 20:38         ` Arnd Bergmann
2022-04-07 20:38           ` Arnd Bergmann
2022-05-25 16:10           ` Brad Larson
2022-05-25 16:10             ` Brad Larson
2022-04-06 23:36 ` [PATCH 10/11] spi: dw: Add support for Pensando Elba SoC Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-12 11:06   ` Serge Semin
2022-04-12 11:06     ` Serge Semin
2022-05-25 21:54     ` Brad Larson
2022-05-25 21:54       ` Brad Larson
2022-04-06 23:36 ` [PATCH 11/11] arm64: dts: Add Pensando Elba SoC support Brad Larson
2022-04-06 23:36   ` Brad Larson
2022-04-07  7:57   ` Marc Zyngier
2022-04-07  7:57     ` Marc Zyngier
2022-04-09  2:38     ` Brad Larson
2022-04-09  2:38       ` Brad Larson
2022-04-09  9:18       ` Marc Zyngier
2022-04-09  9:18         ` Marc Zyngier
2022-05-25 17:28         ` Brad Larson
2022-05-25 17:28           ` Brad Larson
2022-04-07 19:06   ` Krzysztof Kozlowski
2022-04-07 19:06     ` Krzysztof Kozlowski
2022-05-26  0:19     ` Brad Larson
2022-05-26  0:19       ` Brad Larson
2022-05-26  6:53       ` Krzysztof Kozlowski
2022-05-26  6:53         ` Krzysztof Kozlowski
2022-04-07 20:58   ` Krzysztof Kozlowski
2022-04-07 20:58     ` Krzysztof Kozlowski
2022-04-12 11:22   ` Serge Semin
2022-04-12 11:22     ` Serge Semin
2022-05-25 20:06     ` Brad Larson
2022-05-25 20:06       ` Brad Larson

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=20220406233648.21644-9-brad@pensando.io \
    --to=brad@pensando.io \
    --cc=adrian.hunter@intel.com \
    --cc=arnd@arndb.de \
    --cc=bgolaszewski@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=dac2@pensando.io \
    --cc=devicetree@vger.kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=ulf.hansson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.