Skip to contentSkip to conversation

Add Rockchip SFC(serial flash controller) support

PATCH Superseded Chris Morgan 5 participants 13 messages May 28, 2021 – Jun 1, 2021

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add Rockchip SFC(serial flash controller) support

From: Chris Morgan <[email protected]>

I'm trying to revive an abandoned patch series for the Rockchip serial flash controller (SFC) found on the Rockchip PX30 SOC, as well as other SOCs by Rockchip. I'm picking this up from version 8 of the patch series located from here:

http://patchwork.ozlabs.org/project/linux-mtd/cover/[email protected]/

Changes made in v2:
- Reimplemented driver using spi-mem subsystem.
- Removed power management code as I couldn't get it working properly.
- Added device tree bindings for Odroid Go Advance.

Changes made in this new series versus the v8 of the old series:
- Added function to read spi-rx-bus-width from device tree, in the event that the SPI chip supports 4x mode but only has 2 pins wired (such as the Odroid Go Advance).
- Changed device tree documentation from txt to yaml format.
- Made "reset" message a dev_dbg from a dev_info.
- Changed read and write fifo functions to remove redundant checks.
- Changed the write and read from relaxed to non-relaxed when starting the DMA transfer or reading the DMA IRQ.
- Changed from dma_coerce_mask_and_coherent to just dma_set_mask_and_coherent.
- Changed name of get_if_type to rockchip_sfc_get_if_type.

Chris Morgan (4):
spi: rockchip-sfc: add rockchip serial flash controller driver
spi: rockchip-sfc: Bindings for Rockchip serial flash controller
arm64: dts: rockchip: Add SFC to PX30
arm64: dts: rockchip: Enable SFC for Odroid Go Advance

 .../spi/rockchip,serialflash-controller.yaml  | 107 +++
 arch/arm64/boot/dts/rockchip/px30.dtsi        |  38 +
 .../boot/dts/rockchip/rk3326-odroid-go2.dts   |  16 +
 drivers/spi/Kconfig                           |   9 +
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-rockchip-sfc.c                | 856 ++++++++++++++++++
 6 files changed, 1027 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
 create mode 100644 drivers/spi/spi-rockchip-sfc.c
Signature · 7 lines
2.25.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#2 lore raw

PATCH v2 2/4 spi: rockchip-sfc: Bindings for Rockchip serial flash controller

From: Chris Morgan <[email protected]>

Add binding document for the Rockchip serial flash controller. New device specific parameter of rockchip,sfc-no-dma included in documentation.

---
 .../spi/rockchip,serialflash-controller.yaml  | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +107 -0
new file mode 100644
index 000000000000..eb073130e82a
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/rockchip,serialflash-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip SoCs Serial FLASH Controller (SFC)
+
+maintainers:
+  - Andy Yan <[email protected]>
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - const: rockchip,px30-sfc
+      - const: rockchip,rv1108-sfc
+      - items:
+        - const: rockchip,sfc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 2
+    items:
+      - description: Module Clock
+      - description: Bus Clock
+
+  clock-names:
+    minItems: 2
+    items:
+      - const: clk-sfc
+      - const: clk-hsfc
+
+  power-domains:
+    maxItems: 1
+
+  rockchip,sfc-no-dma:
+    - descrption: Boolean value for disabling DMA
+
+patternProperties:
+  "^spi-nor@[0-3]$":
+    type: object
+    properties:
+      reg:
+        minimum: 0
+        maximum: 3
+
+      spi-max-frequency:
+        maxItems: 1
+	  - description: Maximum frequency for SPI Flash
+
+      compatible:
+        oneOf:
+          - const: jedec,spi-nor
+
+      spi-rx-bus-width:
+        maxItems: 1
+          - description: RX Bus Width (1x, 2x, or 4x mode)
+
+      spi-tx-bus-width:
+        maxItems: 1
+          - description: TX Bus Width (1x, 2x, or 4x mode)
+
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/px30-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+sfc: spi@ff3a0000 {
+	compatible = "rockchip,px30-sfc","rockchip,sfc";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	reg = <0x0 0xff3a0000 0x0 0x4000>;
+	interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
+	clock-names = "sfc", "hsfc";
+	pinctrl-names = "default";
+	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;
+	power-domains = <&power PX30_PD_MMC_NAND>;
+
+	nor_flash: spi-nor@0 {
+		reg = <0>;
+		compatible = "xtx,xt25f128b","jedec,spi-nor";
+		spi-rx-bus-width = <2>;
+		spi-tx-bus-width = <2>;
+		spi-max-frequency = <108000000>;
+	};
+};
+
+...
Signature · 7 lines
2.25.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#1 lore raw

PATCH v2 1/4 spi: rockchip-sfc: add rockchip serial flash controller driver

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add the rockchip serial flash controller (SFC) driver.

---
 drivers/spi/Kconfig            |   9 +
 drivers/spi/Makefile           |   1 +
 drivers/spi/spi-rockchip-sfc.c | 856 +++++++++++++++++++++++++++++++++
 3 files changed, 866 insertions(+)
 create mode 100644 drivers/spi/spi-rockchip-sfc.c
