Skip to contentSkip to conversation

spi: cadence-quadspi: Add support for the Cadence QSPI controller

PATCH Superseded Ramuthevar,Vadivel MuruganX 5 participants 13 messages Feb 27, 2020 – Feb 28, 2020

Subsystems (4)

v11 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v11 cover spi: cadence-quadspi: Add support for the Cadence QSPI controller

Add support for the Cadence QSPI controller. This controller is present in the Intel Lightning Mountain(LGM) SoCs, Altera and TI SoCs. This driver has been tested on the Intel LGM SoCs.

This driver does not support generic SPI and also the implementation only supports spi-mem interface to replace the existing driver in mtd/spi-nor/cadence-quadspi.c, the existing driver only support SPI-NOR flash memory.

Thanks Mark Brown, Vignesh and Rob for the review, suggestion to optimize the patch. Tested with mx25u12835f on LGM platform.

changes from v10
-- Rob's review comments update in dt_schema yaml. -- add valid contraints constraints.

changes from v9:
-- Mark's review comments address
-- add check to shared interrupt handler
-- add check decoder if present
-- add error check for quirks capability data
-- remove the existing cadence_quadspi.c from drivers/mtd/spi-nor path -- remove CONFIG macro from Kconfig in the above path
-- remove cadence_quadspi.o build option from Makefile in the above path

changes from v8:
-- remove the depends MTD macro
-- comment into C++ style
-- remove spaces and tabs where not applicable.
-- align the macro string as same as existing one. -- replace QUAD to op->data.buswidth variable.
-- add CQSPI_NEEDS_ADDR_SWAP instead of soc_selection variable

changes from v7:
-- remove addr_buf kept like as original
-- drop bus-num, chipselect variable
-- add soc_selection varible to differetiate the features -- replace dev->ddev in dma function
-- add seperate function to handle the 24bit slave device address
translation for lgm soc
-- correct sentence seems incomplete in Kconfig
-- add cqspi->soc_selection check to keep the original TI platform
working code.

changes from v6:
-- Add the Signed-off-by Vignesh in commit message
-- bus_num, num_chipselect added to avoid the garbage bus number
during the probe and spi_register.
-- master mode bits updated
-- address sequence is different from TI and Intel SoC Ip handling
so modified as per Intel and differentiating by use_dac_mode variable.
-- dummy cycles also different b/w two platforms, so keeping separate check -- checkpatch errors which are intentional left as is for better readability

changes from v5:
-- kbuild test robot warnings fixed
-- Add Reported-By: Dan Carpenter <[email protected]>

changes from v4:
-- kbuild test robot warnings fixed
-- Add Reborted-by: tag

changes from v3:
spi-cadence-quadspi.c
-- static to all functions wrt to local to the file.
-- Prefix cqspi_ and make the function static
-- cmd_ops, data_ops and dummy_ops dropped
-- addr_ops kept since it is required for address calculation.
-- devm_ used for supported functions , removed legacy API's
-- removed "indirect" name from functions
-- replaced by master->mode_bits = SPI_RX_QUAD | SPI_TX_DUAL | SPI_RX_DUAL | SPI_RX_OCTAL;
as per Vignesh susggestion
-- removed free functions since devm_ handles automatically.
-- dropped all unused Macros

YAML file update:
-- cadence,qspi.yaml file name replace by cdns,qspi-nor.yaml
-- compatible string updated as per Vignesh suggestion
-- for single entry, removed descriptions
-- removed optional parameters
Build Result:
linux$ make DT_SCHEMA_FILES=Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml dt_binding_check

    CHKDT   Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
    SCHEMA  Documentation/devicetree/bindings/processed-schema.yaml
    DTC     Documentation/devicetree/bindings/spi/cdns,qspi-nor.example.dt.yaml
    CHECK   Documentation/devicetree/bindings/spi/cdns,qspi-nor.example.dt.yaml

