[PATCH v3 2/3] dt-bindings: nand: Add fsl,elbc-fcm-nand

J. Neuschäfer via B4 Relay posted 3 patches 11 months, 2 weeks ago
There is a newer version of this series
[PATCH v3 2/3] dt-bindings: nand: Add fsl,elbc-fcm-nand
Posted by J. Neuschäfer via B4 Relay 11 months, 2 weeks ago
From: "J. Neuschäfer" <j.ne@posteo.net>

Formalize the binding already supported by the fsl_elbc_nand.c driver
and used in several device trees in arch/powerpc/boot/dts/.

raw-nand-chip.yaml is referenced in order to accommodate situations in
which the ECC parameters settings are set in the device tree. One such
example is in arch/powerpc/boot/dts/turris1x.dts:

	/* MT29F2G08ABAEAWP:E NAND */
	nand@1,0 {
		compatible = "fsl,p2020-fcm-nand", "fsl,elbc-fcm-nand";
		reg = <0x1 0x0 0x00040000>;
		nand-ecc-mode = "soft";
		nand-ecc-algo = "bch";

		partitions { ... };
	};

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
---

V3:
- remove unnecessary #address/size-cells from nand node in example
- add Frank Li's review tag
- add missing end of document marker (...)
- explain choice to reference raw-nand-chip.yaml

V2:
- split out from fsl,elbc binding patch
- constrain #address-cells and #size-cells
- add a general description
- use unevaluatedProperties=false instead of additionalProperties=false
- fix property order to comply with dts coding style
- include raw-nand-chip.yaml instead of nand-chip.yaml
---
 .../devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml | 68 ++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml b/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..91e8f2f9ff26da0f5a3f9bf276955ed32e9e7bc6
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mtd/fsl,elbc-fcm-nand.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NAND flash attached to Freescale eLBC
+
+description:
+  The Freescale Enhanced Local Bus controller (eLBC) contains logic to
+  interface with NAND flash, called the NAND Flash Control Machine (FCM).
+  This binding describes flash attached to an eLBC using the FCM.
+
+maintainers:
+  - J. Neuschäfer <j.ne@posteo.net>
+
+allOf:
+  - $ref: raw-nand-chip.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - fsl,mpc8313-fcm-nand
+              - fsl,mpc8315-fcm-nand
+              - fsl,mpc8377-fcm-nand
+              - fsl,mpc8378-fcm-nand
+              - fsl,mpc8379-fcm-nand
+              - fsl,mpc8536-fcm-nand
+              - fsl,mpc8569-fcm-nand
+              - fsl,mpc8572-fcm-nand
+              - fsl,p1020-fcm-nand
+              - fsl,p1021-fcm-nand
+              - fsl,p1025-fcm-nand
+              - fsl,p2020-fcm-nand
+          - const: fsl,elbc-fcm-nand
+      - const: fsl,elbc-fcm-nand
+
+  reg:
+    maxItems: 1
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    localbus {
+        #address-cells = <2>;
+        #size-cells = <1>;
+
+        nand@1,0 {
+            compatible = "fsl,mpc8315-fcm-nand",
+                         "fsl,elbc-fcm-nand";
+            reg = <0x1 0x0 0x2000>;
+        };
+    };
+
+...

-- 
2.48.0.rc1.219.gb6b6757d772


Re: [PATCH v3 2/3] dt-bindings: nand: Add fsl,elbc-fcm-nand
Posted by Rob Herring (Arm) 11 months, 2 weeks ago
On Wed, 26 Feb 2025 18:01:41 +0100, J. Neuschäfer wrote:
> Formalize the binding already supported by the fsl_elbc_nand.c driver
> and used in several device trees in arch/powerpc/boot/dts/.
> 
> raw-nand-chip.yaml is referenced in order to accommodate situations in
> which the ECC parameters settings are set in the device tree. One such
> example is in arch/powerpc/boot/dts/turris1x.dts:
> 
> 	/* MT29F2G08ABAEAWP:E NAND */
> 	nand@1,0 {
> 		compatible = "fsl,p2020-fcm-nand", "fsl,elbc-fcm-nand";
> 		reg = <0x1 0x0 0x00040000>;
> 		nand-ecc-mode = "soft";
> 		nand-ecc-algo = "bch";
> 
> 		partitions { ... };
> 	};
> 
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> ---
> 
> V3:
> - remove unnecessary #address/size-cells from nand node in example
> - add Frank Li's review tag
> - add missing end of document marker (...)
> - explain choice to reference raw-nand-chip.yaml
> 
> V2:
> - split out from fsl,elbc binding patch
> - constrain #address-cells and #size-cells
> - add a general description
> - use unevaluatedProperties=false instead of additionalProperties=false
> - fix property order to comply with dts coding style
> - include raw-nand-chip.yaml instead of nand-chip.yaml
> ---
>  .../devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml | 68 ++++++++++++++++++++++
>  1 file changed, 68 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.example.dtb: nand@1,0: $nodename:0: 'nand@1,0' does not match '^nand@[a-f0-9]$'
	from schema $id: http://devicetree.org/schemas/mtd/fsl,elbc-fcm-nand.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250226-ppcyaml-elbc-v3-2-a90ed71da838@posteo.net

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.

