linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus"
@ 2021-11-16 21:18 Li Yang
  2021-11-16 21:18 ` [PATCH v3 1/2] dt-bindings: memory: fsl: convert ifc binding to yaml schema Li Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Li Yang @ 2021-11-16 21:18 UTC (permalink / raw)
  To: Rob Herring, devicetree, Krzysztof Kozlowski, linux-arm-kernel,
	linux-kernel
  Cc: Li Yang

Convert the ifc binding to yaml schema, in the mean while remove the
"simple-bus" compatible from the binding to make sure ifc device probes
before any of the child devices.  Update the driver accordingly.

DTS changes should be submitted after binding/driver changes are merged.

Changes in v3:
- Rebased to v5.16-rc1

Changes in v2:
- Update endian property to type boolean
- Remove example subnodes that don't have yaml binding
- Spin DTS patches into a different series

Li Yang (2):
  dt-bindings: memory: fsl: convert ifc binding to yaml schema
  memory: fsl_ifc: populate child devices without relying on simple-bus

 .../memory-controllers/fsl/fsl,ifc.yaml       | 113 ++++++++++++++++++
 .../bindings/memory-controllers/fsl/ifc.txt   |  82 -------------
 drivers/memory/fsl_ifc.c                      |   7 ++
 3 files changed, 120 insertions(+), 82 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ifc.yaml
 delete mode 100644 Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt

-- 
2.25.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] dt-bindings: memory: fsl: convert ifc binding to yaml schema
  2021-11-16 21:18 [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus" Li Yang
@ 2021-11-16 21:18 ` Li Yang
  2021-11-16 21:18 ` [PATCH v3 2/2] memory: fsl_ifc: populate child devices without relying on simple-bus Li Yang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Li Yang @ 2021-11-16 21:18 UTC (permalink / raw)
  To: Rob Herring, devicetree, Krzysztof Kozlowski, linux-arm-kernel,
	linux-kernel
  Cc: Li Yang, Rob Herring

Convert the txt binding to yaml format and add description.  Drop the
"simple-bus" compatible string from the example and not allowed by the
binding any more.  This will help to enforce the correct probe order
between parent device and child devices, but will require the ifc driver
to probe the child devices to work properly.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 .../memory-controllers/fsl/fsl,ifc.yaml       | 113 ++++++++++++++++++
 .../bindings/memory-controllers/fsl/ifc.txt   |  82 -------------
 2 files changed, 113 insertions(+), 82 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ifc.yaml
 delete mode 100644 Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt

diff --git a/Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ifc.yaml b/Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ifc.yaml
new file mode 100644
index 000000000000..3be1db30bf41
--- /dev/null
+++ b/Documentation/devicetree/bindings/memory-controllers/fsl/fsl,ifc.yaml
@@ -0,0 +1,113 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/memory-controllers/fsl/fsl,ifc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: FSL/NXP Integrated Flash Controller
+
+maintainers:
+  - Li Yang <leoyang.li@nxp.com>
+
+description: |
+  NXP's integrated flash controller (IFC) is an advanced version of the
+  enhanced local bus controller which includes similar programming and signal
+  interfaces with an extended feature set. The IFC provides access to multiple
+  external memory types, such as NAND flash (SLC and MLC), NOR flash, EPROM,
+  SRAM and other memories where address and data are shared on a bus.
+
+properties:
+  $nodename:
+    pattern: "^memory-controller@[0-9a-f]+$"
+
+  compatible:
+    const: fsl,ifc
+
+  "#address-cells":
+    enum: [2, 3]
+    description: |
+      Should be either two or three.  The first cell is the chipselect
+      number, and the remaining cells are the offset into the chipselect.
+
+  "#size-cells":
+    enum: [1, 2]
+    description: |
+      Either one or two, depending on how large each chipselect can be.
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    minItems: 1
+    maxItems: 2
+    description: |
+      IFC may have one or two interrupts.  If two interrupt specifiers are
+      present, the first is the "common" interrupt (CM_EVTER_STAT), and the
+      second is the NAND interrupt (NAND_EVTER_STAT).  If there is only one,
+      that interrupt reports both types of event.
+
+  little-endian:
+    type: boolean
+    description: |
+      If this property is absent, the big-endian mode will be in use as default
+      for registers.
+
+  ranges:
+    description: |
+      Each range corresponds to a single chipselect, and covers the entire
+      access window as configured.
+
+patternProperties:
+  "^.*@[a-f0-9]+(,[a-f0-9]+)+$":
+    type: object
+    description: |
+      Child device nodes describe the devices connected to IFC such as NOR (e.g.
+      cfi-flash) and NAND (fsl,ifc-nand). There might be board specific devices
+      like FPGAs, CPLDs, etc.
+
+    required:
+      - compatible
+      - reg
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    soc {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        memory-controller@ffe1e000 {
+            compatible = "fsl,ifc";
+            #address-cells = <2>;
+            #size-cells = <1>;
+            reg = <0x0 0xffe1e000 0 0x2000>;
+            interrupts = <16 2 19 2>;
+            little-endian;
+
+            /* NOR, NAND Flashes and CPLD on board */
+            ranges = <0x0 0x0 0x0 0xee000000 0x02000000>,
+                     <0x1 0x0 0x0 0xffa00000 0x00010000>,
+                     <0x3 0x0 0x0 0xffb00000 0x00020000>;
+
+            flash@0,0 {
+                #address-cells = <1>;
+                #size-cells = <1>;
+                compatible = "cfi-flash";
+                reg = <0x0 0x0 0x2000000>;
+                bank-width = <2>;
+                device-width = <1>;
+
+                partition@0 {
+                    /* 32MB for user data */
+                    reg = <0x0 0x02000000>;
+                    label = "NOR Data";
+                };
+            };
+        };
+    };
diff --git a/Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt b/Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt
deleted file mode 100644
index 89427b018ba7..000000000000
--- a/Documentation/devicetree/bindings/memory-controllers/fsl/ifc.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-Integrated Flash Controller
-
-Properties:
-- name : Should be ifc
-- compatible : should contain "fsl,ifc". The version of the integrated
-               flash controller can be found in the IFC_REV register at
-               offset zero.
-
-- #address-cells : Should be either two or three.  The first cell is the
-                   chipselect number, and the remaining cells are the
-                   offset into the chipselect.
-- #size-cells : Either one or two, depending on how large each chipselect
-                can be.
-- reg : Offset and length of the register set for the device
-- interrupts: IFC may have one or two interrupts.  If two interrupt
-              specifiers are present, the first is the "common"
-              interrupt (CM_EVTER_STAT), and the second is the NAND
-              interrupt (NAND_EVTER_STAT).  If there is only one,
-              that interrupt reports both types of event.
-
-- little-endian : If this property is absent, the big-endian mode will
-                  be in use as default for registers.
-
-- ranges : Each range corresponds to a single chipselect, and covers
-           the entire access window as configured.
-
-Child device nodes describe the devices connected to IFC such as NOR (e.g.
-cfi-flash) and NAND (fsl,ifc-nand). There might be board specific devices
-like FPGAs, CPLDs, etc.
-
-Example:
-
-	ifc@ffe1e000 {
-		compatible = "fsl,ifc", "simple-bus";
-		#address-cells = <2>;
-		#size-cells = <1>;
-		reg = <0x0 0xffe1e000 0 0x2000>;
-		interrupts = <16 2 19 2>;
-		little-endian;
-
-		/* NOR, NAND Flashes and CPLD on board */
-		ranges = <0x0 0x0 0x0 0xee000000 0x02000000
-			  0x1 0x0 0x0 0xffa00000 0x00010000
-			  0x3 0x0 0x0 0xffb00000 0x00020000>;
-
-		flash@0,0 {
-			#address-cells = <1>;
-			#size-cells = <1>;
-			compatible = "cfi-flash";
-			reg = <0x0 0x0 0x2000000>;
-			bank-width = <2>;
-			device-width = <1>;
-
-			partition@0 {
-				/* 32MB for user data */
-				reg = <0x0 0x02000000>;
-				label = "NOR Data";
-			};
-		};
-
-		flash@1,0 {
-			#address-cells = <1>;
-			#size-cells = <1>;
-			compatible = "fsl,ifc-nand";
-			reg = <0x1 0x0 0x10000>;
-
-			partition@0 {
-				/* This location must not be altered  */
-				/* 1MB for u-boot Bootloader Image */
-				reg = <0x0 0x00100000>;
-				label = "NAND U-Boot Image";
-				read-only;
-			};
-		};
-
-		cpld@3,0 {
-			#address-cells = <1>;
-			#size-cells = <1>;
-			compatible = "fsl,p1010rdb-cpld";
-			reg = <0x3 0x0 0x000001f>;
-		};
-	};
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] memory: fsl_ifc: populate child devices without relying on simple-bus
  2021-11-16 21:18 [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus" Li Yang
  2021-11-16 21:18 ` [PATCH v3 1/2] dt-bindings: memory: fsl: convert ifc binding to yaml schema Li Yang
@ 2021-11-16 21:18 ` Li Yang
  2021-11-17  9:13 ` [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus" Krzysztof Kozlowski
  2021-11-17  9:15 ` Krzysztof Kozlowski
  3 siblings, 0 replies; 5+ messages in thread
From: Li Yang @ 2021-11-16 21:18 UTC (permalink / raw)
  To: Rob Herring, devicetree, Krzysztof Kozlowski, linux-arm-kernel,
	linux-kernel
  Cc: Li Yang

After we update the binding to not use simple-bus compatible for the
controller, we need the driver to populate the child devices explicitly.

Signed-off-by: Li Yang <leoyang.li@nxp.com>
---
 drivers/memory/fsl_ifc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/memory/fsl_ifc.c b/drivers/memory/fsl_ifc.c
index 75a8c38df939..2f6939da21cd 100644
--- a/drivers/memory/fsl_ifc.c
+++ b/drivers/memory/fsl_ifc.c
@@ -88,6 +88,7 @@ static int fsl_ifc_ctrl_remove(struct platform_device *dev)
 {
 	struct fsl_ifc_ctrl *ctrl = dev_get_drvdata(&dev->dev);
 
+	of_platform_depopulate(&dev->dev);
 	free_irq(ctrl->nand_irq, ctrl);
 	free_irq(ctrl->irq, ctrl);
 
@@ -285,8 +286,16 @@ static int fsl_ifc_ctrl_probe(struct platform_device *dev)
 		}
 	}
 
+	/* legacy dts may still use "simple-bus" compatible */
+	ret = of_platform_populate(dev->dev.of_node, NULL, NULL,
+					&dev->dev);
+	if (ret)
+		goto err_free_nandirq;
+
 	return 0;
 
+err_free_nandirq:
+	free_irq(fsl_ifc_ctrl_dev->nand_irq, fsl_ifc_ctrl_dev);
 err_free_irq:
 	free_irq(fsl_ifc_ctrl_dev->irq, fsl_ifc_ctrl_dev);
 err_unmap_nandirq:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus"
  2021-11-16 21:18 [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus" Li Yang
  2021-11-16 21:18 ` [PATCH v3 1/2] dt-bindings: memory: fsl: convert ifc binding to yaml schema Li Yang
  2021-11-16 21:18 ` [PATCH v3 2/2] memory: fsl_ifc: populate child devices without relying on simple-bus Li Yang
@ 2021-11-17  9:13 ` Krzysztof Kozlowski
  2021-11-17  9:15 ` Krzysztof Kozlowski
  3 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2021-11-17  9:13 UTC (permalink / raw)
  To: devicetree, Krzysztof Kozlowski, linux-kernel, linux-arm-kernel,
	Rob Herring, Li Yang
  Cc: Krzysztof Kozlowski

On Tue, 16 Nov 2021 15:18:44 -0600, Li Yang wrote:
> Convert the ifc binding to yaml schema, in the mean while remove the
> "simple-bus" compatible from the binding to make sure ifc device probes
> before any of the child devices.  Update the driver accordingly.
> 
> DTS changes should be submitted after binding/driver changes are merged.
> 
> Changes in v3:
> - Rebased to v5.16-rc1
> 
> [...]

Applied, thanks!

[1/2] dt-bindings: memory: fsl: convert ifc binding to yaml schema
      commit: f91d84e2ed0d661132fc0f46758daca866dfa55b
[2/2] memory: fsl_ifc: populate child devices without relying on simple-bus
      commit: 98f1323959b8d717fbb090f22bdcc5ad768c6dc6

Best regards,
-- 
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus"
  2021-11-16 21:18 [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus" Li Yang
                   ` (2 preceding siblings ...)
  2021-11-17  9:13 ` [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus" Krzysztof Kozlowski
@ 2021-11-17  9:15 ` Krzysztof Kozlowski
  3 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2021-11-17  9:15 UTC (permalink / raw)
  To: Li Yang, Rob Herring, devicetree, linux-arm-kernel, linux-kernel

On 16/11/2021 22:18, Li Yang wrote:
> Convert the ifc binding to yaml schema, in the mean while remove the
> "simple-bus" compatible from the binding to make sure ifc device probes
> before any of the child devices.  Update the driver accordingly.
> 
> DTS changes should be submitted after binding/driver changes are merged.
> 
> Changes in v3:
> - Rebased to v5.16-rc1
> 
> Changes in v2:
> - Update endian property to type boolean
> - Remove example subnodes that don't have yaml binding
> - Spin DTS patches into a different series
> 
> Li Yang (2):
>   dt-bindings: memory: fsl: convert ifc binding to yaml schema
>   memory: fsl_ifc: populate child devices without relying on simple-bus

Thanks, applied.

You keep sending it to wrong address. Please use
scripts/get_maintainers.pl to get the list of people who should be
notified. Maybe you send to wrong address because you base your work on
some old tree, but in such case you need to rebase and use the latest.
Patches on older trees might be considered as not tested.


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-17  9:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 21:18 [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus" Li Yang
2021-11-16 21:18 ` [PATCH v3 1/2] dt-bindings: memory: fsl: convert ifc binding to yaml schema Li Yang
2021-11-16 21:18 ` [PATCH v3 2/2] memory: fsl_ifc: populate child devices without relying on simple-bus Li Yang
2021-11-17  9:13 ` [PATCH v3 0/2] convert ifc binding to yaml and drop "simple-bus" Krzysztof Kozlowski
2021-11-17  9:15 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).