Ramuthevar Vadivel Murugan (2):
dt-bindings: spi: Add schema for Cadence QSPI Controller driver
spi: cadence-quadspi: Add support for the Cadence QSPI controller

 .../devicetree/bindings/mtd/cadence-quadspi.txt    |  67 ---
 .../devicetree/bindings/spi/cdns,qspi-nor.yaml     | 142 +++++
 drivers/mtd/spi-nor/Kconfig                        |  11 -
 drivers/mtd/spi-nor/Makefile                       |   1 -
 drivers/spi/Kconfig                                |  10 +
 drivers/spi/Makefile                               |   1 +
 .../spi-cadence-quadspi.c}                         | 641 ++++++++++-----------
 7 files changed, 456 insertions(+), 417 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mtd/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
 rename drivers/{mtd/spi-nor/cadence-quadspi.c => spi/spi-cadence-quadspi.c} (73%)
Signature · 1 line
2.11.0
#1 lore raw

PATCH v11 1/2 dt-bindings: spi: Add schema for Cadence QSPI Controller driver

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add dt-bindings documentation for Cadence-QSPI controller to support spi based flash memories.

---
 .../devicetree/bindings/mtd/cadence-quadspi.txt    |  67 ----------
 .../devicetree/bindings/spi/cdns,qspi-nor.yaml     | 142 +++++++++++++++++++++
 2 files changed, 142 insertions(+), 67 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mtd/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
Documentation/devicetree/bindings/mtd/cadence-quadspi.txt deleted +0 -67
deleted file mode 100644
index 945be7d5b236..000000000000
@@ -1,67 +0,0 @@
-* Cadence Quad SPI controller
-
-Required properties:
-- compatible : should be one of the following:
-	Generic default - "cdns,qspi-nor".
-	For TI 66AK2G SoC - "ti,k2g-qspi", "cdns,qspi-nor".
-	For TI AM654 SoC  - "ti,am654-ospi", "cdns,qspi-nor".
-- reg : Contains two entries, each of which is a tuple consisting of a
-	physical address and length. The first entry is the address and
-	length of the controller register set. The second entry is the
-	address and length of the QSPI Controller data area.
-- interrupts : Unit interrupt specifier for the controller interrupt.
-- clocks : phandle to the Quad SPI clock.
-- cdns,fifo-depth : Size of the data FIFO in words.
-- cdns,fifo-width : Bus width of the data FIFO in bytes.
-- cdns,trigger-address : 32-bit indirect AHB trigger address.
-
-Optional properties:
-- cdns,is-decoded-cs : Flag to indicate whether decoder is used or not.
-- cdns,rclk-en : Flag to indicate that QSPI return clock is used to latch
-  the read data rather than the QSPI clock. Make sure that QSPI return
-  clock is populated on the board before using this property.
-
-Optional subnodes:
-Subnodes of the Cadence Quad SPI controller are spi slave nodes with additional
-custom properties:
-- cdns,read-delay : Delay for read capture logic, in clock cycles
-- cdns,tshsl-ns : Delay in nanoseconds for the length that the master
-                  mode chip select outputs are de-asserted between
-		  transactions.
-- cdns,tsd2d-ns : Delay in nanoseconds between one chip select being
-                  de-activated and the activation of another.
-- cdns,tchsh-ns : Delay in nanoseconds between last bit of current
-                  transaction and deasserting the device chip select
-		  (qspi_n_ss_out).
-- cdns,tslch-ns : Delay in nanoseconds between setting qspi_n_ss_out low
-                  and first bit transfer.
-- resets	: Must contain an entry for each entry in reset-names.
-		  See ../reset/reset.txt for details.
-- reset-names	: Must include either "qspi" and/or "qspi-ocp".
-
-Example:
-
-	qspi: spi@ff705000 {
-		compatible = "cdns,qspi-nor";
-		#address-cells = <1>;
-		#size-cells = <0>;
-		reg = <0xff705000 0x1000>,
-		      <0xffa00000 0x1000>;
-		interrupts = <0 151 4>;
-		clocks = <&qspi_clk>;
-		cdns,is-decoded-cs;
-		cdns,fifo-depth = <128>;
-		cdns,fifo-width = <4>;
-		cdns,trigger-address = <0x00000000>;
-		resets = <&rst QSPI_RESET>, <&rst QSPI_OCP_RESET>;
-		reset-names = "qspi", "qspi-ocp";
-
-		flash0: n25q00@0 {
-			...
-			cdns,read-delay = <4>;
-			cdns,tshsl-ns = <50>;
-			cdns,tsd2d-ns = <50>;
-			cdns,tchsh-ns = <4>;
-			cdns,tslch-ns = <4>;
-		};
-	};
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +142 -0