Re: [PATCH v3 2/3] dt-bindings: nand: Add fsl,elbc-fcm-nand
Posted by Rob Herring 11 months, 1 week ago
On Wed, Feb 26, 2025 at 12:45:17PM -0600, Rob Herring (Arm) wrote:
> 
> On Wed, 26 Feb 2025 18:01:41 +0100, J. Neuschäfer wrote:
> > Formalize the binding already supported by the fsl_elbc_nand.c driver
> > and used in several device trees in arch/powerpc/boot/dts/.
> > 
> > raw-nand-chip.yaml is referenced in order to accommodate situations in
> > which the ECC parameters settings are set in the device tree. One such
> > example is in arch/powerpc/boot/dts/turris1x.dts:
> > 
> > 	/* MT29F2G08ABAEAWP:E NAND */
> > 	nand@1,0 {
> > 		compatible = "fsl,p2020-fcm-nand", "fsl,elbc-fcm-nand";
> > 		reg = <0x1 0x0 0x00040000>;
> > 		nand-ecc-mode = "soft";
> > 		nand-ecc-algo = "bch";
> > 
> > 		partitions { ... };
> > 	};
> > 
> > Reviewed-by: Frank Li <Frank.Li@nxp.com>
> > Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> > ---
> > 
> > V3:
> > - remove unnecessary #address/size-cells from nand node in example
> > - add Frank Li's review tag
> > - add missing end of document marker (...)
> > - explain choice to reference raw-nand-chip.yaml
> > 
> > V2:
> > - split out from fsl,elbc binding patch
> > - constrain #address-cells and #size-cells
> > - add a general description
> > - use unevaluatedProperties=false instead of additionalProperties=false
> > - fix property order to comply with dts coding style
> > - include raw-nand-chip.yaml instead of nand-chip.yaml
> > ---
> >  .../devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml | 68 ++++++++++++++++++++++
> >  1 file changed, 68 insertions(+)
> > 
> 
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.example.dtb: nand@1,0: $nodename:0: 'nand@1,0' does not match '^nand@[a-f0-9]$'
> 	from schema $id: http://devicetree.org/schemas/mtd/fsl,elbc-fcm-nand.yaml#

Drop the unit address in raw-nand-chip.yaml. So: 

properties:
  $nodename:
    pattern: "^nand@"
Re: [PATCH v3 2/3] dt-bindings: nand: Add fsl,elbc-fcm-nand
Posted by J. Neuschäfer 11 months, 1 week ago
Miquel, what do you think about Rob's suggestion below?

On Mon, Mar 03, 2025 at 08:00:21AM -0600, Rob Herring wrote:
> On Wed, Feb 26, 2025 at 12:45:17PM -0600, Rob Herring (Arm) wrote:
> > 
> > On Wed, 26 Feb 2025 18:01:41 +0100, J. Neuschäfer wrote:
> > > Formalize the binding already supported by the fsl_elbc_nand.c driver
> > > and used in several device trees in arch/powerpc/boot/dts/.
> > > 
> > > raw-nand-chip.yaml is referenced in order to accommodate situations in
> > > which the ECC parameters settings are set in the device tree. One such
> > > example is in arch/powerpc/boot/dts/turris1x.dts:
> > > 
> > > 	/* MT29F2G08ABAEAWP:E NAND */
> > > 	nand@1,0 {
> > > 		compatible = "fsl,p2020-fcm-nand", "fsl,elbc-fcm-nand";
> > > 		reg = <0x1 0x0 0x00040000>;
> > > 		nand-ecc-mode = "soft";
> > > 		nand-ecc-algo = "bch";
> > > 
> > > 		partitions { ... };
> > > 	};
> > > 
> > > Reviewed-by: Frank Li <Frank.Li@nxp.com>
> > > Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
> > > ---
> > > 
> > > V3:
> > > - remove unnecessary #address/size-cells from nand node in example
> > > - add Frank Li's review tag
> > > - add missing end of document marker (...)
> > > - explain choice to reference raw-nand-chip.yaml
> > > 
> > > V2:
> > > - split out from fsl,elbc binding patch
> > > - constrain #address-cells and #size-cells
> > > - add a general description
> > > - use unevaluatedProperties=false instead of additionalProperties=false
> > > - fix property order to comply with dts coding style
> > > - include raw-nand-chip.yaml instead of nand-chip.yaml
> > > ---
> > >  .../devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml | 68 ++++++++++++++++++++++
> > >  1 file changed, 68 insertions(+)
> > > 
> > 
> > My bot found errors running 'make dt_binding_check' on your patch:
> > 
> > yamllint warnings/errors:
> > 
> > dtschema/dtc warnings/errors:
> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.example.dtb: nand@1,0: $nodename:0: 'nand@1,0' does not match '^nand@[a-f0-9]$'
> > 	from schema $id: http://devicetree.org/schemas/mtd/fsl,elbc-fcm-nand.yaml#
> 
> Drop the unit address in raw-nand-chip.yaml. So: 
> 
> properties:
>   $nodename:
>     pattern: "^nand@"
> 

