Add support for the Airoha EN7523 SPI controller
Subsystems (2)
cover Add support for the Airoha EN7523 SPI controller
This driver will likely also work on other Airoha SoCs, but this will need testing. Only basic single- and dual-bit transfers are supported for now, with DMA mode support yet to come.
Bert Vermeulen (3):
dt-bindings: arm: airoha: Add documentation for Airoha SPI controller
spi: Add support for the Airoha EN7523 SoC SPI controller
ARM: dts: en7523: Add SPI node
.../bindings/spi/airoha,en7523-spi.yaml | 54 ++++ arch/arm/boot/dts/en7523-evb.dts | 20 ++ arch/arm/boot/dts/en7523.dtsi | 11 + drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-en7523.c | 305 ++++++++++++++++++ 6 files changed, 398 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml create mode 100644 drivers/spi/spi-en7523.c
Signature · 1 line
2.25.1
PATCH 1/3 dt-bindings: arm: airoha: Add documentation for Airoha SPI controller
Create documentation for accessing the Airoha EN7523 SPI controller.
--- .../bindings/spi/airoha,en7523-spi.yaml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml
Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml new file +54 -0
@@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/airoha,en7523-spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Airoha EN7523 SPI controller + +maintainers: + - Bert Vermeulen <[email protected]> + +description: | + This binding describes the SPI controller on Airoha EN7523 SoCs. + +allOf: + - $ref: "spi-controller.yaml#" + +properties: + compatible: + items: + - const: airoha,en7523-spi + + reg: + maxItems: 1 + + clocks: + items: + - description: SPI clock + + clock-names: + items: + - const: spi + +required: + - compatible + - reg + - clocks + - clock-names + - '#address-cells' + - '#size-cells' + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/en7523-clk.h> + spi0: spi@1fa10000 { + compatible = "airoha,en7523-spi"; + reg = <0x1fa10000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&scu EN7523_CLK_SPI>; + clock-names = "spi"; + };
Signature · 1 line
2.25.1
Re: [PATCH 1/3] dt-bindings: arm: airoha: Add documentation for Airoha SPI controller
Quoted 4 lines · Bert Vermeulen
Create documentation for accessing the Airoha EN7523 SPI controller.
Signed-off-by Bert Vermeulen <[email protected]>---
Use scripts/get_maintainers.pl to CC all maintainers and relevant mailing lists.
Pushing bindings without CC-ing maintainers is not the way...
Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: arm: airoha: Add documentation for Airoha SPI controller
Quoted 10 lines · Krzysztof Kozlowski
Quoted 4 lines · Bert Vermeulen
Create documentation for accessing the Airoha EN7523 SPI controller.
Signed-off-by Bert Vermeulen <[email protected]>---
Use
scripts/get_maintainers.plto CC all maintainers and relevant mailing lists.Pushing bindings without CC-ing maintainers is not the way...
Oh sorry! I'll Cc you on V2 of the patchset.
Signature · 2 lines
Bert Vermeulen [email protected]
Re: [PATCH 1/3] dt-bindings: arm: airoha: Add documentation for Airoha SPI controller
Quoted 7 lines · Bert Vermeulen
Quoted 6 lines · Krzysztof Kozlowski
Quoted 4 lines · Bert Vermeulen
Create documentation for accessing the Airoha EN7523 SPI controller.
Signed-off-by Bert Vermeulen <[email protected]>---
Quoted 7 lines
Quoted 4 lines
Use
scripts/get_maintainers.plto CC all maintainers and relevant mailing lists.Pushing bindings without CC-ing maintainers is not the way...
Oh sorry! I'll Cc you on V2 of the patchset.
It's not the point to cc me. The point is to Cc all necessary maintainers. We have script for this, so you don't have to figure out people addresses...
Best regards,
Krzysztof
Rob Herring
maintainerRe: [PATCH 1/3] dt-bindings: arm: airoha: Add documentation for Airoha SPI controller
In reply to Bert VermeulenQuoted 20 lines · Bert Vermeulen
Create documentation for accessing the Airoha EN7523 SPI controller.
Signed-off-by Bert Vermeulen <[email protected]>--- .../bindings/spi/airoha,en7523-spi.yaml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/airoha,en7523-spi.yamlDocumentation/devicetree/bindings/spi/airoha,en7523-spi.yaml new file +6
-0@@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/spi/airoha,en7523-spi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +
Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml line 16
Quoted 10 lines
Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml new file +10
-0+title: Airoha EN7523 SPI controller + +maintainers: + - Bert Vermeulen <[email protected]> + +description: | + This binding describes the SPI controller on Airoha EN7523 SoCs. + +allOf: + - $ref: "spi-controller.yaml#"
Drop quotes.
Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml line 28
Quoted 12 lines
Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml new file +12
-0+ +properties: + compatible: + items: + - const: airoha,en7523-spi + + reg: + maxItems: 1 + + clocks: + items: + - description: SPI clock
'maxItems: 1' is sufficient.
Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml line 32
Quoted 4 lines
Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml new file +4
-0+ + clock-names: + items: + - const: spi
You don't really need clock-names when there is only 1.
Quoted 26 lines
Documentation/devicetree/bindings/spi/airoha,en7523-spi.yaml new file +22
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - '#address-cells' + - '#size-cells' + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/en7523-clk.h> + spi0: spi@1fa10000 { + compatible = "airoha,en7523-spi"; + reg = <0x1fa10000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&scu EN7523_CLK_SPI>; + clock-names = "spi"; + };Signature · 1 line
2.25.1
PATCH 2/3 spi: Add support for the Airoha EN7523 SoC SPI controller
In reply to Bert VermeulenThis SPI driver primarily drives the SoC-internal state machine doing the actual transfers. This allows transfers to be transparently queued in hardware.
DMA mode is not yet supported.
--- drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-en7523.c | 305 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 313 insertions(+) create mode 100644 drivers/spi/spi-en7523.c
drivers/spi/Kconfig +7 -0
@@ -57,6 +57,13 @@ config SPI_MEM comment "SPI Master Controller Drivers" +config SPI_AIROHA_EN7523 + bool "Airoha EN7523 SPI controller support" + depends on ARCH_AIROHA + default ARCH_AIROHA + help + This enables SPI controller support for the Airoha EN7523 SoC. + config SPI_ALTERA tristate "Altera SPI Controller platform driver" select SPI_ALTERA_CORE
drivers/spi/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_SPI_SPIDEV) += spidev.o obj-$(CONFIG_SPI_LOOPBACK_TEST) += spi-loopback-test.o # SPI master controller drivers (bus) +obj-$(CONFIG_SPI_AIROHA_EN7523) += spi-en7523.o obj-$(CONFIG_SPI_ALTERA) += spi-altera-platform.o obj-$(CONFIG_SPI_ALTERA_CORE) += spi-altera-core.o obj-$(CONFIG_SPI_ALTERA_DFL) += spi-altera-dfl.o
drivers/spi/spi-en7523.c new file +305 -0
305 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botRe: [PATCH 2/3] spi: Add support for the Airoha EN7523 SoC SPI controller
Thank you for the patch! Perhaps something to improve:
Hi Bert,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on broonie-spi/for-next]
[also build test WARNING on robh/for-next linus/master v6.0-rc6 next-20220921] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Bert-Vermeulen/Add-support-for-the-Airoha-EN7523-SPI-controller/20220922-183229 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next config: arm-defconfig (https://download.01.org/0day-ci/archive/20220923/[email protected]/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/1b16c3608a2ca618f1cea10164a278e931610021
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Bert-Vermeulen/Add-support-for-the-Airoha-EN7523-SPI-controller/20220922-183229 git checkout 1b16c3608a2ca618f1cea10164a278e931610021
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/spi/
If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <[email protected]>
All warnings (new ones prefixed by >>):
>> drivers/spi/spi-en7523.c:219:8: warning: no previous prototype for 'max_transfer_size' [-Wmissing-prototypes]
219 | size_t max_transfer_size(struct spi_device *spi)
| ^~~~~~~~~~~~~~~~~
>> drivers/spi/spi-en7523.c:224:5: warning: no previous prototype for 'transfer_one_message' [-Wmissing-prototypes] 224 | int transfer_one_message(struct spi_controller *ctrl, struct spi_message *msg)
| ^~~~~~~~~~~~~~~~~~~~
vim +/max_transfer_size +219 drivers/spi/spi-en7523.c
218
> 219 size_t max_transfer_size(struct spi_device *spi)
220 {
221 return ENSPI_MAX_XFER;
222 }
223
> 224 int transfer_one_message(struct spi_controller *ctrl, struct spi_message *msg) 225 {
226 struct spi_transfer *xfer;
227 int next_xfer_is_rx = 0;
228
229 manual_begin_cmd();
230 set_cs(0);
231 list_for_each_entry(xfer, &msg->transfers, transfer_list) {
232 if (xfer->tx_buf) {
233 if (!list_is_last(&xfer->transfer_list, &msg->transfers)
234 && list_next_entry(xfer, transfer_list)->rx_buf != NULL)
235 next_xfer_is_rx = 1;
236 else
237 next_xfer_is_rx = 0;
238 msg->actual_length += xfer_write(xfer, next_xfer_is_rx);
239 } else if (xfer->rx_buf) {
240 msg->actual_length += xfer_read(xfer);
241 }
242 }
243 set_cs(1);
244 manual_end_cmd();
245
246 msg->status = 0;
247 spi_finalize_current_message(ctrl);
248
249 return 0;
250 }
251
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
PATCH 3/3 ARM: dts: en7523: Add SPI node
In reply to Bert VermeulenThis adds an SPI node for the EN7523, so far only used for hooking up the NAND boot flash.
--- arch/arm/boot/dts/en7523-evb.dts | 20 ++++++++++++++++++++ arch/arm/boot/dts/en7523.dtsi | 11 +++++++++++ 2 files changed, 31 insertions(+)
arch/arm/boot/dts/en7523-evb.dts +20 -0
@@ -26,6 +26,26 @@ memory@80000000 { }; }; +&spi0 { + nand: nand@0 { + compatible = "spi-nand"; + reg = <0>; + nand-ecc-engine = <&nand>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x80000>; + read-only; + }; + }; + }; +}; + &gpio0 { status = "okay"; };
arch/arm/boot/dts/en7523.dtsi +11 -0
@@ -201,4 +201,15 @@ pcie_intc1: interrupt-controller { #interrupt-cells = <1>; }; }; + + spi0: spi@1fa10000 { + compatible = "airoha,en7523-spi"; + reg = <0x1fa10000 0x10000>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&scu EN7523_CLK_SPI>; + clock-names = "spi"; + spi-rx-bus-width = <2>; + spi-tx-bus-width = <2>; + }; };
Signature · 1 line
2.25.1