Skip to contentSkip to conversation

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

PATCH Superseded Ramuthevar,Vadivel MuruganX 2 participants 4 messages Dec 23, 2019 – Dec 25, 2019

Subsystems (2)

v4 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v4 cover spi: cadence-quadpsi: 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.

Thank you Vignesh for the valuable review comments and guidance, sorry for the delay since waitting for the merge window to rebase and send it now by one-shot.

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

changes from V2:
1. Supports Octal mode as well. So its 1/2/4/8-bit wide

2. Please be consistent with function names. Start all functions with cadence_qspi_. If need you could have a shorter function prefix like cqspi_

Also, this and few other functions below can be static and they are not used outside of this module.

3. Could you please keep polling routines from original driver (drivers/mtd/spi-nor/cadence-quadspi.c). If you really want to improve these helpers, please do those changes in a separate patch later on in the series. This will greatly help in reviewing the code.

Also, I see that you have dropped many inline comments in the code. These comments are quite important and I suggest not to drop them unless they are no longer applicable

3. s/docoder/decoder

4. Please use cqspi_wait_for_bit() that uses readl_relaxed_poll_timeout() here. There are couple corner cases that above code does not take care of.

5. Why do we need flash type specific handling here? Does not spi-nand driver provide appropriate dummy_clk values? Why is the driver always adding 8 dummy clks always?

6. Nope, no custom handling or interpreting of opcodes in driver. Just set addrwidth to quad in CQSPI_REG_WR_INSTR when op->addr.buswidth is 4.

7. This was wait_for_completion_timeout() previously. Have you tested interrupting the sleep and verified that driver handles this case correctly?

8 rdid_length harcoded values are changed as generic

9. Please get ride of all flash type specific handling... There should be no need for it. IF there are gaps in then lets discuss and fix it in spi-nand and spi-nor frameworks and not in the driver.

spi-mem user should just take spi_mem_op template passed by the core and execute it. No assumptions wrt flash type or opcode should be done.

10. Decision to use STIG was INDAC mode can be done using:

if (op->data.dir == SPI_MEM_DATA_IN && op->data.buf.in) {
        if (!op->addr.nbytes)
                mode = CQSPI_STIG_READ;
        else
                mode = IDC_READ_MODE;
        } else {
        if (!op->addr.nbytes || !op->data.buf.out)
                 mode = CQSPI_STIG_WRITE;
        else
                mode = IDC_WRITE_MODE;
        }

No need for rdid_length etc.

11. This is a big gap and there is lot of code sharing that can be done b/w INDAC and DAC mode.

Looks like driver isn't quite close to being ready. I suggest you also take a look at patches for spi-mem conversion of cadence-quadspi driver in U-Boot as well:

https://patchwork.ozlabs.org/cover/1176362/

12. Please dont add any new DT properties, there is no need for them. See how this was handled in existing driver and reuse it

13. Slave DMA was never supported and is not needed.

14. Octal?

15. NACK, should be GPLv2 and no need for boilerplate text below when SPDX Identifier is present.

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

 .../devicetree/bindings/spi/cdns,qspi-nor.yaml     |  147 +++
 drivers/spi/Kconfig                                |    8 +
 drivers/spi/Makefile                               |    1 +
 drivers/spi/spi-cadence-quadspi.c                  | 1172 ++++++++++++++++++++
 drivers/spi/spi-cadence-quadspi.h                  |  245 ++++
 5 files changed, 1573 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
 create mode 100644 drivers/spi/spi-cadence-quadspi.c
 create mode 100644 drivers/spi/spi-cadence-quadspi.h
Signature · 1 line
2.11.0
#1 lore raw

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

From: Ramuthevar Vadivel Murugan <[email protected]>

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

---
 .../devicetree/bindings/spi/cdns,qspi-nor.yaml     | 147 +++++++++++++++++++++
 1 file changed, 147 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml
Documentation/devicetree/bindings/spi/cdns,qspi-nor.yaml new file +147 -0
new file mode 100644
index 000000000000..b8ec7d874f78
@@ -0,0 +1,147 @@
+# 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 <[email protected]>
+
+allOf:
+  - $ref: "spi-controller.yaml#"
+
+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".
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+        - enum:
+           - ti,k2g-qspi
+        - const: cdns,qspi-nor
+
+      - items:
+        - enum:
+           - ti,am654-ospi
+        - const: cdns,qspi-nor
+
+      - items:
+        - enum:
+           - intel,lgm-qspi
+        - const: cdns,qspi-nor
+
+      - items:
+        - const: cdns,qspi-nor
+
+  reg:
+    maxItems: 2 
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  cdns,fifo-depth:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Size of the data FIFO in words.
+
+  cdns,fifo-width:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Bus width of the data FIFO in bytes.
+
+  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
+    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.
+
+# subnode's properties
+patternProperties:
+  "^.*@[0-9a-fA-F]+$":
+    type: object
+    description:
+      flash device uses the subnodes below defined properties.
+
+  cdns,read-delay:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      Delay for read capture logic, in clock cycles.
+
+  cdns,tshsl-ns:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Delay in nanoseconds for the length that the master mode chip select
+      outputs are de-asserted between transactions.
+
+  cdns,tsd2d-ns:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Delay in nanoseconds between one chip select being de-activated
+      and the activation of another.
+
+  cdns,tchsh-ns:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Delay in nanoseconds between last bit of current transaction and
+      deasserting the device chip select (qspi_n_ss_out).
+
+  cdns,tslch-ns:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Delay in 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>;
+          };
+    };
+
Signature · 1 line
2.11.0
#2 lore raw

PATCH v4 2/2 spi: cadence-quadpsi: Add support for the Cadence QSPI controller

In reply to Ramuthevar,Vadivel MuruganX

From: Ramuthevar Vadivel Murugan <[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/spi/Kconfig               |    8 +
 drivers/spi/Makefile              |    1 +
 drivers/spi/spi-cadence-quadspi.c | 1172 +++++++++++++++++++++++++++++++++++++
 drivers/spi/spi-cadence-quadspi.h |  245 ++++++++
 4 files changed, 1426 insertions(+)
 create mode 100644 drivers/spi/spi-cadence-quadspi.c
 create mode 100644 drivers/spi/spi-cadence-quadspi.h
drivers/spi/Kconfig +8 -0
index 870f7797b56b..6d48a89737a4 100644
@@ -193,6 +193,14 @@ 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)
+	depends on MTD || MTD_SPI_NOR || MTD_SPI_NAND
+	help
+	  Cadence QSPI is a specialized controller for connecting an SPI
+	  Flash over 1/2/4/8-bit wide bus. This enables support for the Quad SPI
+
 config SPI_CLPS711X
 	tristate "CLPS711X host SPI controller"
 	depends on ARCH_CLPS711X || COMPILE_TEST
drivers/spi/Makefile +1 -0
index bb49c9e6d0a0..288f5fa903fe 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 new file +1172 -0

1,172 lines not on this page · raw message

drivers/spi/spi-cadence-quadspi.h new file +245 -0

245 lines not on this page · raw message

Signature · 1 line
2.11.0
#3 lore raw
Thank you for the patch! Perhaps something to improve:

Hi "Ramuthevar,Vadivel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on spi/for-next]
[also build test WARNING on v5.5-rc3 next-20191220]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Ramuthevar-Vadivel-MuruganX/spi-cadence-quadpsi-Add-support-for-the-Cadence-QSPI-controller/20191225-040310
base:   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.1-129-g341daf20-dirty
        make ARCH=x86_64 allmodconfig
        make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag

sparse warnings: (new ones prefixed by >>)