^^^



Best Regards,
J. Neuschäfer
Re: [PATCH v3 2/3] dt-bindings: nand: Add fsl,elbc-fcm-nand
Posted by Miquel Raynal 11 months ago
On 08/03/2025 at 18:40:43 GMT, J. Neuschäfer <j.ne@posteo.net> wrote:

> Miquel, what do you think about Rob's suggestion below?
>
> On Mon, Mar 03, 2025 at 08:00:21AM -0600, Rob Herring wrote:
>> On Wed, Feb 26, 2025 at 12:45:17PM -0600, Rob Herring (Arm) wrote:
>> > 
>> > On Wed, 26 Feb 2025 18:01:41 +0100, J. Neuschäfer wrote:
>> > > Formalize the binding already supported by the fsl_elbc_nand.c driver
>> > > and used in several device trees in arch/powerpc/boot/dts/.
>> > > 
>> > > raw-nand-chip.yaml is referenced in order to accommodate situations in
>> > > which the ECC parameters settings are set in the device tree. One such
>> > > example is in arch/powerpc/boot/dts/turris1x.dts:
>> > > 
>> > > 	/* MT29F2G08ABAEAWP:E NAND */
>> > > 	nand@1,0 {
>> > > 		compatible = "fsl,p2020-fcm-nand", "fsl,elbc-fcm-nand";
>> > > 		reg = <0x1 0x0 0x00040000>;
>> > > 		nand-ecc-mode = "soft";
>> > > 		nand-ecc-algo = "bch";
>> > > 
>> > > 		partitions { ... };
>> > > 	};
>> > > 
>> > > Reviewed-by: Frank Li <Frank.Li@nxp.com>
>> > > Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
>> > > ---
>> > > 
>> > > V3:
>> > > - remove unnecessary #address/size-cells from nand node in example
>> > > - add Frank Li's review tag
>> > > - add missing end of document marker (...)
>> > > - explain choice to reference raw-nand-chip.yaml
>> > > 
>> > > V2:
>> > > - split out from fsl,elbc binding patch
>> > > - constrain #address-cells and #size-cells
>> > > - add a general description
>> > > - use unevaluatedProperties=false instead of additionalProperties=false
>> > > - fix property order to comply with dts coding style
>> > > - include raw-nand-chip.yaml instead of nand-chip.yaml
>> > > ---
>> > >  .../devicetree/bindings/mtd/fsl,elbc-fcm-nand.yaml | 68 ++++++++++++++++++++++
>> > >  1 file changed, 68 insertions(+)
>> > > 
>> > 
>> > My bot found errors running 'make dt_binding_check' on your patch:
>> > 
>> > yamllint warnings/errors:
>> > 
>> > dtschema/dtc warnings/errors:
>> > /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mtd/fsl,elbc-fcm-nand.example.dtb: nand@1,0: $nodename:0: 'nand@1,0' does not match '^nand@[a-f0-9]$'
>> > 	from schema $id: http://devicetree.org/schemas/mtd/fsl,elbc-fcm-nand.yaml#
>> 
>> Drop the unit address in raw-nand-chip.yaml. So: 
>> 
>> properties:
>>   $nodename:
>>     pattern: "^nand@"

I am not a big fan of lowering the constraint, but if our current schema
doesn't allow to express this need differently, we may need to do that.
I obviously trust Rob on this regard.

Thanks,
Miquèl