Skip to contentSkip to conversation

Add add SPI-NAND Flash controller driver for EN7581

PATCH Superseded Lorenzo Bianconi 2 participants 6 messages Apr 11, 2024 – Apr 12, 2024

Subsystems (4)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Lorenzo Bianconi

author maintainer
#0 lore raw

cover Add add SPI-NAND Flash controller driver for EN7581

Introduce support for SPI-NAND driver of the Airoha NAND Flash Interface found on Airoha ARM EN7581 SoCs.

Lorenzo Bianconi (3):
dt-bindings: spi: airoha: Add YAML schema for SNFI controller
arm64: dts: airoha: add EN7581 spi-nand node
spi: airoha: add SPI-NAND Flash controller driver

 .../bindings/spi/airoha,spi-airoha-snfi.yaml  |   56 +
 MAINTAINERS                                   |    9 +
 arch/arm64/boot/dts/airoha/en7581.dtsi        |   17 +
 drivers/spi/Kconfig                           |   10 +
 drivers/spi/Makefile                          |    1 +
 drivers/spi/spi-airoha-snfi.c                 | 1146 +++++++++++++++++
 6 files changed, 1239 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml
 create mode 100644 drivers/spi/spi-airoha-snfi.c
Signature · 1 line
2.44.0
author maintainer
#1 lore raw

PATCH 1/3 dt-bindings: spi: airoha: Add YAML schema for SNFI controller

Introduce Airoha EN7581 SPI NAND controller binding

---
 .../bindings/spi/airoha,spi-airoha-snfi.yaml  | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +56 -0
new file mode 100644
index 000000000000..0244f242eff1
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/airoha,spi-airoha-snfi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SPI-NAND flash controller for Airoha ARM SoCs
+
+maintainers:
+  - Lorenzo Bianconi <[email protected]>
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
+    const: airoha,en7581-snand
+
+  reg:
+    maxItems: 2
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    soc {
+      #address-cells = <2>;
+      #size-cells = <2>;
+
+      spi@1fa10000 {
+        compatible = "airoha,en7581-snand";
+        reg = <0x0 0x1fa10000 0x0 0x140>,
+              <0x0 0x1fa11000 0x0 0x160>;
+        interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        flash@0 {
+          compatible = "spi-nand";
+          reg = <0>;
+          spi-tx-bus-width = <1>;
+          spi-rx-bus-width = <2>;
+        };
+      };
+    };
Signature · 1 line
2.44.0
#2 lore raw

Re: [PATCH 1/3] dt-bindings: spi: airoha: Add YAML schema for SNFI controller

Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml

Quoted 14 lines · Lorenzo Bianconi

Introduce Airoha EN7581 SPI NAND controller binding

---
 .../bindings/spi/airoha,spi-airoha-snfi.yaml  | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +0 -0
new file mode 100644
index 000000000000..0244f242eff1

Use compatible as filename.

Quoted 11 lines
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +10 -0
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/airoha,spi-airoha-snfi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SPI-NAND flash controller for Airoha ARM SoCs
+
+maintainers:
+  - Lorenzo Bianconi <[email protected]>

Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml line 20

Quoted 10 lines
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +10 -0
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
+    const: airoha,en7581-snand
+
+  reg:
+    maxItems: 2

Instead list and describe items.

Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml line 23

Quoted 3 lines
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +3 -0
+
+  interrupts:
+    maxItems: 1

This looks incomplete. No clocks? No other resources?

Best regards,
Krzysztof

author maintainer
#3 lore raw

Re: [PATCH 1/3] dt-bindings: spi: airoha: Add YAML schema for SNFI controller

Quoted 10 lines · Lorenzo Bianconi
Quoted 9 lines

Introduce Airoha EN7581 SPI NAND controller binding

---
 .../bindings/spi/airoha,spi-airoha-snfi.yaml  | 56 +++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml
Quoted 7 lines

Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml

Quoted 5 lines
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +0 -0
new file mode 100644
index 000000000000..0244f242eff1

Use compatible as filename.

ack, I will fix it.

Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +14 -0
@@ -0,0 +1,56 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/airoha,spi-airoha-snfi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SPI-NAND flash controller for Airoha ARM SoCs
+
+maintainers:
+  - Lorenzo Bianconi <[email protected]>
+
+allOf:
+  - $ref: spi-controller.yaml#
+
Quoted 8 lines

Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml line 20