142 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

Re: [PATCH v11 1/2] dt-bindings: spi: Add schema for Cadence QSPI Controller driver

Quoted 5 lines · Ramuthevar,Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add dt-bindings documentation for Cadence-QSPI controller to support spi based flash memories.

You need to run 'make dt_binding_check' because this doesn't pass.

Quoted 31 lines
---
 .../devicetree/bindings/mtd/cadence-quadspi.txt    |  67 ----------
 .../devicetree/bindings/spi/cdns,qspi-nor.yaml     | 142 +++++++++++++++++++++
 2 files changed, 142 insertions(+), 67 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mtd/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +15 -0
new file mode 100644
index 000000000000..3ad2850c412e
@@ -0,0 +1,142 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/spi/cdns,qspi-nor.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Cadence QSPI Flash Controller support
+
+maintainers:
+  - Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>
+
+allOf:
+  - $ref: "spi-controller.yaml#"
+
+description: |

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +9 -0
+  Binding Documentation for Cadence QSPI controller,This controller is
+  present in the Intel LGM, Altera SoCFPGA and TI SoCs and this driver
+  has been tested On Intel's LGM SoC.
+
 
+  - compatible : should be one of the following:
+        Generic default - "cdns,qspi-nor".
+        For TI 66AK2G SoC - "ti,k2g-qspi", "cdns,qspi-nor".
+        For TI AM654 SoC  - "ti,am654-ospi", "cdns,qspi-nor".
+        For Intel LGM SoC - "intel,lgm-qspi", "cdns,qspi-nor".

The schema below says all this, so drop this part.

Quoted 8 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +8 -0
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+        - enum:
+           - ti,k2g-qspi
+        - const: cdns,qspi-nor

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 42

Quoted 10 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +10 -0
+
+      - items:
+        - enum:
+           - ti,am654-ospi
+        - const: cdns,qspi-nor
+
+      - items:
+        - enum:
+           - intel,lgm-qspi
+        - const: cdns,qspi-nor

These 3 items can be 1 entry (combine the enums).

Quoted 7 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +7 -0
+
+      - items:
+        - const: cdns,qspi-nor
+
+  reg:
+    maxItems: 2
+

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 59

Quoted 10 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +10 -0
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  cdns,fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      128 or 256 bytes size of the data FIFO in words.

Sounds like constraints. Make them a schema.

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 64

Quoted 5 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +5 -0
+
+  cdns,fifo-width:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      4 byte bus width of the data FIFO in bytes.

That's not very clear. It should be schema constraints anyways:

enum: [ 4, 8, 12, 16, ...??? ]

or:

multipleOf: 4
minimum: 4
maximum: ?

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 72

Quoted 8 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +8 -0
+
+  cdns,trigger-address:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      32-bit indirect AHB trigger address.
+
+  cdns,rclk-en:
+    $ref: /schemas/types.yaml#/definitions/uint32

Wrong type if this is a 'flag' aka boolean.

Quoted 5 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +5 -0
+    description: |
+      Flag to indicate that QSPI return clock is used to latch the read data
+      rather than the QSPI clock. Make sure that QSPI return clock is populated
+      on the board before using this property.
+

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 87

Quoted 10 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +10 -0
+# subnode's properties
+patternProperties:
+  "^.*@[0-9a-fA-F]+$":
+    type: object
+    description:
+      flash device uses the subnodes below defined properties.
+
+  cdns,read-delay:
+    description:
+      Delay in 4 microseconds, read capture logic, in clock cycles.

Huh? Is it in time or clocks?

No unit suffix here, so this needs a type ref. That's what 'make dt_binding_check' fails on.

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 92

Quoted 5 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +5 -0
+
+  cdns,tshsl-ns:
+    description: |
+      Delay in 50 nanoseconds, for the length that the master mode chip select
+      outputs are de-asserted between transactions.

multipleOf: 50

And so on for the rest.