drivers/spi/Kconfig +9 -0
index f4481fe48bf0..4d81ba7841e2 100644
@@ -658,6 +658,15 @@ config SPI_ROCKCHIP
 	  The main usecase of this controller is to use spi flash as boot
 	  device.
 
+config SPI_ROCKCHIP_SFC
+	tristate "Rockchip Serial Flash Controller (SFC)"
+	depends on ARCH_ROCKCHIP || COMPILE_TEST
+	depends on HAS_IOMEM && HAS_DMA
+	help
+	  This enables support for Rockchip serial flash controller. This
+	  is a specialized controller used to access SPI flash on some
+	  Rockchip SOCs.
+
 config SPI_RB4XX
 	tristate "Mikrotik RB4XX SPI master"
 	depends on SPI_MASTER && ATH79
drivers/spi/Makefile +1 -0
index 13e54c45e9df..699db95c8441 100644
@@ -95,6 +95,7 @@ obj-$(CONFIG_SPI_QCOM_GENI)		+= spi-geni-qcom.o
 obj-$(CONFIG_SPI_QCOM_QSPI)		+= spi-qcom-qspi.o
 obj-$(CONFIG_SPI_QUP)			+= spi-qup.o
 obj-$(CONFIG_SPI_ROCKCHIP)		+= spi-rockchip.o
+obj-$(CONFIG_SPI_ROCKCHIP_SFC)		+= spi-rockchip-sfc.o
 obj-$(CONFIG_SPI_RB4XX)			+= spi-rb4xx.o
 obj-$(CONFIG_MACH_REALTEK_RTL)		+= spi-realtek-rtl.o
 obj-$(CONFIG_SPI_RPCIF)			+= spi-rpc-if.o
drivers/spi/spi-rockchip-sfc.c new file +856 -0

856 lines not on this page · raw message

Signature · 7 lines
2.25.1


_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#8 lore raw

PATCH v2 3/4 arm64: dts: rockchip: Add SFC to PX30

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add a devicetree entry for the Rockchip SFC for the PX30 SOC.

---
 arch/arm64/boot/dts/rockchip/px30.dtsi | 38 ++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
arch/arm64/boot/dts/rockchip/px30.dtsi +38 -0
index 09baa8a167ce..36fdfa06e83e 100644
@@ -966,6 +966,18 @@ emmc: mmc@ff390000 {
 		status = "disabled";
 	};
 
+	sfc: spi@ff3a0000 {
+		compatible = "rockchip,px30-sfc","rockchip,sfc";
+		reg = <0x0 0xff3a0000 0x0 0x4000>;
+		interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
+		clock-names = "clk-sfc", "clk-hsfc";
+		pinctrl-names = "default";
+		pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus4>;
+		power-domains = <&power PX30_PD_MMC_NAND>;
+		status = "disabled";
+	};
+
 	nfc: nand-controller@ff3b0000 {
 		compatible = "rockchip,px30-nfc";
 		reg = <0x0 0xff3b0000 0x0 0x4000>;
@@ -1967,6 +1979,32 @@ flash_bus8: flash-bus8 {
 			};
 		};
 
