Skip to contentSkip to conversation

spi: add driver for ar934x spi controller

PATCH Superseded Chuanhong Guo 3 participants 7 messages Feb 6, 2020 – Feb 8, 2020

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover spi: add driver for ar934x spi controller

This controller is a superset of the already supported qca,ar7100-spi. Besides the bit-bang mode in spi-ath79.c, this new controller added a new "shift register" mode, allowing faster spi operations. This mode doesn't need all the bit-bang code in spi-ath79.c and needs a different clock setup, so I decided to write a new driver for it instead of extending current spi-ath79 driver.

Changes since v1:
1. change comment at the beginning to C++ style
2. rename ar934x_spi_transfer_one to ar934x_spi_transfer_one_message

Chuanhong Guo (2):
spi: add driver for ar934x spi controller
dt-binding: spi: add bindings for spi-ar934x

 .../bindings/spi/qca,ar934x-spi.yaml          |  40 +++
 drivers/spi/Kconfig                           |   7 +
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-ar934x.c                      | 229 ++++++++++++++++++
 4 files changed, 277 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/qca,ar934x-spi.yaml
 create mode 100644 drivers/spi/spi-ar934x.c
Signature · 1 line
2.24.1
#1 lore raw

PATCH v2 1/2 spi: add driver for ar934x spi controller

This patch adds driver for SPI controller found in Qualcomm Atheros AR934x/QCA95xx SoCs.
This controller is a superset of the already supported qca,ar7100-spi. Besides the bit-bang mode in spi-ath79.c, this new controller added a new "shift register" mode, allowing faster spi operations.

---
Changes since v1:
1. change comment at the beginning to C++ style
2. rename ar934x_spi_transfer_one to ar934x_spi_transfer_one_message

 drivers/spi/Kconfig      |   7 ++
 drivers/spi/Makefile     |   1 +
 drivers/spi/spi-ar934x.c | 229 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 237 insertions(+)
 create mode 100644 drivers/spi/spi-ar934x.c
drivers/spi/Kconfig +7 -0
index d6ed0c355954..0434614d8201 100644
@@ -62,6 +62,13 @@ config SPI_ALTERA
 	help
 	  This is the driver for the Altera SPI Controller.
 
+config SPI_AR934X
+	tristate "Qualcomm Atheros AR934X/QCA95XX SPI controller driver"
+	depends on ATH79 || COMPILE_TEST
+	help
+	  This enables support for the SPI controller present on the
+	  Qualcomm Atheros AR934X/QCA95XX SoCs.
+
 config SPI_ATH79
 	tristate "Atheros AR71XX/AR724X/AR913X SPI controller driver"
 	depends on ATH79 || COMPILE_TEST
drivers/spi/Makefile +1 -0
index 9b65ec5afc5e..9892bdfab15e 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_SPI_LOOPBACK_TEST)		+= spi-loopback-test.o
 
 # SPI master controller drivers (bus)
 obj-$(CONFIG_SPI_ALTERA)		+= spi-altera.o
+obj-$(CONFIG_SPI_AR934X)		+= spi-ar934x.o
 obj-$(CONFIG_SPI_ARMADA_3700)		+= spi-armada-3700.o
 obj-$(CONFIG_SPI_ATMEL)			+= spi-atmel.o
 obj-$(CONFIG_SPI_ATMEL_QUADSPI)		+= atmel-quadspi.o
drivers/spi/spi-ar934x.c new file +229 -0

229 lines not on this page · raw message

Signature · 1 line
2.24.1
#2 lore raw

PATCH v2 2/2 dt-binding: spi: add bindings for spi-ar934x

In reply to Chuanhong Guo

Add binding documentation for SPI controller in Qualcomm Atheros AR934x/QCA95xx SoCs.

---
Changes since v1: none

 .../bindings/spi/qca,ar934x-spi.yaml          | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/qca,ar934x-spi.yaml