Quoted 53 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +50 -1
+
+  cdns,tsd2d-ns:
+    description: |
+      Delay in 50 nanoseconds, between one chip select being de-activated
+      and the activation of another.
+
+  cdns,tchsh-ns:
+    description: |
+      Delay in 4 nanoseconds, between last bit of current transaction and
+      deasserting the device chip select (qspi_n_ss_out).
+
+  cdns,tslch-ns:
+    description: |
+      Delay in 4 nanoseconds, between setting qspi_n_ss_out low and
+      first bit transfer.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - cdns,fifo-depth
+  - cdns,fifo-width
+  - cdns,trigger-address
+
+examples:
+  - |
+    qspi: spi@ff705000 {
+          compatible = "cdns,qspi-nor";
+          #address-cells = <1>;
+          #size-cells = <0>;
+          reg = <0xff705000 0x1000>,
+                <0xffa00000 0x1000>;
+          interrupts = <0 151 4>;
+          clocks = <&qspi_clk>;
+          cdns,fifo-depth = <128>;
+          cdns,fifo-width = <4>;
+          cdns,trigger-address = <0x00000000>;
+
+          flash0: n25q00@0 {
+              compatible = "jedec,spi-nor";
+              reg = <0x0>;
+              cdns,read-delay = <4>;
+              cdns,tshsl-ns = <50>;
+              cdns,tsd2d-ns = <50>;
+              cdns,tchsh-ns = <4>;
+              cdns,tslch-ns = <4>;
+          };
+    };
+
--

2.11.0

#3 lore raw

Re: [PATCH v11 1/2] dt-bindings: spi: Add schema for Cadence QSPI Controller driver

Hi Rob,

     Thank you so much for the review comments...

Quoted 7 lines · Rob Herring
Quoted 4 lines · Ramuthevar,Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add dt-bindings documentation for Cadence-QSPI controller to support spi based flash memories.

You need to run 'make dt_binding_check' because this doesn't pass.

Sure,  run and fix it.

Quoted 51 lines
Quoted 28 lines
---
  .../devicetree/bindings/mtd/cadence-quadspi.txt    |  67 ----------
  .../devicetree/bindings/spi/cdns,qspi-nor.yaml     | 142 +++++++++++++++++++++
  2 files changed, 142 insertions(+), 67 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/mtd/cadence-quadspi.txt create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +14 -0
new file mode 100644
index 000000000000..3ad2850c412e
@@ -0,0 +1,142 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/spi/cdns,qspi-nor.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Cadence QSPI Flash Controller support
+
+maintainers:
+  - Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>
+
+allOf:
+  - $ref: "spi-controller.yaml#"
+

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +10 -0
+description: |
+  Binding Documentation for Cadence QSPI controller,This controller is
+  present in the Intel LGM, Altera SoCFPGA and TI SoCs and this driver
+  has been tested On Intel's LGM SoC.
+
+  - compatible : should be one of the following:
+        Generic default - "cdns,qspi-nor".
+        For TI 66AK2G SoC - "ti,k2g-qspi", "cdns,qspi-nor".
+        For TI AM654 SoC  - "ti,am654-ospi", "cdns,qspi-nor".
+        For Intel LGM SoC - "intel,lgm-qspi", "cdns,qspi-nor".

The schema below says all this, so drop this part.

Quoted 11 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +11 -0
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+        - enum:
+           - ti,k2g-qspi
+        - const: cdns,qspi-nor
+
+      - items:
+        - enum:
Quoted 8 lines

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 42

Quoted 7 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +7 -0
+           - ti,am654-ospi
+        - const: cdns,qspi-nor
+
+      - items:
+        - enum:
+           - intel,lgm-qspi
+        - const: cdns,qspi-nor

These 3 items can be 1 entry (combine the enums).

Noted, will fix it.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +10 -0
+
+      - items:
+        - const: cdns,qspi-nor
+
+  reg:
+    maxItems: 2
+
+  interrupts:
+    maxItems: 1
+
Quoted 8 lines

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 59

Quoted 7 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +7 -0
+  clocks:
+    maxItems: 1
+
+  cdns,fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      128 or 256 bytes size of the data FIFO in words.

Sounds like constraints. Make them a schema.

Sure, will make as schema.

Quoted 7 lines

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 64

Quoted 5 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +5 -0
+
+  cdns,fifo-width:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      4 byte bus width of the data FIFO in bytes.

That's not very clear. It should be schema constraints anyways:

Quoted 7 lines

enum: [ 4, 8, 12, 16, ...??? ]

or:

multipleOf: 4
minimum: 4
maximum: ?

Noted,  will fix it.

Quoted 9 lines

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 72