+		serial_flash {
+			sfc_bus4: sfc-bus4 {
+				rockchip,pins =
+					<1 RK_PA0 3 &pcfg_pull_none>,
+					<1 RK_PA1 3 &pcfg_pull_none>,
+					<1 RK_PA2 3 &pcfg_pull_none>,
+					<1 RK_PA3 3 &pcfg_pull_none>;
+			};
+
+			sfc_bus2: sfc-bus2 {
+				rockchip,pins =
+					<1 RK_PA0 3 &pcfg_pull_none>,
+					<1 RK_PA1 3 &pcfg_pull_none>;
+			};
+
+			sfc_cs: sfc-cs {
+				rockchip,pins =
+					<1 RK_PA4 3 &pcfg_pull_none>;
+			};
+
+			sfc_clk: sfc-clk {
+				rockchip,pins =
+					<1 RK_PB1 3 &pcfg_pull_none>;
+			};
+		};
+
 		lcdc {
 			lcdc_rgb_dclk_pin: lcdc-rgb-dclk-pin {
 				rockchip,pins =
Signature · 6 lines
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#9 lore raw

PATCH v2 4/4 arm64: dts: rockchip: Enable SFC for Odroid Go Advance

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

This enables the Rockchip Serial Flash Controller for the Odroid Go Advance. Note that while the attached SPI NOR flash and the controller both support quad read mode, only 2 of the required 4 pins are present. The rx and tx bus width is set to 2 for this reason.

---
 .../boot/dts/rockchip/rk3326-odroid-go2.dts      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +16 -0
index 49c97f76df77..a72506d7c6ee 100644
@@ -484,6 +484,22 @@ &sdmmc {
 	status = "okay";
 };
 
+&sfc {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;
+	status = "okay";
+
+	nor_flash: xt25f128b@0 {
+		reg = <0>;
+		compatible = "xtx,xt25f128b","jedec,spi-nor";
+		spi-rx-bus-width = <2>;
+		spi-tx-bus-width = <2>;
+		spi-max-frequency = <108000000>;
+	};
+};
+
 &tsadc {
 	status = "okay";
 };
Signature · 6 lines
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#3 lore raw

Re: [PATCH v2 2/4] spi: rockchip-sfc: Bindings for Rockchip serial flash controller

In reply to Chris Morgan

Am 2021-05-28 19:00, schrieb Chris Morgan:

Quoted 7 lines

From: Chris Morgan <[email protected]>

Add binding document for the Rockchip serial flash controller. New device specific parameter of rockchip,sfc-no-dma included in documentation.

The subject for this patch should start with "dt-bindings:". See Documentation/devicetree/bindings/submitting-patches.rst

Quoted 54 lines
---
 .../spi/rockchip,serialflash-controller.yaml  | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml

diff --git a/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml b/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file mode 100644
index 000000000000..eb073130e82a
--- /dev/null
+++
b/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +4 -0
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: 

http://devicetree.org/schemas/spi/rockchip,serialflash-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +33 -0
+
+title: Rockchip SoCs Serial FLASH Controller (SFC)
+
+maintainers:
+  - Andy Yan <[email protected]>
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - const: rockchip,px30-sfc
+      - const: rockchip,rv1108-sfc
+      - items:
+        - const: rockchip,sfc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 2
+    items:
+      - description: Module Clock
+      - description: Bus Clock
+
+  clock-names:
+    minItems: 2
+    items:
+      - const: clk-sfc

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 48

Quoted 10 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +10 -0
+      - const: clk-hsfc
+
+  power-domains:
+    maxItems: 1
+
+  rockchip,sfc-no-dma:
+    - descrption: Boolean value for disabling DMA
+
+patternProperties:
+  "^spi-nor@[0-3]$":

I guess this subnode shouldn't be here, because its alread being taken care of by the spi-controller.yaml.

Quoted 40 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +40 -0
+    type: object
+    properties:
+      reg:
+        minimum: 0
+        maximum: 3
+
+      spi-max-frequency:
+        maxItems: 1
+	  - description: Maximum frequency for SPI Flash
+
+      compatible:
+        oneOf:
+          - const: jedec,spi-nor
+
+      spi-rx-bus-width:
+        maxItems: 1
+          - description: RX Bus Width (1x, 2x, or 4x mode)
+
+      spi-tx-bus-width:
+        maxItems: 1
+          - description: TX Bus Width (1x, 2x, or 4x mode)
+
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/px30-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+sfc: spi@ff3a0000 {
+	compatible = "rockchip,px30-sfc","rockchip,sfc";
+	#address-cells = <1>;

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 98

Quoted 10 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +10 -0
+	#size-cells = <0>;
+	reg = <0x0 0xff3a0000 0x0 0x4000>;
+	interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
+	clock-names = "sfc", "hsfc";
+	pinctrl-names = "default";
+	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;
+	power-domains = <&power PX30_PD_MMC_NAND>;
+
+	nor_flash: spi-nor@0 {

flash@0 and the reference could probably be dropped.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 100

Quoted 2 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +2 -0
+		reg = <0>;
+		compatible = "xtx,xt25f128b","jedec,spi-nor";

This should only be only "jedec,spi-nor".

You can check the schema with dt_bindings_check, see Documentation/devicetree/bindings/writing-schema.rst

Otherwise, Rob's bot will likely complain.

Please note, that these review comments are just the obvious ones and I don't have much experience with the schemas. Eg. the compatible looks fishy, too. But I'm not sure.

-michael

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 107

Quoted 7 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +7 -0
+		spi-rx-bus-width = <2>;
+		spi-tx-bus-width = <2>;
+		spi-max-frequency = <108000000>;
+	};
+};
+
+...

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#11 lore raw
In reply to Chris Morgan

Am 2021-05-28 19:00, schrieb Chris Morgan:

Quoted 11 lines

From: Chris Morgan <[email protected]>

I'm trying to revive an abandoned patch series for the Rockchip serial flash controller (SFC) found on the Rockchip PX30 SOC, as well as other SOCs by Rockchip. I'm picking this up from version 8 of the patch series located from here:

http://patchwork.ozlabs.org/project/linux-mtd/cover/[email protected]/

Changes made in v2:
- Reimplemented driver using spi-mem subsystem.

Nice!

Oh and I forgot, the dt-bindings patch should go first.

-michael

Quoted 32 lines

- Removed power management code as I couldn't get it working properly.
- Added device tree bindings for Odroid Go Advance.

Changes made in this new series versus the v8 of the old series:
- Added function to read spi-rx-bus-width from device tree, in the event that the SPI chip supports 4x mode but only has 2 pins wired (such as the Odroid Go Advance).
- Changed device tree documentation from txt to yaml format.
- Made "reset" message a dev_dbg from a dev_info.
- Changed read and write fifo functions to remove redundant checks.
- Changed the write and read from relaxed to non-relaxed when starting the DMA transfer or reading the DMA IRQ.
- Changed from dma_coerce_mask_and_coherent to just dma_set_mask_and_coherent.
- Changed name of get_if_type to rockchip_sfc_get_if_type.

Chris Morgan (4):
spi: rockchip-sfc: add rockchip serial flash controller driver
spi: rockchip-sfc: Bindings for Rockchip serial flash controller
arm64: dts: rockchip: Add SFC to PX30
arm64: dts: rockchip: Enable SFC for Odroid Go Advance

 .../spi/rockchip,serialflash-controller.yaml  | 107 +++
 arch/arm64/boot/dts/rockchip/px30.dtsi        |  38 +
 .../boot/dts/rockchip/rk3326-odroid-go2.dts   |  16 +
 drivers/spi/Kconfig                           |   9 +
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-rockchip-sfc.c                | 856 ++++++++++++++++++
 6 files changed, 1027 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
 create mode 100644 drivers/spi/spi-rockchip-sfc.c
Signature · 6 lines
-michael

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
#4 lore raw

Re: [PATCH v2 2/4] spi: rockchip-sfc: Bindings for Rockchip serial flash controller

In reply to Michael Walle
Quoted 11 lines · Michael Walle

Am 2021-05-28 19:00, schrieb Chris Morgan:

Quoted 7 lines

From: Chris Morgan <[email protected]>

Add binding document for the Rockchip serial flash controller. New device specific parameter of rockchip,sfc-no-dma included in documentation.

The subject for this patch should start with "dt-bindings:". See Documentation/devicetree/bindings/submitting-patches.rst

Acknowledged. When I do v3 I'll make this change.

Quoted 60 lines
Quoted 60 lines

---
 .../spi/rockchip,serialflash-controller.yaml  | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml

diff --git a/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml b/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file mode 100644
index 000000000000..eb073130e82a

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +4 -0
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id:

http://devicetree.org/schemas/spi/rockchip,serialflash-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +38 -0
+
+title: Rockchip SoCs Serial FLASH Controller (SFC)
+
+maintainers:
+  - Andy Yan <[email protected]>
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - const: rockchip,px30-sfc
+      - const: rockchip,rv1108-sfc
+      - items:
+        - const: rockchip,sfc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    minItems: 2
+    items:
+      - description: Module Clock
+      - description: Bus Clock
+
+  clock-names:
+    minItems: 2
+    items:
+      - const: clk-sfc
+      - const: clk-hsfc
+
+  power-domains:
+    maxItems: 1
+
Quoted 8 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 48

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +5 -0
+  rockchip,sfc-no-dma:
+    - descrption: Boolean value for disabling DMA
+
+patternProperties:
+  "^spi-nor@[0-3]$":

I guess this subnode shouldn't be here, because its alread being taken care of by the spi-controller.yaml.

Okay, will remove it from v3.

Quoted 61 lines
Quoted 41 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +40 -0
+    type: object
+    properties:
+      reg:
+        minimum: 0
+        maximum: 3
+
+      spi-max-frequency:
+        maxItems: 1
+	  - description: Maximum frequency for SPI Flash
+
+      compatible:
+        oneOf:
+          - const: jedec,spi-nor
+
+      spi-rx-bus-width:
+        maxItems: 1
+          - description: RX Bus Width (1x, 2x, or 4x mode)
+
+      spi-tx-bus-width:
+        maxItems: 1
+          - description: TX Bus Width (1x, 2x, or 4x mode)
+
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/px30-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+sfc: spi@ff3a0000 {
+	compatible = "rockchip,px30-sfc","rockchip,sfc";
+	#address-cells = <1>;

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 98

Quoted 10 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +10 -0
+	#size-cells = <0>;
+	reg = <0x0 0xff3a0000 0x0 0x4000>;
+	interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
+	clock-names = "sfc", "hsfc";
+	pinctrl-names = "default";
+	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;
+	power-domains = <&power PX30_PD_MMC_NAND>;
+
+	nor_flash: spi-nor@0 {

flash@0 and the reference could probably be dropped.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 100

Quoted 2 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +2 -0
+		reg = <0>;
+		compatible = "xtx,xt25f128b","jedec,spi-nor";

This should only be only "jedec,spi-nor".

You can check the schema with dt_bindings_check, see Documentation/devicetree/bindings/writing-schema.rst

Quoted 8 lines

Otherwise, Rob's bot will likely complain.

Please note, that these review comments are just the obvious ones and I don't have much experience with the schemas. Eg. the compatible looks fishy, too. But I'm not sure.

-michael

You are correct, I forgot to remove this before I submitted it. I put the full chip name in there while I was working on this. When I send v3 (which will come after the main SPI driver has had a chance to be looked at) I'll make these changes too.

Thank you.

Quoted 7 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 107

Quoted 7 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +7 -0
+		spi-rx-bus-width = <2>;
+		spi-tx-bus-width = <2>;
+		spi-max-frequency = <108000000>;
+	};
+};
+
+...

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#12 lore raw
In reply to Michael Walle
Quoted 8 lines · Michael Walle

Am 2021-05-28 19:00, schrieb Chris Morgan:

Quoted 7 lines

From: Chris Morgan <[email protected]>

I'm trying to revive an abandoned patch series for the Rockchip serial flash controller (SFC) found on the Rockchip PX30 SOC, as well as other SOCs by Rockchip. I'm picking this up from version 8 of the patch series located from here:

Quoted 9 lines
Quoted 4 lines

http://patchwork.ozlabs.org/project/linux-mtd/cover/[email protected]/

Changes made in v2:
- Reimplemented driver using spi-mem subsystem.

Nice!

Oh and I forgot, the dt-bindings patch should go first.

Understood, will do that in v3.

Quoted 24 lines

-michael

Quoted 22 lines

- Removed power management code as I couldn't get it working properly.
- Added device tree bindings for Odroid Go Advance.

Changes made in this new series versus the v8 of the old series:
- Added function to read spi-rx-bus-width from device tree, in the event that the SPI chip supports 4x mode but only has 2 pins wired (such as the Odroid Go Advance).
- Changed device tree documentation from txt to yaml format.
- Made "reset" message a dev_dbg from a dev_info.
- Changed read and write fifo functions to remove redundant checks.
- Changed the write and read from relaxed to non-relaxed when starting the DMA transfer or reading the DMA IRQ.
- Changed from dma_coerce_mask_and_coherent to just dma_set_mask_and_coherent.
- Changed name of get_if_type to rockchip_sfc_get_if_type.

Chris Morgan (4):
spi: rockchip-sfc: add rockchip serial flash controller driver
spi: rockchip-sfc: Bindings for Rockchip serial flash controller
arm64: dts: rockchip: Add SFC to PX30
arm64: dts: rockchip: Enable SFC for Odroid Go Advance

Quoted 13 lines
Quoted 10 lines
 .../spi/rockchip,serialflash-controller.yaml  | 107 +++
 arch/arm64/boot/dts/rockchip/px30.dtsi        |  38 +
 .../boot/dts/rockchip/rk3326-odroid-go2.dts   |  16 +
 drivers/spi/Kconfig                           |   9 +
 drivers/spi/Makefile                          |   1 +
 drivers/spi/spi-rockchip-sfc.c                | 856 ++++++++++++++++++
 6 files changed, 1027 insertions(+)
 create mode 100644
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
 create mode 100644 drivers/spi/spi-rockchip-sfc.c
Signature · 1 line
-michael

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#5 lore raw

Re: [PATCH v2 2/4] spi: rockchip-sfc: Bindings for Rockchip serial flash controller

In reply to Chris Morgan

Hi Chris,

Some comments. Have a look if it's useful.

Please try to order patches like:
(1) dt-binding - compatible addition
(2) driver patches
(3) devicetree node patches

Quoted 3 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add binding document for the Rockchip serial flash controller.

... Serial Flash Controller (SFC)

binding, document is same meaning?

Quoted 16 lines

New device specific parameter of rockchip,sfc-no-dma included in documentation.

---
 .../spi/rockchip,serialflash-controller.yaml  | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +1 -1
new file mode 100644
index 000000000000..eb073130e82a
--- /dev/null
 
+++ b/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 4

Quoted 4 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +4 -0
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/rockchip,serialflash-controller.yaml#

rockchip-sfc.yaml is shorter,
but ask rob+dt or maintainer for correct name.
Documents seem to have the format:

(manufacturer), (SoC type)-(function).yaml

(manufacturer)-(function).yaml

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 7

Quoted 4 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
 
+title: Rockchip SoCs Serial FLASH Controller (SFC)

title: Rockchip Serial Flash Controller (SFC)

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 10

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+
 
+maintainers:
 
+  - Andy Yan <[email protected]>

This is the original author years ago, but did you ask him to be maintainer?

- Heiko Stuebner <[email protected]>

Add someone who can respond in a short period of time and who knows the hardware in case rob+dt wants to delete something.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 21

Quoted 12 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +11 -0
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
 
+    oneOf:
+      - const: rockchip,px30-sfc
+      - const: rockchip,rv1108-sfc
+      - items:
+        - const: rockchip,sfc

Compatible strings are supposed to be SoC orientated, so no generic ones here.

"rockchip,sfc" can be found in the manufacturer tree:
px30.dtsi
rk1806.dtsi
rk1808.dtsi
rk3036.dtsi
rk312x.dtsi
rk3308.dtsi
rv1108.dtsi

Choose the first SoC in line with SFC and add that to your driver. All SoCs with SFC compatible after that use a fallback string.

Example if rk3036 is first in line and has support in mainline:
oneOf:
- const: rockchip,rk3036-sfc
- items:
- enum:
- rockchip,px30-sfc
- rockchip,rk3308-sfc
- rockchip,rv1108-sfc
- const: rockchip,rk3036-sfc

Check indent with yamllint program.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 30

Quoted 10 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +9 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
 
+    minItems: 2

Remove.
Already 2 items.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 36

Quoted 7 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +6 -0
+    items:
+      - description: Module Clock
+      - description: Bus Clock
+
+  clock-names:
 
+    minItems: 2

Remove.
Already 2 items.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 39

Quoted 4 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+    items:
 
+      - const: clk-sfc
+      - const: clk-hsfc

- const: clk
- const: hclk

Ask Heiko for exact name.
The driver internal uses:

+ clk_disable_unprepare(sfc->clk);
+ clk_disable_unprepare(sfc->hclk);

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 44

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +5 -0
+
+  power-domains:
+    maxItems: 1
+
+  rockchip,sfc-no-dma:

===
vendor,bool-property:
description: Vendor specific properties must have a description. Boolean
properties are one case where the json-schema 'type' keyword can
be used
directly.
type: boolean
===

Quoted 1 line

+ - descrption: Boolean value for disabling DMA

description:

without "-"

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 48

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+
 
+patternProperties:
 
+  "^spi-nor@[0-3]$":

"^flash@[0-3]$":
Maybe restrict further to flash only?

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 61

Quoted 7 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +6 -0
+    type: object
+    properties:
 
+
+      compatible:
+        oneOf:
+          - const: jedec,spi-nor

Remove, use $ref to jedec,spi-nor.yaml.

===

      patternProperties:
        "^flash@[0-3]$":
          type: object

          $ref: "/schemas/mtd/jedec,spi-nor.yaml#"

          properties:
            reg:
              minimum: 0
              maximum: 3

          unevaluatedProperties: false

===

Could you try/test above example?

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 53

Quoted 3 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+      reg:
+        minimum: 0
+        maximum: 3

This is a further restriction.
#define SFC_MAX_CHIPSELECT_NUM 4

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 69

Quoted 13 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +12 -0
+
+      spi-max-frequency:
+        maxItems: 1
+	  - description: Maximum frequency for SPI Flash
 
+
+      spi-rx-bus-width:
+        maxItems: 1
+          - description: RX Bus Width (1x, 2x, or 4x mode)
+
+      spi-tx-bus-width:
+        maxItems: 1
+          - description: TX Bus Width (1x, 2x, or 4x mode)

Already in spi-controller.yaml if nothing changed.

Quoted 8 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +8 -0
+
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 86

Quoted 10 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +9 -0
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/px30-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
 
+sfc: spi@ff3a0000 {

Recheck example indent.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 87

Quoted 1 line
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +1 -0
+	compatible = "rockchip,px30-sfc","rockchip,sfc";
	compatible = "rockchip,px30-sfc", "rockchip,rk3036-sfc";

See comment above.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 93

Quoted 4 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +4 -0
+	reg = <0x0 0xff3a0000 0x0 0x4000>;
+	interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
+	clock-names = "sfc", "hsfc";

clock-names = "clk", "hclk";

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 95

Quoted 1 line
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +1 -0
+	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;
	pinctrl-names = "default";

sort

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 96

Quoted 1 line
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +1 -0
+	power-domains = <&power PX30_PD_MMC_NAND>;
	#address-cells = <1>;
	#size-cells = <0>;

Things with "#" below in the list.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 98

Quoted 3 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +2 -0
+
 
+	nor_flash: spi-nor@0 {
	nor_flash: flash@0 {

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 100

Quoted 3 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +2 -0
+		reg = <0>;
 
+		compatible = "xtx,xt25f128b","jedec,spi-nor";
		compatible = "jedec,spi-nor";

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 103

Quoted 3 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+		spi-rx-bus-width = <2>;
+		spi-tx-bus-width = <2>;
+		spi-max-frequency = <108000000>;

sort

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 107

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +4 -0
+	};
+};
+
+...

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#6 lore raw

Re: [PATCH v2 2/4] spi: rockchip-sfc: Bindings for Rockchip serial flash controller

Quoted 9 lines · Johan Jonker

Hi Chris,

Some comments. Have a look if it's useful.

Please try to order patches like:
(1) dt-binding - compatible addition
(2) driver patches
(3) devicetree node patches

Quoted 8 lines
Quoted 3 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add binding document for the Rockchip serial flash controller.

... Serial Flash Controller (SFC)

binding, document is same meaning?

Yes, will be more clear in follow up.

Quoted 15 lines
Quoted 14 lines

New device specific parameter of rockchip,sfc-no-dma included in documentation.

---
 .../spi/rockchip,serialflash-controller.yaml  | 107 ++++++++++++++++++
 1 file changed, 107 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +0 -1
new file mode 100644
index 000000000000..eb073130e82a
--- /dev/null
Quoted 10 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 4

Quoted 6 lines

+++ b/Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +4 -0
@@ -0,0 +1,107 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/rockchip,serialflash-controller.yaml#

rockchip-sfc.yaml is shorter,
but ask rob+dt or maintainer for correct name.
Documents seem to have the format:

I think rockchip-sfc.yaml works better, it fits the (manufacturer)-(function).yaml format.

Quoted 17 lines

(manufacturer), (SoC type)-(function).yaml

(manufacturer)-(function).yaml

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 7

Quoted 4 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
 
+title: Rockchip SoCs Serial FLASH Controller (SFC)

title: Rockchip Serial Flash Controller (SFC)

Quoted 3 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +2 -0
+
 
+maintainers:
Quoted 8 lines
Quoted 1 line

+ - Andy Yan <[email protected]>

This is the original author years ago, but did you ask him to be maintainer?

- Heiko Stuebner <[email protected]>

Add someone who can respond in a short period of time and who knows the hardware in case rob+dt wants to delete something.

I asked Heiko on IRC if he would be okay with me listing him and myself as maintainers. I'm comfortable enough with the hardware now to be able to respond/fix basic issues with it, though it would also be good to have a veteran of the hardware involved too.

Quoted 39 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 21

Quoted 13 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +11 -0
+
+allOf:
+  - $ref: spi-controller.yaml#
+
+properties:
+  compatible:
 
+    oneOf:
+      - const: rockchip,px30-sfc
+      - const: rockchip,rv1108-sfc
+      - items:
+        - const: rockchip,sfc

Compatible strings are supposed to be SoC orientated, so no generic ones here.

"rockchip,sfc" can be found in the manufacturer tree:
px30.dtsi
rk1806.dtsi
rk1808.dtsi
rk3036.dtsi
rk312x.dtsi
rk3308.dtsi
rv1108.dtsi

Choose the first SoC in line with SFC and add that to your driver. All SoCs with SFC compatible after that use a fallback string.

Example if rk3036 is first in line and has support in mainline:
oneOf:
- const: rockchip,rk3036-sfc
- items:
- enum:
- rockchip,px30-sfc
- rockchip,rk3308-sfc
- rockchip,rv1108-sfc
- const: rockchip,rk3036-sfc

Quoted 1 line

Check indent with yamllint program.

Thanks, acknowledged. The BSP driver does a runtime check to see if the underlying hardware is a v3 or a v4 of the IP, whereas this driver only works as expected on the v3 of the hardware. I don't know which of those chips are which of the hardware. I'll try and pull datasheets for each of them, but failing that I can only say for sure this should work on the rv1108 and px30 (and I can only test against the px30). If it comes down to only being able to validate what I already know, I'll pick the oldest SoC by release date and use that one as the const and list the other one as the compatible.

Quoted 10 lines
Quoted 9 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +8 -0
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
Quoted 4 lines
Quoted 1 line

+ minItems: 2

Remove.
Already 2 items.

Okay.

Quoted 11 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 36

Quoted 8 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +6 -0
+    items:
+      - description: Module Clock
+      - description: Bus Clock
+
+  clock-names:
 
+    minItems: 2

Remove.
Already 2 items.

Okay.

Quoted 12 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 39

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+    items:
 
+      - const: clk-sfc
+      - const: clk-hsfc

- const: clk
- const: hclk

Ask Heiko for exact name.
The driver internal uses:

Review

Quoted 2 lines
(quoted diff) +2 -0
+	clk_disable_unprepare(sfc->clk);
+	clk_disable_unprepare(sfc->hclk);

I'll ask, as the BSP has this all over the place (both).

Quoted 54 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 44

Quoted 6 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +5 -0
+
+  power-domains:
+    maxItems: 1
+
+  rockchip,sfc-no-dma:

===
vendor,bool-property:
description: Vendor specific properties must have a description. Boolean
properties are one case where the json-schema 'type' keyword can
be used
directly.
type: boolean
===

Quoted 1 line

+ - descrption: Boolean value for disabling DMA

description:

without "-"

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 48

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+
 
+patternProperties:
 
+  "^spi-nor@[0-3]$":

"^flash@[0-3]$":
Maybe restrict further to flash only?

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 61

Quoted 7 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +6 -0
+    type: object
+    properties:
 
+
+      compatible:
+        oneOf:
+          - const: jedec,spi-nor

Remove, use $ref to jedec,spi-nor.yaml.

===

      patternProperties:
        "^flash@[0-3]$":
          type: object

          $ref: "/schemas/mtd/jedec,spi-nor.yaml#"

          properties:
            reg:
              minimum: 0
              maximum: 3

          unevaluatedProperties: false
Quoted 3 lines

===

Could you try/test above example?

My hardware has only a single flash chip soldered to CS 0. I'm afraid I'm not able to test any more configurations. The best I can say is the registers on the hardware for CS accept a 2 bit value so anything between 0 and 3 should be acceptable.

Quoted 7 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 53

Quoted 4 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+      reg:
+        minimum: 0
+        maximum: 3

This is a further restriction.
#define SFC_MAX_CHIPSELECT_NUM 4

Correct, because I have 2 bits to work with, bits 31:30 of SFC_CMD (0x0100) to define the chip select.

Quoted 34 lines
Quoted 4 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+
+      spi-max-frequency:
+        maxItems: 1

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 69

Quoted 10 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +9 -0
+	  - description: Maximum frequency for SPI Flash
 
+
+      spi-rx-bus-width:
+        maxItems: 1
+          - description: RX Bus Width (1x, 2x, or 4x mode)
+
+      spi-tx-bus-width:
+        maxItems: 1
+          - description: TX Bus Width (1x, 2x, or 4x mode)

Already in spi-controller.yaml if nothing changed.

Quoted 16 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +16 -0
+
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/px30-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
Quoted 3 lines
Quoted 1 line

+sfc: spi@ff3a0000 {

Recheck example indent.

Will do, I'll make sure the next version I try to fix the indents better.

Quoted 45 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 87

Quoted 2 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +1 -0
+	compatible = "rockchip,px30-sfc","rockchip,sfc";
	compatible = "rockchip,px30-sfc", "rockchip,rk3036-sfc";

See comment above.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 93

Quoted 4 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +4 -0
+	reg = <0x0 0xff3a0000 0x0 0x4000>;
+	interrupts = <GIC_SPI 56 IRQ_TYPE_LEVEL_HIGH>;
+	clocks = <&cru SCLK_SFC>, <&cru HCLK_SFC>;
+	clock-names = "sfc", "hsfc";

clock-names = "clk", "hclk";

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 95

Quoted 1 line
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +1 -0
+	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;
	pinctrl-names = "default";

sort

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 96

Quoted 1 line
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +1 -0
+	power-domains = <&power PX30_PD_MMC_NAND>;
	#address-cells = <1>;
	#size-cells = <0>;

Things with "#" below in the list.

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 98

Quoted 3 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +2 -0
+
 
+	nor_flash: spi-nor@0 {
	nor_flash: flash@0 {

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 100

Quoted 3 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +2 -0
+		reg = <0>;
 
+		compatible = "xtx,xt25f128b","jedec,spi-nor";
		compatible = "jedec,spi-nor";

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 103

Quoted 3 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+		spi-rx-bus-width = <2>;
+		spi-tx-bus-width = <2>;
+		spi-max-frequency = <108000000>;

sort

Quoted 5 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 107

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +4 -0
+	};
+};
+
+...

Thank you for your comments. I'll try to get it all sorted out with the next update.

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip

#10 lore raw

Re: [PATCH v2 4/4] arm64: dts: rockchip: Enable SFC for Odroid Go Advance

In reply to Chris Morgan
Quoted 20 lines · Chris Morgan

From: Chris Morgan <[email protected]>

This enables the Rockchip Serial Flash Controller for the Odroid Go Advance. Note that while the attached SPI NOR flash and the controller both support quad read mode, only 2 of the required 4 pins are present. The rx and tx bus width is set to 2 for this reason.

---
 .../boot/dts/rockchip/rk3326-odroid-go2.dts      | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +0 -0
index 49c97f76df77..a72506d7c6ee 100644
@@ -484,6 +484,22 @@ &sdmmc {
 	status = "okay";
 };
 

arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts &sdmmc { · line 496

Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +10 -0
+&sfc {
+	#address-cells = <1>;
+	#size-cells = <0>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sfc_clk &sfc_cs &sfc_bus2>;
+	status = "okay";
+
+	nor_flash: xt25f128b@0 {
+		reg = <0>;
+		compatible = "xtx,xt25f128b","jedec,spi-nor";

Is the generic "jedec,spi-nor" compatible not enough? I think these flash manufacturer specific compatibles are there because of legacy reasons and should be avoided. Try to see if just "jedec,spi-nor" does the trick.

Quoted 12 lines
arch/arm64/boot/dts/rockchip/rk3326-odroid-go2.dts +6 -0
+		spi-rx-bus-width = <2>;
+		spi-tx-bus-width = <2>;
+		spi-max-frequency = <108000000>;
+	};
+};
+
 &tsadc {
 	status = "okay";
 };
Signature · 1 line
2.25.1
Signature · 8 lines
Regards,
Pratyush Yadav
Texas Instruments Inc.

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
maintainer
#7 lore raw

Re: [PATCH v2 2/4] spi: rockchip-sfc: Bindings for Rockchip serial flash controller

In reply to Chris Morgan

Am Montag, 31. Mai 2021, 19:18:12 CEST schrieb Chris Morgan:

Quoted 18 lines · Johan Jonker
Quoted 17 lines

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 7

Quoted 4 lines

+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +2 -0
+
 
+title: Rockchip SoCs Serial FLASH Controller (SFC)

title: Rockchip Serial Flash Controller (SFC)

Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml line 10

Quoted 5 lines
Documentation/devicetree/bindings/spi/rockchip,serialflash-controller.yaml new file +3 -0
+
 
+maintainers:
 
+  - Andy Yan <[email protected]>

This is the original author years ago, but did you ask him to be maintainer?

- Heiko Stuebner <[email protected]>

Quoted 7 lines
Quoted 2 lines

Add someone who can respond in a short period of time and who knows the hardware in case rob+dt wants to delete something.

I asked Heiko on IRC if he would be okay with me listing him and myself as maintainers. I'm comfortable enough with the hardware now to be able to respond/fix basic issues with it, though it would also be good to have a veteran of the hardware involved too.

sure that is fine with me :-)

Heiko

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip