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

Rob Herring robh at kernel.org
Thu Sep 26 07:03:51 PDT 2024


On Wed, Sep 25, 2024 at 11:45:24PM +0200, Christian Marangi wrote:
> 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

Partitions are partitions. We don't need them defined in both mtd and 
block. Could perhaps move them to bindings/partitions/, but that's not 
really worth it in my opinion. Just use and add to what's in mtd.

> 
> 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: |

Don't need '|' if no formatting.

> +  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]


Like *all* other 'partitions' nodes, you need a compatible to say what 
kind of partitions you have. It's conceivable that some vendor invented 
their own scheme just like MTD devices.

As I said before, this is just 'fixed-partitions'. If some properties 
aren't supported, that's fine. All the 'align' properties are for 
flashing tools and aren't supported in Linux. 

Rob



More information about the linux-mtd mailing list