Quoted 8 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +8 -0
+
+  cdns,trigger-address:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      32-bit indirect AHB trigger address.
+
+  cdns,rclk-en:
+    $ref: /schemas/types.yaml#/definitions/uint32

Wrong type if this is a 'flag' aka boolean.

Yes , you are correct.

Quoted 17 lines
Quoted 5 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +5 -0
+    description: |
+      Flag to indicate that QSPI return clock is used to latch the read data
+      rather than the QSPI clock. Make sure that QSPI return clock is populated
+      on the board before using this property.
+

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 87

Quoted 10 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +10 -0
+# subnode's properties
+patternProperties:
+  "^.*@[0-9a-fA-F]+$":
+    type: object
+    description:
+      flash device uses the subnodes below defined properties.
+
+  cdns,read-delay:
+    description:
+      Delay in 4 microseconds, read capture logic, in clock cycles.

Huh? Is it in time or clocks?

Quoted 2 lines

No unit suffix here, so this needs a type ref. That's what 'make dt_binding_check' fails on.

it's clock cycles to adjustable delay,  read data delay between the Flash Device data outputs and the controller data inputs

Quoted 8 lines

Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml line 92

Quoted 5 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +5 -0
+
+  cdns,tshsl-ns:
+    description: |
+      Delay in 50 nanoseconds, for the length that the master mode chip select
+      outputs are de-asserted between transactions.

multipleOf: 50

And so on for the rest.

Okay , Noted.

Regards
Vadivel

Quoted 53 lines
Quoted 53 lines
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +50 -1
+
+  cdns,tsd2d-ns:
+    description: |
+      Delay in 50 nanoseconds, between one chip select being de-activated
+      and the activation of another.
+
+  cdns,tchsh-ns:
+    description: |
+      Delay in 4 nanoseconds, between last bit of current transaction and
+      deasserting the device chip select (qspi_n_ss_out).
+
+  cdns,tslch-ns:
+    description: |
+      Delay in 4 nanoseconds, between setting qspi_n_ss_out low and
+      first bit transfer.
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - cdns,fifo-depth
+  - cdns,fifo-width
+  - cdns,trigger-address
+
+examples:
+  - |
+    qspi: spi@ff705000 {
+          compatible = "cdns,qspi-nor";
+          #address-cells = <1>;
+          #size-cells = <0>;
+          reg = <0xff705000 0x1000>,
+                <0xffa00000 0x1000>;
+          interrupts = <0 151 4>;
+          clocks = <&qspi_clk>;
+          cdns,fifo-depth = <128>;
+          cdns,fifo-width = <4>;
+          cdns,trigger-address = <0x00000000>;
+
+          flash0: n25q00@0 {
+              compatible = "jedec,spi-nor";
+              reg = <0x0>;
+              cdns,read-delay = <4>;
+              cdns,tshsl-ns = <50>;
+              cdns,tsd2d-ns = <50>;
+              cdns,tchsh-ns = <4>;
+              cdns,tslch-ns = <4>;
+          };
+    };
+
--

2.11.0

maintainer
#4 lore raw

Re: [PATCH v11 1/2] dt-bindings: spi: Add schema for Cadence QSPI Controller driver

In reply to Ramuthevar,Vadivel MuruganX
Quoted 5 lines · Ramuthevar,Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add dt-bindings documentation for Cadence-QSPI controller to support spi based flash memories.

Quoted 8 lines
---
 .../devicetree/bindings/mtd/cadence-quadspi.txt    |  67 ----------
 .../devicetree/bindings/spi/cdns,qspi-nor.yaml     | 142 +++++++++++++++++++++
 2 files changed, 142 insertions(+), 67 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/mtd/cadence-quadspi.txt
 create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml

My bot found errors running 'make dt_binding_check' on your patch:

warning: no schema found in file: Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml: ignoring, error in schema: patternProperties: cdns,read-delay Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml: patternProperties:cdns,read-delay: {'description': 'Delay in 4 microseconds, read capture logic, in clock cycles.'} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml: patternProperties:cdns,read-delay: 'not' is a required property

Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/spi/cdns,qspi-nor.example.dts' failed make[1]: *** [Documentation/devicetree/bindings/spi/cdns,qspi-nor.example.dts] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1245559
Please check and re-submit.