Quoted 6 lines
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +6 -0
+properties:
+  compatible:
+    const: airoha,en7581-snand
+
+  reg:
+    maxItems: 2

Instead list and describe items.

ack, I will fix it.

Quoted 6 lines

Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml line 23

Quoted 4 lines
Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml new file +3 -0
+
+  interrupts:
+    maxItems: 1

This looks incomplete. No clocks? No other resources?

actually spi-snand relies on a fixed-rate clock. I will fix it.

Regards,
Lorenzo

Quoted 4 lines

Best regards,
Krzysztof

author maintainer
#4 lore raw

PATCH 2/3 arm64: dts: airoha: add EN7581 spi-nand node

In reply to Lorenzo Bianconi

Introduce the Airoha EN7581 spi-nand node in Airoha EN7581 dtsi

---
 arch/arm64/boot/dts/airoha/en7581.dtsi | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm64/boot/dts/airoha/en7581.dtsi +17 -0
index 5c4bfe3e1e5a..d2599cbb0fac 100644
@@ -159,5 +159,22 @@ scuclk: clock-controller@1fa20000 {
 			      <0x0 0x1fbe3400 0x0 0xfc>;
 			#clock-cells = <1>;
 		};
+
+		snfi: spi@1fa10000 {
+			compatible = "airoha,en7581-snand";
+			reg = <0x0 0x1fa10000 0x0 0x140>,
+			      <0x0 0x1fa11000 0x0 0x160>;
+			interrupts = <GIC_SPI 51 IRQ_TYPE_LEVEL_HIGH>;
+
+			#address-cells = <1>;
+			#size-cells = <0>;
+			spi_nand: nand@0 {
+				compatible = "spi-nand";
+				reg = <0>;
+				spi-max-frequency = <50000000>;
+				spi-tx-bus-width = <1>;
+				spi-rx-bus-width = <2>;
+			};
+		};
 	};
 };
Signature · 1 line
2.44.0
author maintainer
#5 lore raw

PATCH 3/3 spi: airoha: add SPI-NAND Flash controller driver

In reply to Lorenzo Bianconi

Introduce support for SPI-NAND driver of the Airoha NAND Flash Interface found on Airoha ARM SoCs.

---
 MAINTAINERS                   |    9 +
 drivers/spi/Kconfig           |   10 +
 drivers/spi/Makefile          |    1 +
 drivers/spi/spi-airoha-snfi.c | 1146 +++++++++++++++++++++++++++++++++
 4 files changed, 1166 insertions(+)
 create mode 100644 drivers/spi/spi-airoha-snfi.c
MAINTAINERS +9 -0
index aa3b947fb080..f79bd24eb790 100644
@@ -653,6 +653,15 @@ S:	Supported
 F:	fs/aio.c
 F:	include/linux/*aio*.h
 
+AIROHA SPI SNFI DRIVER
+M:	Lorenzo Bianconi <[email protected]>
+M:	Ray Liu <[email protected]>
+L:	[email protected] (moderated for non-subscribers)
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/spi/airoha,spi-airoha-snfi.yaml
+F:	drivers/spi/spi-airoha.c
+
 AIRSPY MEDIA DRIVER
 L:	[email protected]
 S:	Orphan
drivers/spi/Kconfig +10 -0
index bc7021da2fe9..6fa91775f334 100644
@@ -57,6 +57,16 @@ config SPI_MEM
 
 comment "SPI Master Controller Drivers"
 
+config SPI_AIROHA_SNFI
+	tristate "Airoha SPI NAND Flash Interface"
+	depends on ARCH_AIROHA || COMPILE_TEST
+	depends on SPI_MASTER
+	select REGMAP_MMIO
+	help
+	  This enables support for SPI-NAND mode on the Airoha NAND
+	  Flash Interface found on Airoha ARM SoCs. This controller
+	  is implemented as a SPI-MEM controller.
+
 config SPI_ALTERA
 	tristate "Altera SPI Controller platform driver"
 	select SPI_ALTERA_CORE
drivers/spi/Makefile +1 -0
index 4ff8d725ba5e..e694254dec04 100644
@@ -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_SNFI)		+= spi-airoha-snfi.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-airoha-snfi.c new file +1146 -0

1,146 lines not on this page · raw message

Signature · 1 line
2.44.0