Skip to contentSkip to conversation

arm64: allwinner: sun55i-t527: avaota-a1: Add SPI NAND

PATCH In review Chen-Yu Tsai 2 participants 11 messages Mar 2 – Mar 16

Subsystems (3)
lore
Share & tools
lore

Chen-Yu Tsai

author maintainer
#0 lore raw

v2 cover arm64: allwinner: sun55i-t527: avaota-a1: Add SPI NAND

Hi,

This is v2 of my Avaota A1 SPI NAND enablement series.

Changes since v1:
- DT bindings (Krzysztof)
- Moved "allOf:" block after "required:" block
- Dropped "type:" from child node in conditional block
- Collected tags
- Link to v1:
https://lore.kernel.org/linux-sunxi/[email protected]/

This series enables the SPI NAND found on the Avaota A1 in Quad SPI mode. The SPI driver already supports Dual SPI and Quad SPI, but the bindings need to be updated to allow it.

Patch 1 updates the binding to allow Dual SPI and Quad SPI on the newer SoCs. It also allows describing no TX or no RX available.

Patch 2 adds another set of pins for spi0 on the A523 SoC family. This set is used for the SPI NAND on the Avaota A1 board.

Patch 3 enables the SPI NAND found on the board. No partition layout is provided at the moment.

Please have a look.

Thanks
ChenYu

Chen-Yu Tsai (3):
spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs
arm64: dts: allwinner: sun55i-a523: Add pinmux for spi0 on PJ pins
arm64: dts: allwinner: sun55i-t527: avaota-a1: Add SPI NAND

 .../bindings/spi/allwinner,sun6i-a31-spi.yaml | 29 ++++++++++++---
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 35 +++++++++++++++++++
 .../dts/allwinner/sun55i-t527-avaota-a1.dts   | 15 ++++++++
 3 files changed, 74 insertions(+), 5 deletions(-)
Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH v2 1/3 spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs

Support for Dual SPI and Quad SPI was added to the Linux driver in commit 0605d9fb411f ("spi: sun6i: add quirk for dual and quad SPI modes support") and commit 25453d797d7a ("spi: sun6i: add dual and quad SPI modes support for R329/D1/R528/T113s").

However the binding was never updated to allow these modes. Allow them by adding 2 and 4 to the allowed bus widths for the newer variants.

While at it, also add 0 to the allowed bus widths. This signals that RX or TX is not available, i.e. the MISO or MOSI pin is disconnected.

---

Changes since v1:
- Moved "allOf:" block after "required:" block
- Dropped "type:" from child node in conditional block

---
 .../bindings/spi/allwinner,sun6i-a31-spi.yaml | 29 +++++++++++++++----
 1 file changed, 24 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/spi/allwinner,sun6i-a31-spi.yaml +24 -5
index a6067030c5ed..6af4ff233158 100644
@@ -6,9 +6,6 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Allwinner A31 SPI Controller
 
-allOf:
-  - $ref: spi-controller.yaml
-
 maintainers:
   - Chen-Yu Tsai <[email protected]>
   - Maxime Ripard <[email protected]>
@@ -82,11 +79,11 @@ patternProperties:
 
       spi-rx-bus-width:
         items:
-          - const: 1
+          enum: [0, 1, 2, 4]
 
       spi-tx-bus-width:
         items:
-          - const: 1
+          enum: [0, 1, 2, 4]
 
 required:
   - compatible
@@ -95,6 +92,28 @@ required:
   - clocks
   - clock-names
 
+allOf:
+  - $ref: spi-controller.yaml
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - allwinner,sun50i-r329-spi
+                - allwinner,sun55i-a523-spi
+    then:
+      patternProperties:
+        "^.*@[0-9a-f]+":
+          properties:
+            spi-rx-bus-width:
+              items:
+                enum: [0, 1]
+
+            spi-tx-bus-width:
+              items:
+                enum: [0, 1]
+
 unevaluatedProperties: false
 
 examples:
Signature · 1 line
2.47.3
author maintainer
#2 lore raw

PATCH v2 2/3 arm64: dts: allwinner: sun55i-a523: Add pinmux for spi0 on PJ pins

In reply to Chen-Yu Tsai

The Avaota A1 board uses spi0 on the PJ pins to connect a SPI NAND chip.

Add the full set of pins. Even though this board doesn't use CS1, other boards may do so in the future.

---
 .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +35 -0
index 92aecb90d4e1..da85cecb66c0 100644
@@ -228,6 +228,13 @@ spi0_pc_pins: spi0-pc-pins {
 				allwinner,pinmux = <4>;
 			};
 
+			/omit-if-no-ref/
+			spi0_pj_pins: spi0-pj-pins {
+				pins = "PJ21", "PJ22", "PJ23";
+				function = "spi0";
+				allwinner,pinmux = <5>;
+			};
+
 			/omit-if-no-ref/
 			spi0_cs0_pc_pin: spi0-cs0-pc-pin {
 				pins = "PC3";
@@ -235,6 +242,13 @@ spi0_cs0_pc_pin: spi0-cs0-pc-pin {
 				allwinner,pinmux = <4>;
 			};
 
+			/omit-if-no-ref/
+			spi0_cs0_pj_pin: spi0-cs0-pj-pin {
+				pins = "PJ20";
+				function = "spi0";
+				allwinner,pinmux = <5>;
+			};
+
 			/omit-if-no-ref/
 			spi0_cs1_pc_pin: spi0-cs1-pc-pin {
 				pins = "PC7";
@@ -242,6 +256,13 @@ spi0_cs1_pc_pin: spi0-cs1-pc-pin {
 				allwinner,pinmux = <4>;
 			};
 
+			/omit-if-no-ref/
+			spi0_cs1_pj_pin: spi0-cs1-pj-pin {
+				pins = "PJ24";
+				function = "spi0";
+				allwinner,pinmux = <5>;
+			};
+
 			/omit-if-no-ref/
 			spi0_hold_pc_pin: spi0-hold-pc-pin {
 				/* conflicts with eMMC D7 */
@@ -250,6 +271,13 @@ spi0_hold_pc_pin: spi0-hold-pc-pin {
 				allwinner,pinmux = <4>;
 			};
 
+			/omit-if-no-ref/
+			spi0_hold_pj_pin: spi0-hold-pj-pin {
+				pins = "PJ26";
+				function = "spi0";
+				allwinner,pinmux = <5>;
+			};
+
 			/omit-if-no-ref/
 			spi0_wp_pc_pin: spi0-wp-pc-pin {
 				/* conflicts with eMMC D2 */
@@ -258,6 +286,13 @@ spi0_wp_pc_pin: spi0-wp-pc-pin {
 				allwinner,pinmux = <4>;
 			};
 
+			/omit-if-no-ref/
+			spi0_wp_pj_pin: spi0-wp-pj-pin {
+				pins = "PJ25";
+				function = "spi0";
+				allwinner,pinmux = <5>;
+			};
+
 			uart0_pb_pins: uart0-pb-pins {
 				pins = "PB9", "PB10";
 				allwinner,pinmux = <2>;
Signature · 1 line
2.47.3
author maintainer
#3 lore raw

PATCH v2 3/3 arm64: dts: allwinner: sun55i-t527: avaota-a1: Add SPI NAND

In reply to Chen-Yu Tsai

The Avaota A1 board has a SPI NAND chip connected to spi0 on the PJ pins with support for QSPI.

Enable spi0 and add a device node for the SPI NAND chip.

---
 .../boot/dts/allwinner/sun55i-t527-avaota-a1.dts  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm64/boot/dts/allwinner/sun55i-t527-avaota-a1.dts +15 -0
index 7c24121de88f..474354fbfcec 100644
@@ -403,6 +403,21 @@ &rtc {
 	assigned-clock-rates = <32768>;
 };
 
+&spi0  {
+	pinctrl-names = "default";
+	pinctrl-0 = <&spi0_pj_pins>, <&spi0_cs0_pj_pin>,
+		    <&spi0_hold_pj_pin>, <&spi0_wp_pj_pin>;
+	status = "okay";
+
+	nand@0 {
+		compatible = "spi-nand";
+		reg = <0>;
+		spi-max-frequency = <100000000>;
+		spi-rx-bus-width = <4>;
+		spi-tx-bus-width = <4>;
+	};
+};
+
 &uart0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&uart0_pb_pins>;
Signature · 1 line
2.47.3
author maintainer
#4 lore raw
In reply to Chen-Yu Tsai
Quoted 11 lines · Chen-Yu Tsai

This is v2 of my Avaota A1 SPI NAND enablement series.

Changes since v1:
- DT bindings (Krzysztof)
- Moved "allOf:" block after "required:" block
- Dropped "type:" from child node in conditional block
- Collected tags
- Link to v1:
https://lore.kernel.org/linux-sunxi/[email protected]/

[...]

Applied to sunxi/dt-for-7.1 in local tree, thanks!

[1/3] spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs

      commit: e2f93f45d38f7b6dacb44203cfc7bb5d7e287b8e
[2/3] arm64: dts: allwinner: sun55i-a523: Add pinmux for spi0 on PJ pins
      commit: 1a5ff6a0a8c2a0dc9f2d55039997c1cd928eb53c
[3/3] arm64: dts: allwinner: sun55i-t527: avaota-a1: Add SPI NAND
      commit: 1b07332bf2ee816130e139a8966d312bf1aa32f9

Best regards,

Signature · 1 line
Chen-Yu Tsai <[email protected]>
maintainer
#5 lore raw
Quoted 2 lines · Chen-Yu Tsai

[1/3] spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs

      commit: e2f93f45d38f7b6dacb44203cfc7bb5d7e287b8e

I'd have expected to take this one?

author maintainer
#6 lore raw
Quoted 7 lines · Mark Brown
Quoted 2 lines · Chen-Yu Tsai

[1/3] spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs

      commit: e2f93f45d38f7b6dacb44203cfc7bb5d7e287b8e

I'd have expected to take this one?

Normally you merge patches pretty quickly, so I thought maybe you weren't going to take this one.

I can back it out if you want to take it through the SPI tree.

Thanks
ChenYu

maintainer
#7 lore raw
Quoted 10 lines · Chen-Yu Tsai
Quoted 6 lines · Mark Brown
Quoted 2 lines · Chen-Yu Tsai

[1/3] spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs

      commit: e2f93f45d38f7b6dacb44203cfc7bb5d7e287b8e

I'd have expected to take this one?

Normally you merge patches pretty quickly, so I thought maybe you weren't going to take this one.

I tend to leave a week or two if I think it's likely someone's going to review.

Quoted 1 line

I can back it out if you want to take it through the SPI tree.

Probably safer for conflicts.

author maintainer
#8 lore raw
Quoted 13 lines · Mark Brown
Quoted 10 lines · Chen-Yu Tsai
Quoted 6 lines · Mark Brown
Quoted 2 lines · Chen-Yu Tsai

[1/3] spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs

      commit: e2f93f45d38f7b6dacb44203cfc7bb5d7e287b8e

I'd have expected to take this one?

Normally you merge patches pretty quickly, so I thought maybe you weren't going to take this one.

Quoted 6 lines

I tend to leave a week or two if I think it's likely someone's going to review.

Quoted 1 line

I can back it out if you want to take it through the SPI tree.

Probably safer for conflicts.

Now backed out.

maintainer
#9 lore raw

Re: (subset) [PATCH v2 0/3] arm64: allwinner: sun55i-t527: avaota-a1: Add SPI NAND

In reply to Chen-Yu Tsai
Quoted 11 lines · Chen-Yu Tsai

This is v2 of my Avaota A1 SPI NAND enablement series.

Changes since v1:
- DT bindings (Krzysztof)
- Moved "allOf:" block after "required:" block
- Dropped "type:" from child node in conditional block
- Collected tags
- Link to v1:
https://lore.kernel.org/linux-sunxi/[email protected]/

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs

      commit: 743956bb9990214ff1dac66ef59e27221dc3c2d8

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

maintainer
#10 lore raw

Re: (subset) [PATCH v2 0/3] arm64: allwinner: sun55i-t527: avaota-a1: Add SPI NAND

In reply to Chen-Yu Tsai
Quoted 14 lines · Chen-Yu Tsai

arm64: allwinner: sun55i-t527: avaota-a1: Add SPI NAND

Hi,

This is v2 of my Avaota A1 SPI NAND enablement series.

Changes since v1:
- DT bindings (Krzysztof)
- Moved "allOf:" block after "required:" block
- Dropped "type:" from child node in conditional block
- Collected tags
- Link to v1:
https://lore.kernel.org/linux-sunxi/[email protected]/

Quoted 1 line

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.0

Thanks!

[1/3] spi: dt-bindings: sun6i: Allow Dual SPI and Quad SPI for newer SoCs

      https://git.kernel.org/broonie/misc/c/743956bb9990

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark