[RFC PATCH v2 4/5] dt-bindings: block: Generalize and introduce property for partitions

Christian Marangi ansuelsmth at gmail.com
Wed Sep 25 14:45:24 PDT 2024


Generalize property from MTD partitions schema and introduce property for
block partitions defined in OF.

Partition schema for block devices is a reduced schema of the MTD as
only a few property are supported for it. (reg, label and read-only)

Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 .../bindings/block/partitions/partition.yaml  | 33 +++++++++++++++++++
 .../bindings/block/partitions/partitions.yaml | 27 +++++++++++++++
 .../bindings/mtd/partitions/partition.yaml    | 10 ++----
 3 files changed, 62 insertions(+), 8 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/block/partitions/partition.yaml
 create mode 100644 Documentation/devicetree/bindings/block/partitions/partitions.yaml

diff --git a/Documentation/devicetree/bindings/block/partitions/partition.yaml b/Documentation/devicetree/bindings/block/partitions/partition.yaml
new file mode 100644
index 000000000000..b9b1d8139e56
--- /dev/null
+++ b/Documentation/devicetree/bindings/block/partitions/partition.yaml
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/partitions/partition.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Partition
+
+description: |
+  This binding describes a single flash partition. Each partition must have its
+  relative offset and size specified. Depending on partition function extra
+  properties can be used.
+
+maintainers:
+  - Christian Marangi <ansuelsmth at gmail.com>
+
+properties:
+  reg:
+    description: partition's offset and size within the flash (in sector
+      block, 512byte)
+    maxItems: 1
+
+  label:
+    description: The label / name for this partition.
+
+  read-only:
+    description: This parameter, if present, is a hint that this partition
+      should only be mounted read-only. This is usually used for flash
+      partitions containing early-boot firmware images or data which should
+      not be clobbered.
+    type: boolean
+
+additionalProperties: true
diff --git a/Documentation/devicetree/bindings/block/partitions/partitions.yaml b/Documentation/devicetree/bindings/block/partitions/partitions.yaml
new file mode 100644
index 000000000000..9c161aac364d
--- /dev/null
+++ b/Documentation/devicetree/bindings/block/partitions/partitions.yaml
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/block/partitions/partitions.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Partitions
+
+description: |
+  This binding is generic and describes the content of the partitions container
+  node.
+
+maintainers:
+  - Christian Marangi <ansuelsmth at gmail.com>
+
+properties:
+  '#address-cells':
+    enum: [1, 2]
+
+  '#size-cells':
+    enum: [1, 2]
+
+patternProperties:
+  "^partition@[0-9a-f]+$":
+    $ref: partition.yaml
+
+unevaluatedProperties: false
diff --git a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml
index 80d0452a2a33..e822d3219b68 100644
--- a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml
+++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml
@@ -6,6 +6,8 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Partition
 
+$ref: /schemas/block/partitions/partition.yaml
+
 description: |
   This binding describes a single flash partition. Each partition must have its
   relative offset and size specified. Depending on partition function extra
@@ -28,19 +30,11 @@ maintainers:
 properties:
   reg:
     description: partition's offset and size within the flash
-    maxItems: 1
 
   label:
     description: The label / name for this partition. If omitted, the label
       is taken from the node name (excluding the unit address).
 
-  read-only:
-    description: This parameter, if present, is a hint that this partition
-      should only be mounted read-only. This is usually used for flash
-      partitions containing early-boot firmware images or data which should
-      not be clobbered.
-    type: boolean
-
   lock:
     description: Do not unlock the partition at initialization time (not
       supported on all devices)
-- 
2.45.2




More information about the linux-mtd mailing list