devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Gregory Clement <gregory.clement@bootlin.com>
Cc: arm-soc <arm@kernel.org>,
	Device Tree <devicetree@vger.kernel.org>,
	Andrew Lunn <andrew@lunn.ch>
Subject: [PATCH 07/11] DT: nand-controller: Reflect reality of marvell,orion-nand
Date: Sat, 20 Aug 2022 21:48:00 +0200	[thread overview]
Message-ID: <20220820194804.3352415-8-andrew@lunn.ch> (raw)
In-Reply-To: <20220820194804.3352415-1-andrew@lunn.ch>

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.

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

diff --git a/Documentation/devicetree/bindings/mtd/nand-controller.yaml b/Documentation/devicetree/bindings/mtd/nand-controller.yaml
index 359a015d4e5a..ab90e34557ad 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 = "bar";
       #address-cells = <1>;
       #size-cells = <0>;
       cs-gpios = <0>, <&gpioA 1>; /* A single native CS is available */
-- 
2.37.2


  parent reply	other threads:[~2022-08-20 19:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-20 19:47 [PATCH 00/11] Start converting MVEBU bindings to YAML Andrew Lunn
2022-08-20 19:47 ` [PATCH 01/11] DT: RTC: orion-rtc: Convert " Andrew Lunn
2022-08-22 20:49   ` Rob Herring
2022-08-22 20:55   ` Rob Herring
2022-08-20 19:47 ` [PATCH 02/11] DT: thermal: marvell,kirkwood-thermal: " Andrew Lunn
2022-08-20 19:47 ` [PATCH 03/11] DT: pinctrl: Convert marvell,kirkwood-pintctrl " Andrew Lunn
2022-08-22 21:16   ` Rob Herring
2022-08-20 19:47 ` [PATCH 04/11] DT: USB: Convert ehci-orion " Andrew Lunn
2022-08-21 20:21   ` Rob Herring
2022-08-20 19:47 ` [PATCH 05/11] DT: watchdog: Convert marvel.txt " Andrew Lunn
2022-08-21 20:21   ` Rob Herring
2022-08-22  0:20     ` Andrew Lunn
2022-08-22 13:47       ` Rob Herring
2022-08-20 19:47 ` [PATCH 06/11] arm: DT: kirkwood/orion5: Rename watchdog node Andrew Lunn
2022-08-20 19:48 ` Andrew Lunn [this message]
2022-08-21 20:21   ` [PATCH 07/11] DT: nand-controller: Reflect reality of marvell,orion-nand Rob Herring
2022-08-20 19:48 ` [PATCH 08/11] DT: mtd: Convert orion-nand to YAML Andrew Lunn
2022-08-21 20:21   ` Rob Herring
2022-08-22  0:48     ` Andrew Lunn
2022-08-22 13:43       ` Rob Herring
2022-08-20 19:48 ` [PATCH 09/11] arm: DT: kirkwood.dtsi: Rename nand to nand-controller Andrew Lunn
2022-08-20 19:48 ` [PATCH 10/11] DT: timer: Convert marvell,orion-timer.txt to YAML Andrew Lunn
2022-08-20 19:48 ` [PATCH 11/11] DT: clock: Convert mvebu-gated-clock.txt " Andrew Lunn
2022-08-22 13:49 ` [PATCH 00/11] Start converting MVEBU bindings " Rob Herring
2022-08-22 13:53 ` Rob Herring
2022-08-22 14:28   ` Andrew Lunn
2022-08-30 18:58     ` Rob Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220820194804.3352415-8-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=arm@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).