#5 lore raw

Re: [PATCH v11 1/2] dt-bindings: spi: Add schema for Cadence QSPI Controller driver

Hi Rob,

Quoted 14 lines · Rob Herring
Quoted 5 lines · Ramuthevar,Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <[email protected]>

Add dt-bindings documentation for Cadence-QSPI controller to support spi based flash memories.

Quoted 8 lines
---
  .../devicetree/bindings/mtd/cadence-quadspi.txt    |  67 ----------
  .../devicetree/bindings/spi/cdns,qspi-nor.yaml     | 142 +++++++++++++++++++++
  2 files changed, 142 insertions(+), 67 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/mtd/cadence-quadspi.txt create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml

Quoted 1 line

My bot found errors running 'make dt_binding_check' on your patch:

Thanks!,  Sorry for the trouble , next time will run and fix it up.

Regards
Vadivel

Quoted 14 lines

warning: no schema found in file: Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml: ignoring, error in schema: patternProperties: cdns,read-delay Documentation/devicetree/bindings/display/simple-framebuffer.example.dts:21.16-37.11: Warning (chosen_node_is_root): /example-0/chosen: chosen node must be at root node /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml: patternProperties:cdns,read-delay: {'description': 'Delay in 4 microseconds, read capture logic, in clock cycles.'} is not valid under any of the given schemas (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml: patternProperties:cdns,read-delay: 'not' is a required property

Documentation/devicetree/bindings/Makefile:12: recipe for target 'Documentation/devicetree/bindings/spi/cdns,qspi-nor.example.dts' failed make[1]: *** [Documentation/devicetree/bindings/spi/cdns,qspi-nor.example.dts] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

See https://patchwork.ozlabs.org/patch/1245559
Please check and re-submit.

#6 lore raw

PATCH v11 2/2 spi: cadence-quadspi: Add support for the Cadence QSPI controller

In reply to Ramuthevar,Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add support for the Cadence QSPI controller. This controller is present in the Intel Lightning Mountain(LGM) SoCs, Altera and TI SoCs. This driver has been tested on the Intel LGM SoCs.

This driver does not support generic SPI and also the implementation only supports spi-mem interface to replace the existing driver in mtd/spi-nor/cadence-quadspi.c, the existing driver only support SPI-NOR flash memory.

---
 drivers/mtd/spi-nor/Kconfig                        |  11 -
 drivers/mtd/spi-nor/Makefile                       |   1 -
 drivers/spi/Kconfig                                |  10 +
 drivers/spi/Makefile                               |   1 +
 .../spi-cadence-quadspi.c}                         | 641 ++++++++++-----------
 5 files changed, 314 insertions(+), 350 deletions(-)
 rename drivers/{mtd/spi-nor/cadence-quadspi.c => spi/spi-cadence-quadspi.c} (73%)
drivers/mtd/spi-nor/Kconfig +0 -11
index c1eda67d1ad2..de1c82c8137c 100644
@@ -34,17 +34,6 @@ config SPI_ASPEED_SMC
 	  and support for the SPI flash memory controller (SPI) for
 	  the host firmware. The implementation only supports SPI NOR.
 
-config SPI_CADENCE_QUADSPI
-	tristate "Cadence Quad SPI controller"
-	depends on OF && (ARM || ARM64 || COMPILE_TEST)
-	help
-	  Enable support for the Cadence Quad SPI Flash controller.
-
-	  Cadence QSPI is a specialized controller for connecting an SPI
-	  Flash over 1/2/4-bit wide bus. Enable this option if you have a
-	  device with a Cadence QSPI controller and want to access the
-	  Flash as an MTD device.
-
 config SPI_HISI_SFC
 	tristate "Hisilicon FMC SPI-NOR Flash Controller(SFC)"
 	depends on ARCH_HISI || COMPILE_TEST
drivers/mtd/spi-nor/Makefile +0 -1
index 9c5ed03cdc19..747e4386273d 100644
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_MTD_SPI_NOR)	+= spi-nor.o
 obj-$(CONFIG_SPI_ASPEED_SMC)	+= aspeed-smc.o
-obj-$(CONFIG_SPI_CADENCE_QUADSPI)	+= cadence-quadspi.o
 obj-$(CONFIG_SPI_HISI_SFC)	+= hisi-sfc.o
 obj-$(CONFIG_SPI_MTK_QUADSPI)    += mtk-quadspi.o
 obj-$(CONFIG_SPI_NXP_SPIFI)	+= nxp-spifi.o