Documentation/devicetree/bindings/spi/qca,ar934x-spi.yaml new file +40 -0
new file mode 100644
index 000000000000..8f0c520a571c
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/qca,ar934x-spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Atheros AR934x/QCA95xx SoC SPI controller
+
+maintainers:
+  - Chuanhong Guo <[email protected]>
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
+    const: qca,ar934x-spi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - '#address-cells'
+  - '#size-cells'
+
+examples:
+  - |
+    spi: spi@1f000000 {
+        compatible = "qca,ar934x-spi";
+        reg = <0x1f000000 0x1c>;
+        clocks = <&pll ATH79_CLK_AHB>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+    };
Signature · 1 line
2.24.1
maintainer
#3 lore raw

Re: [PATCH v2 2/2] dt-binding: spi: add bindings for spi-ar934x

Quoted 10 lines · Chuanhong Guo

Add binding documentation for SPI controller in Qualcomm Atheros AR934x/QCA95xx SoCs.

---
Changes since v1: none

 .../bindings/spi/qca,ar934x-spi.yaml          | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/qca,ar934x-spi.yaml

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

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
Error: Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dts:20.28-29 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

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

#4 lore raw

Re: [PATCH v2 2/2] dt-binding: spi: add bindings for spi-ar934x

Quoted 23 lines · Rob Herring
Quoted 10 lines · Chuanhong Guo

Add binding documentation for SPI controller in Qualcomm Atheros AR934x/QCA95xx SoCs.

---
Changes since v1: none

 .../bindings/spi/qca,ar934x-spi.yaml          | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/qca,ar934x-spi.yaml

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

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
Error: Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dts:20.28-29 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

Quoted 2 lines

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

It's caused by "clocks = <&pll ATH79_CLK_AHB>" where ATH79_CLK_AHB isn't defined without a include of dt-bindings/clock/ath79-clk.h I'll replace this with a bogus "clocks = <&spi_clock>" instead in v3.

Regards,
Chuanhong Guo

#5 lore raw

Re: [PATCH v2 2/2] dt-binding: spi: add bindings for spi-ar934x

Quoted 24 lines · Chuanhong Guo
Quoted 23 lines · Rob Herring
Quoted 10 lines · Chuanhong Guo

Add binding documentation for SPI controller in Qualcomm Atheros AR934x/QCA95xx SoCs.

---
Changes since v1: none

 .../bindings/spi/qca,ar934x-spi.yaml          | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/qca,ar934x-spi.yaml

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

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
Error: Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dts:20.28-29 syntax error
FATAL ERROR: Unable to parse input tree
scripts/Makefile.lib:300: recipe for target 'Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dt.yaml' failed
make[1]: *** [Documentation/devicetree/bindings/spi/qca,ar934x-spi.example.dt.yaml] Error 1
Makefile:1263: recipe for target 'dt_binding_check' failed
make: *** [dt_binding_check] Error 2

Quoted 6 lines
Quoted 2 lines

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

It's caused by "clocks = <&pll ATH79_CLK_AHB>" where ATH79_CLK_AHB isn't defined without a include of dt-bindings/clock/ath79-clk.h I'll replace this with a bogus "clocks = <&spi_clock>" instead in v3.

You can include ath79-clk.h in your example, see for instance Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml

Signature · 1 line
Florian
#6 lore raw

Re: [PATCH v2 2/2] dt-binding: spi: add bindings for spi-ar934x

Quoted 7 lines · Florian Fainelli
Quoted 3 lines · Chuanhong Guo

It's caused by "clocks = <&pll ATH79_CLK_AHB>" where ATH79_CLK_AHB isn't defined without a include of dt-bindings/clock/ath79-clk.h I'll replace this with a bogus "clocks = <&spi_clock>" instead in v3.

You can include ath79-clk.h in your example, see for instance Documentation/devicetree/bindings/pci/intel-gw-pcie.yaml

Oh. But I've already sent v3 out yesterday :(

I think this is just cosmetic changes and doesn't make much difference so I'd like to keep v3 as-is now and if there are other comments for me to send a v4 I'll change this one as well.

Regards,
Chuanhong Guo