diff mbox series

[v2,08/12] dt-bindings: nand-controller: Reflect reality of marvell,orion-nand

Message ID 20220825013258.3459714-9-andrew@lunn.ch
State Changes Requested, archived
Headers show
Series Start converting MVEBU bindings to DT Schema | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dt-meta-schema fail build log
robh/checkpatch success
robh/patch-applied success
robh/dt-meta-schema fail build log
robh/checkpatch success
robh/patch-applied success
robh/dt-meta-schema fail build log

Commit Message

Andrew Lunn Aug. 25, 2022, 1:32 a.m. UTC
The Marvell Orion NAND driver comes from before the time of the
standardised NAND binding. The controller only supports a single
device, and expects the NAND partition table to be directly in the
controller node. This goes against the standardised NAND binding which
expects a sub node per NAND device, which contains the partition
table.

Since the partition table contains a reg property indicating the start
address of the partition and its length, it needs #size-cells set to
1. However, for a list of nand devices, the reg value is the device
number, requiring #size-cells of 0.

Add an exception to nand-controller.yaml to allow this #size-cells
value when the compatible matches the orion controller.

In order that the example works, it needs a compatible string so the
comparison can be made. Pick the first example in the directory.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
---
 .../bindings/mtd/nand-controller.yaml           | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Rob Herring Aug. 25, 2022, 11:58 a.m. UTC | #1
On Thu, 25 Aug 2022 03:32:54 +0200, Andrew Lunn wrote:
> The Marvell Orion NAND driver comes from before the time of the
> standardised NAND binding. The controller only supports a single
> device, and expects the NAND partition table to be directly in the
> controller node. This goes against the standardised NAND binding which
> expects a sub node per NAND device, which contains the partition
> table.
> 
> Since the partition table contains a reg property indicating the start
> address of the partition and its length, it needs #size-cells set to
> 1. However, for a list of nand devices, the reg value is the device
> number, requiring #size-cells of 0.
> 
> Add an exception to nand-controller.yaml to allow this #size-cells
> value when the compatible matches the orion controller.
> 
> In order that the example works, it needs a compatible string so the
> comparison can be made. Pick the first example in the directory.
> 
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
>  .../bindings/mtd/nand-controller.yaml           | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mtd/nand-controller.example.dtb: nand-controller: 'reg' is a required property
	From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/mtd/arm,pl353-nand-r2p1.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

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.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mtd/nand-controller.yaml b/Documentation/devicetree/bindings/mtd/nand-controller.yaml
index 359a015d4e5a..e3bb97353793 100644
--- a/Documentation/devicetree/bindings/mtd/nand-controller.yaml
+++ b/Documentation/devicetree/bindings/mtd/nand-controller.yaml
@@ -34,7 +34,7 @@  properties:
     const: 1
 
   "#size-cells":
-    const: 0
+    enum: [0, 1]
 
   ranges: true
 
@@ -130,11 +130,26 @@  required:
   - "#address-cells"
   - "#size-cells"
 
+if:
+  properties:
+    compatible:
+      contains:
+        const: marvell,orion-nand
+then:
+  properties:
+    "#size-cells":
+      const: 1
+else:
+  properties:
+    "#size-cells":
+      const: 0
+
 additionalProperties: true
 
 examples:
   - |
     nand-controller {
+      compatible = "arm,pl353-nand-r2p1";
       #address-cells = <1>;
       #size-cells = <0>;
       cs-gpios = <0>, <&gpioA 1>; /* A single native CS is available */