drivers/spi/Kconfig +10 -0
index d6ed0c355954..2735569ed2ea 100644
@@ -193,6 +193,16 @@ config SPI_CADENCE
 	  This selects the Cadence SPI controller master driver
 	  used by Xilinx Zynq and ZynqMP.
 
+config SPI_CADENCE_QUADSPI
+	tristate "Cadence Quad SPI controller"
+	depends on OF && (ARM || ARM64 || COMPILE_TEST || X86)
+	help
+	  Enable support for the Cadence Quad SPI Flash controller.
+
+	  Cadence QSPI is a specialized controller for connecting an SPI
+	  Flash over 1/2/4/8-bit wide bus. This enables support for the Octal
+	  and Quad SPI variants of Cadence QSPI IP.
+
 config SPI_CLPS711X
 	tristate "CLPS711X host SPI controller"
 	depends on ARCH_CLPS711X || COMPILE_TEST
drivers/spi/Makefile +1 -0
index 9b65ec5afc5e..a73cf7a7e635 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_SPI_BCM_QSPI)		+= spi-iproc-qspi.o spi-brcmstb-qspi.o spi-bcm-qspi.
 obj-$(CONFIG_SPI_BITBANG)		+= spi-bitbang.o
 obj-$(CONFIG_SPI_BUTTERFLY)		+= spi-butterfly.o
 obj-$(CONFIG_SPI_CADENCE)		+= spi-cadence.o
+obj-$(CONFIG_SPI_CADENCE_QUADSPI)	+= spi-cadence-quadspi.o
 obj-$(CONFIG_SPI_CLPS711X)		+= spi-clps711x.o
 obj-$(CONFIG_SPI_COLDFIRE_QSPI)		+= spi-coldfire-qspi.o
 obj-$(CONFIG_SPI_DAVINCI)		+= spi-davinci.o
drivers/spi/spi-cadence-quadspi.c renamed from drivers/mtd/spi-nor/cadence-quadspi.c +303 -338

1,151 lines not on this page · raw message

Signature · 1 line
2.11.0
#7 lore raw
Quoted 10 lines · Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add support for the Cadence QSPI controller. This controller is present in the Intel Lightning Mountain(LGM) SoCs, Altera and TI SoCs. This driver has been tested on the Intel LGM SoCs.

This driver does not support generic SPI and also the implementation only supports spi-mem interface to replace the existing driver in mtd/spi-nor/cadence-quadspi.c, the existing driver only support SPI-NOR flash memory.

Is it really supporting SPI NORs only, or is it just that you only tested it with a spi-nor?

Quoted 5 lines

Reported-by? What has been reported?

Quoted 6 lines
---
 drivers/mtd/spi-nor/Kconfig                        |  11 -
 drivers/mtd/spi-nor/Makefile                       |   1 -
 drivers/spi/Kconfig                                |  10 +
 drivers/spi/Makefile                               |   1 +
 .../spi-cadence-quadspi.c}                         | 641 ++++++++++-----------

Looks like this could be split in several patches to ease the review:

1/ convert to spi-mem
2/ move the driver to drivers/spi
3/ add support for intel,lgm-qspi

other than that, that's good to see one more spi-nor controller driver converted to spi-mem.

#9 lore raw

Hi Mark,

Quoted 8 lines · Mark Brown
Quoted 4 lines · Boris Brezillon

"Ramuthevar, Vadivel MuruganX"

Quoted 2 lines

Reported-by? What has been reported?

There were static checker issues with some of the earlier versions. Vadivel, normally you wouldn't carry tags like that forward when you fix them.

Than you Mark, will remove it in the next patch-set.

Regards
Vadivel

#10 lore raw
In reply to Boris Brezillon

Hi Boris,

     Thank you so much for the review comments...

Quoted 10 lines · Boris Brezillon
Quoted 6 lines · Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add support for the Cadence QSPI controller. This controller is present in the Intel Lightning Mountain(LGM) SoCs, Altera and TI SoCs. This driver has been tested on the Intel LGM SoCs.

Quoted 6 lines
Quoted 4 lines

