spi: add driver for ar934x spi controller
Subsystems (2)
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.
Resend the patchset because I forgot to CC documentation maintainers 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 | 230 ++++++++++++++++++ 4 files changed, 278 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
PATCH RESEND 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.
--- drivers/spi/Kconfig | 7 ++ drivers/spi/Makefile | 1 + drivers/spi/spi-ar934x.c | 230 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 238 insertions(+) create mode 100644 drivers/spi/spi-ar934x.c
drivers/spi/Kconfig +7 -0
@@ -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
@@ -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 +230 -0
230 lines not on this page · raw message
Signature · 1 line
2.24.1
Mark Brown
maintainerOn Thu, Feb 06, 2020 at 04:44:42PM +0800, Chuanhong Guo wrote:
This looks good, just a couple of comments below:
drivers/spi/spi-ar934x.c line 3
Quoted 6 lines
drivers/spi/spi-ar934x.c new file +3
-0@@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* SPI controller driver for Qualcomm Atheros AR934x/QCA95xx SoCs
Please make the entire comment block a C++ one so things look more intentional.
Quoted 5 lines
drivers/spi/spi-ar934x.c new file +5
-0+static int ar934x_spi_transfer_one (struct spi_controller *master, +struct spi_message *m) +{ +struct ar934x_spi *sp =spi_controller_get_devdata (master); +struct spi_transfer *t =NULL ;
...
drivers/spi/spi-ar934x.c line 90
Quoted 3 lines
drivers/spi/spi-ar934x.c new file +3
-0+ + m->actual_length =0 ; +list_for_each_entry (t, &m->transfers, transfer_list) {
It looks like this could just be a transfer_one() operation instead of transfer_one_message() (which is what this is in spite of the name)? There's nothing custom outside this loop that I can see.
Quoted 5 lines · Mark Brown
On Thu, Feb 06, 2020 at 04:44:42PM +0800, Chuanhong Guo wrote:
This looks good, just a couple of comments below:
Quoted 9 lines
drivers/spi/spi-ar934x.c line 3
Quoted 6 lines
drivers/spi/spi-ar934x.c new file +3
-0@@ -0,0 +1,230 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* SPI controller driver for Qualcomm Atheros AR934x/QCA95xx SoCs Please make the entire comment block a C++ one so things look more intentional.
Got it. I'll do this in v2.
Quoted 9 lines
Quoted 6 lines
drivers/spi/spi-ar934x.c new file +5
-0+static int ar934x_spi_transfer_one (struct spi_controller *master, +struct spi_message *m) +{ +struct ar934x_spi *sp =spi_controller_get_devdata (master); +struct spi_transfer *t =NULL ;...
Quoted 8 lines
drivers/spi/spi-ar934x.c line 90
Quoted 3 lines
drivers/spi/spi-ar934x.c new file +3
-0+ + m->actual_length =0 ; +list_for_each_entry (t, &m->transfers, transfer_list) {It looks like this could just be a
transfer_one()operation instead oftransfer_one_message()(which is what this is in spite of the name)? There's nothing custom outside this loop that I can see.
Chipselect is also handled during transfer. Controller asserts corresponding chipselect in SHIFT_CTRL register, and if SHIFT_TERM bit is set, controller will deassert chipselect after current transfer is done. I need to know whether this is the last transfer and set SHIFT_TERM accordingly.
Regards,
Chuanhong Guo
Quoted 10 lines · Chuanhong Guo
Quoted 4 lines
It looks like this could just be a
transfer_one()operation instead oftransfer_one_message()(which is what this is in spite of the name)? There's nothing custom outside this loop that I can see.Chipselect is also handled during transfer. Controller asserts corresponding chipselect in
SHIFT_CTRLregister, and ifSHIFT_TERMbit is set, controller will deassert chipselect after current transfer is done. I need to know whether this is the last transfer and setSHIFT_TERMaccordingly.
Oh, I remembered that I saw transfer_one function name somewhere and thought maybe I could shorten the function name a bit. I'll correct this back to ar934x_spi_transfer_one_message in v2.
Regards,
Chuanhong Guo
Mark Brown
maintainerQuoted 11 lines · Chuanhong Guo
Quoted 5 lines · Chuanhong Guo
Chipselect is also handled during transfer. Controller asserts corresponding chipselect in
SHIFT_CTRLregister, and ifSHIFT_TERMbit is set, controller will deassert chipselect after current transfer is done. I need to know whether this is the last transfer and setSHIFT_TERMaccordingly.Oh, I remembered that I saw
transfer_onefunction name somewhere and thought maybe I could shorten the function name a bit. I'll correct this back toar934x_spi_transfer_one_messagein v2.
OK, sounds good - I see the chip select handling now.
PATCH RESEND 2/2 dt-binding: spi: add bindings for spi-ar934x
In reply to Chuanhong GuoAdd binding documentation for SPI controller in Qualcomm Atheros AR934x/QCA95xx SoCs.
--- .../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
@@ -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