Skip to contentSkip to conversation

Add Quad SPI driver for StarFive JH7110 SoC

PATCH In review William Qiu 2 participants 4 messages Mar 2, 2023 – Mar 6, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add Quad SPI driver for StarFive JH7110 SoC

Hi,

This patchset adds initial rudimentary support for the StarFive Quad SPI controller driver. And this driver will be used in StarFive's VisionFive 2 board.The first patch constrain minItems/maxItems of resets for JH7110 QSPI and Patch 2 adds support for StarFive JH7110 QSPI.

The patch series is based on v6.2.

William Qiu (2):
dt-bindings: qspi: cdns,qspi-nor: constrain minItems/maxItems of
resets
spi: cadence-quadspi: Add support for StarFive JH7110 QSPI

 .../bindings/spi/cdns,qspi-nor.yaml           | 37 +++++++++++++++++--
 drivers/spi/Kconfig                           |  2 +-
 drivers/spi/spi-cadence-quadspi.c             | 21 ++++++++++-
 3 files changed, 54 insertions(+), 6 deletions(-)

--
2.34.1

#1 lore raw

PATCH 1/2 dt-bindings: qspi: cdns,qspi-nor: constrain minItems/maxItems of resets

The QSPI controller needs three reset items to work properly on JH7110 SoC, so there is need to change the maxItems's value to 3 and add minItems whose value is equal to 2. Other platforms do not have this constraint.

---
 .../bindings/spi/cdns,qspi-nor.yaml           | 37 +++++++++++++++++--
 1 file changed, 33 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml +33 -4
index 4707294d8f59..14821cb6db48 100644
@@ -19,6 +19,33 @@ allOf:
     then:
       required:
         - power-domains
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: starfive,jh7110-qspi
+    then:
+      properties:
+        resets:
+          minItems: 2
+          maxItems: 3
+
+        reset-names:
+          minItems: 2
+          maxItems: 3
+          items:
+            enum: [ qspi, qspi-ocp, rstc_ref ]
+
+    else:
+      properties:
+        resets:
+          maxItems: 2
+
+        reset-names:
+          minItems: 1
+          maxItems: 2
+          items:
+            enum: [ qspi, qspi-ocp ]
 
 properties:
   compatible:
@@ -30,6 +57,7 @@ properties:
               - intel,lgm-qspi
               - xlnx,versal-ospi-1.0
               - intel,socfpga-qspi
+              - starfive,jh7110-qspi
           - const: cdns,qspi-nor
       - const: cdns,qspi-nor
 
@@ -79,13 +107,14 @@ properties:
     maxItems: 1
 
   resets:
-    maxItems: 2
+    minItems: 2
+    maxItems: 3
 
   reset-names:
-    minItems: 1
-    maxItems: 2
+    minItems: 2
+    maxItems: 3
     items:
-      enum: [ qspi, qspi-ocp ]
+      enum: [ qspi, qspi-ocp, rstc_ref ]
 
 required:
   - compatible
Signature · 1 line
2.34.1
#2 lore raw

PATCH 2/2 spi: cadence-quadspi: Add support for StarFive JH7110 QSPI

In reply to William Qiu

Add QSPI reset operation in device probe and add RISCV support to QUAD SPI Kconfig.

---
 drivers/spi/Kconfig               |  2 +-
 drivers/spi/spi-cadence-quadspi.c | 21 ++++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
drivers/spi/Kconfig +1 -1
index 3b1c0878bb85..c64edea53af6 100644
@@ -230,7 +230,7 @@ config SPI_CADENCE
 
 config SPI_CADENCE_QUADSPI
 	tristate "Cadence Quad SPI controller"
-	depends on OF && (ARM || ARM64 || X86 || COMPILE_TEST)
+	depends on OF && (ARM || ARM64 || X86 || RISCV || COMPILE_TEST)
 	help
 	  Enable support for the Cadence Quad SPI Flash controller.
 
drivers/spi/spi-cadence-quadspi.c +20 -1
index 676313e1bdad..d9795e108ec5 100644
@@ -1583,7 +1583,7 @@ static int cqspi_setup_flash(struct cqspi_st *cqspi)
 static int cqspi_probe(struct platform_device *pdev)
 {
 	const struct cqspi_driver_platdata *ddata;
-	struct reset_control *rstc, *rstc_ocp;
+	struct reset_control *rstc, *rstc_ocp, *rstc_ref;
 	struct device *dev = &pdev->dev;
 	struct spi_master *master;
 	struct resource *res_ahb;
@@ -1673,6 +1673,17 @@ static int cqspi_probe(struct platform_device *pdev)
 		goto probe_reset_failed;
 	}
 
+	if (of_device_is_compatible(pdev->dev.of_node, "starfive,jh7110-qspi")) {
+		rstc_ref = devm_reset_control_get_optional_exclusive(dev, "rstc_ref");
+		if (IS_ERR(rstc_ref)) {
+			ret = PTR_ERR(rstc_ref);
+			dev_err(dev, "Cannot get QSPI REF reset.\n");
+			goto probe_reset_failed;
+		}
+		reset_control_assert(rstc_ref);
+		reset_control_deassert(rstc_ref);
+	}
+
 	reset_control_assert(rstc);
 	reset_control_deassert(rstc);
 
@@ -1825,6 +1836,10 @@ static const struct cqspi_driver_platdata versal_ospi = {
 	.get_dma_status = cqspi_get_versal_dma_status,
 };
 
+static const struct cqspi_driver_platdata jh7110_qspi = {
+	.quirks = CQSPI_DISABLE_DAC_MODE,
+};
+
 static const struct of_device_id cqspi_dt_ids[] = {
 	{
 		.compatible = "cdns,qspi-nor",
@@ -1850,6 +1865,10 @@ static const struct of_device_id cqspi_dt_ids[] = {
 		.compatible = "intel,socfpga-qspi",
 		.data = &socfpga_qspi,
 	},
+	{
+		.compatible = "starfive,jh7110-qspi",
+		.data = &jh7110_qspi,
+	},
 	{ /* end of table */ }
 };
 
Signature · 1 line
2.34.1
maintainer
#3 lore raw
In reply to William Qiu
Quoted 9 lines · William Qiu

This patchset adds initial rudimentary support for the StarFive Quad SPI controller driver. And this driver will be used in StarFive's VisionFive 2 board.The first patch constrain minItems/maxItems of resets for JH7110 QSPI and Patch 2 adds support for StarFive JH7110 QSPI.

The patch series is based on v6.2.

[...]

Applied to

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

Thanks!

[1/2] dt-bindings: qspi: cdns,qspi-nor: constrain minItems/maxItems of resets

      commit: 13f1033e07588b7d1151d22d7ee3ca8f16181de7
[2/2] spi: cadence-quadspi: Add support for StarFive JH7110 QSPI
      commit: 47fef94afeae2a125607b6b45145594713471320

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