This driver does not support generic SPI and also the implementation only supports spi-mem interface to replace the existing driver in mtd/spi-nor/cadence-quadspi.c, the existing driver only support SPI-NOR flash memory

Is it really supporting SPI NORs only, or is it just that you only tested it with a spi-nor?

The existing drivers/mtd/spi-nor/cadence-quadspi.c supports SPI-NORs only, because the driver is developed

such a way that it does not support other SPI based flash memories, also never uses SPI/SPI-MEM based framework.

So we Vignesh suggested me to  develop the new driver which supports both SPI-NOR and SPI-NAND based on the SPI-MEM framework.

Quoted 5 lines
Quoted 4 lines

Reported-by? What has been reported?

Sure, will remove it.

Quoted 7 lines
Quoted 7 lines
---
  drivers/mtd/spi-nor/Kconfig                        |  11 -
  drivers/mtd/spi-nor/Makefile                       |   1 -
  drivers/spi/Kconfig                                |  10 +
  drivers/spi/Makefile                               |   1 +
  .../spi-cadence-quadspi.c}                         | 641 ++++++++++-----------
Quoted 8 lines

Looks like this could be split in several patches to ease the review:

1/ convert to spi-mem
2/ move the driver to drivers/spi
3/ add support for intel,lgm-qspi

other than that, that's good to see one more spi-nor controller driver converted to spi-mem.

Agreed!, will split as per your suggestions.

Regards
Vadivel

Quoted 1 line
#11 lore raw
Quoted 22 lines · Vadivel MuruganX

Hi Boris,

     Thank you so much for the review comments...

Quoted 10 lines · Boris Brezillon
Quoted 6 lines · Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add support for the Cadence QSPI controller. This controller is present in the Intel Lightning Mountain(LGM) SoCs, Altera and TI SoCs. This driver has been tested on the Intel LGM SoCs.

Quoted 6 lines
Quoted 4 lines

This driver does not support generic SPI and also the implementation only supports spi-mem interface to replace the existing driver in mtd/spi-nor/cadence-quadspi.c, the existing driver only support SPI-NOR flash memory

Is it really supporting SPI NORs only, or is it just that you only tested it with a spi-nor?

Quoted 8 lines

The existing drivers/mtd/spi-nor/cadence-quadspi.c supports SPI-NORs only, because the driver is developed

such a way that it does not support other SPI based flash memories, also never uses SPI/SPI-MEM based framework.

So we Vignesh suggested me to  develop the new driver which supports both SPI-NOR and SPI-NAND based on the SPI-MEM framework.

Hm, your commit message makes it sound like even the new driver isn't generic enough to support SPI NANDs. Maybe there's something to improve to clarify the fact that this new version is not limited to SPI NORs.

#12 lore raw

Hi Boris,

Quoted 28 lines · Boris Brezillon
Quoted 24 lines · Vadivel MuruganX

Hi Boris,

     Thank you so much for the review comments...

Quoted 10 lines · Boris Brezillon
Quoted 6 lines · Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar-VuQAYsv1563Yd54FQh9/[email protected]>

Add support for the Cadence QSPI controller. This controller is present in the Intel Lightning Mountain(LGM) SoCs, Altera and TI SoCs. This driver has been tested on the Intel LGM SoCs.

Quoted 6 lines
Quoted 4 lines

This driver does not support generic SPI and also the implementation only supports spi-mem interface to replace the existing driver in mtd/spi-nor/cadence-quadspi.c, the existing driver only support SPI-NOR flash memory

Is it really supporting SPI NORs only, or is it just that you only tested it with a spi-nor?

The existing drivers/mtd/spi-nor/cadence-quadspi.c supports SPI-NORs only, because the driver is developed

Quoted 8 lines
Quoted 5 lines

such a way that it does not support other SPI based flash memories, also never uses SPI/SPI-MEM based framework.

So we Vignesh suggested me to  develop the new driver which supports both SPI-NOR and SPI-NAND based on the SPI-MEM framework.

Hm, your commit message makes it sound like even the new driver isn't generic enough to support SPI NANDs. Maybe there's something to improve to clarify the fact that this new version is not limited to SPI NORs.

Thanks! for the suggestions to remind me to add.

sure, I will add more information about supporting SPI-NOR and SPI-NAND

Regards
Vadivel