>> drivers/spi/spi-cadence-quadspi.c:133:30: sparse: sparse: incorrect type in argument 1 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:133:30: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:133:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:139:30: sparse: sparse: incorrect type in argument 2 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:139:30: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:139:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:146:30: sparse: sparse: incorrect type in argument 1 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:146:30: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:146:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:152:30: sparse: sparse: incorrect type in argument 2 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:152:30: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:152:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:161:30: sparse: sparse: incorrect type in argument 1 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:161:30: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:161:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:171:30: sparse: sparse: incorrect type in argument 2 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:171:30: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:171:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:183:30: sparse: sparse: incorrect type in argument 1 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:183:30: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:183:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:186:30: sparse: sparse: incorrect type in argument 2 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:186:30: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:186:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:195:30: sparse: sparse: incorrect type in argument 1 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:195:30: sparse:    expected void const volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:195:30: sparse:    got void *
   drivers/spi/spi-cadence-quadspi.c:214:30: sparse: sparse: incorrect type in argument 2 (different address spaces)
   drivers/spi/spi-cadence-quadspi.c:214:30: sparse:    expected void volatile [noderef] <asn:2> *addr
   drivers/spi/spi-cadence-quadspi.c:214:30: sparse:    got void *
>> drivers/spi/spi-cadence-quadspi.c:383:31: sparse: sparse: incorrect type in initializer (different address spaces)

drivers/spi/spi-cadence-quadspi.c:383:31: sparse: expected void *reg_base
drivers/spi/spi-cadence-quadspi.c:383:31: sparse: got void [noderef] <asn:2> *iobase
drivers/spi/spi-cadence-quadspi.c:384:31: sparse: sparse: incorrect type in initializer (different address spaces)
drivers/spi/spi-cadence-quadspi.c:384:31: sparse: expected void *ahb_base
drivers/spi/spi-cadence-quadspi.c:384:31: sparse: got void [noderef] <asn:2> *qspi_ahb_virt
drivers/spi/spi-cadence-quadspi.c:393:36: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:393:36: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:393:36: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:398:25: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:398:25: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:398:25: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:400:48: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:400:48: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:400:48: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:401:44: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:401:44: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:401:44: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:405:25: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:405:25: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:405:25: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:413:33: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:413:33: sparse: expected void const volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:413:33: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:423:46: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:423:46: sparse: expected void [noderef] <asn:2> *port
drivers/spi/spi-cadence-quadspi.c:423:46: sparse: got void *ahb_base
drivers/spi/spi-cadence-quadspi.c:426:62: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:426:62: sparse: expected void [noderef] <asn:2> *
drivers/spi/spi-cadence-quadspi.c:426:62: sparse: got void *ahb_base
drivers/spi/spi-cadence-quadspi.c:435:41: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:435:41: sparse: expected void const volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:435:41: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:443:43: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:443:43: sparse: expected void [noderef] <asn:2> *reg
drivers/spi/spi-cadence-quadspi.c:443:43: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:452:28: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:452:28: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:452:28: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:454:57: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:454:57: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:454:57: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:459:28: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:459:28: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:459:28: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:462:25: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:462:25: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:462:25: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:519:31: sparse: sparse: incorrect type in initializer (different address spaces)
drivers/spi/spi-cadence-quadspi.c:519:31: sparse: expected void *reg_base
drivers/spi/spi-cadence-quadspi.c:519:31: sparse: got void [noderef] <asn:2> *iobase
drivers/spi/spi-cadence-quadspi.c:520:31: sparse: sparse: incorrect type in initializer (different address spaces)
drivers/spi/spi-cadence-quadspi.c:520:31: sparse: expected void *ahb_base
drivers/spi/spi-cadence-quadspi.c:520:31: sparse: got void [noderef] <asn:2> *qspi_ahb_virt
drivers/spi/spi-cadence-quadspi.c:527:30: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:527:30: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:527:30: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:528:30: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:528:30: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:528:30: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:529:30: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:529:30: sparse: expected void const volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:529:30: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:534:30: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:534:30: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:534:30: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:536:36: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:536:36: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:536:36: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:537:54: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:537:54: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:537:54: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:539:48: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:539:48: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:539:48: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:540:44: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:540:44: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:540:44: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:543:25: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:543:25: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:543:25: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:557:39: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:557:39: sparse: expected void [noderef] <asn:2> *port
drivers/spi/spi-cadence-quadspi.c:557:39: sparse: got void *ahb_base
drivers/spi/spi-cadence-quadspi.c:564:41: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:564:41: sparse: expected void [noderef] <asn:2> *
drivers/spi/spi-cadence-quadspi.c:564:41: sparse: got void *ahb_base
drivers/spi/spi-cadence-quadspi.c:579:43: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:579:43: sparse: expected void [noderef] <asn:2> *reg
drivers/spi/spi-cadence-quadspi.c:579:43: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:590:28: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:590:28: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:590:28: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:592:57: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:592:57: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:592:57: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:597:33: sparse: sparse: incorrect type in argument 2 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:597:33: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/spi/spi-cadence-quadspi.c:597:33: sparse: got void *
drivers/spi/spi-cadence-quadspi.c:607:38: sparse: sparse: incorrect type in argument 1 (different address spaces)
drivers/spi/spi-cadence-quadspi.c:607:38: sparse: expected void *reg_base

vim +133 drivers/spi/spi-cadence-quadspi.c

128
129 static void cqspi_direct_access_enable(void *reg_base, bool enable)
130 {
131 u32 reg;
132

 > 133		reg = readl(reg_base + CQSPI_REG_CONFIG);
   134		if (enable)
   135			reg |= CQSPI_REG_CONFIG_DIRECT_MASK;
   136		else
   137			reg &= ~CQSPI_REG_CONFIG_DIRECT_MASK;
   138	
   139		writel(reg, reg_base + CQSPI_REG_CONFIG);
   140	}
   141	
   142	static void cqspi_controller_enable(void *reg_base, bool enable)
   143	{
   144		unsigned int reg;
   145	
   146		reg = readl(reg_base + CQSPI_REG_CONFIG);
   147		if (enable)
   148			reg |= CQSPI_REG_CONFIG_ENABLE_MASK;
   149		else
   150			reg &= ~CQSPI_REG_CONFIG_ENABLE_MASK;
   151	
   152		writel(reg, reg_base + CQSPI_REG_CONFIG);
   153	}
   154	
   155	static void cqspi_readdata_capture(void *reg_base, u32 bypass, u32 delay)
   156	{
   157		unsigned int reg;
   158	
   159		cqspi_controller_enable(reg_base, 0);
   160	
   161		reg = readl(reg_base + CQSPI_REG_READCAPTURE);
   162		if (bypass)
   163			reg |= (1 << CQSPI_REG_READCAPTURE_BYPASS_LSB);
   164		else
   165			reg &= ~(1 << CQSPI_REG_READCAPTURE_BYPASS_LSB);
   166	
   167		reg &= ~(CQSPI_REG_READCAPTURE_DELAY_MASK
   168			<< CQSPI_REG_READCAPTURE_DELAY_LSB);
   169		reg |= ((delay & CQSPI_REG_READCAPTURE_DELAY_MASK)
   170			<< CQSPI_REG_READCAPTURE_DELAY_LSB);
   171		writel(reg, reg_base + CQSPI_REG_READCAPTURE);
   172	
   173		cqspi_controller_enable(reg_base, 1);
   174	}
   175	
   176	static void cqspi_config_baudrate_div(void *reg_base, u32 ref_clk_hz, u32 sclk)
   177	{
   178		unsigned int reg, div;
   179	
   180		/* Recalculate the baudrate divisor based on QSPI specification. */
   181		div = DIV_ROUND_UP(ref_clk_hz, 2 * sclk) - 1;
   182	
   183		reg = readl(reg_base + CQSPI_REG_CONFIG);
   184		reg &= ~(CQSPI_REG_CONFIG_BAUD_MASK << CQSPI_REG_CONFIG_BAUD_LSB);
   185		div = (div & CQSPI_REG_CONFIG_BAUD_MASK) << CQSPI_REG_CONFIG_BAUD_LSB;
 > 186		writel(reg, reg_base + CQSPI_REG_CONFIG);

187 }
188

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation