Skip to content

Commit e488ca9

Browse files
doc: dt: mtd: partitions: add compatible property to "partitions" node
As noted here [1], there are potentially future conflicts if we try to use MTD's "partitions" subnode to describe anything besides just the fixed-in-the-device-tree partitions currently described in this document. Particularly, there was a proposal to use this node for the AFS parser too. It can pose a (small) problem to try to differentiate the following nodes: // using binding as currently specified partitions { #address-cells = <x>; #size-cells = <y>; partition@0 { ...; }; }; and // proposed future binding partitions { compatible = "arm,arm-flash-structure"; }; It's especially difficult if other uses of this node start having subnodes. So, since the "partitions" node is new in v4.4, let's fixup the binding before release so that it requires a compatible property, so it's much clearer to distinguish. e.g.: // proposed partitions { compatible = "fixed-partitions"; #address-cells = <x>; #size-cells = <y>; partition@0 { ...; }; }; [1] Subject: "mtd: create a partition type device tree binding" http://lkml.kernel.org/g/20151113220039.GA74382@google.com http://lists.infradead.org/pipermail/linux-mtd/2015-November/063355.html http://lists.infradead.org/pipermail/linux-mtd/2015-November/063364.html Cc: Michal Suchanek <hramrach@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Acked-by: Rob Herring <robh@kernel.org>
1 parent 8c62b4e commit e488ca9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Documentation/devicetree/bindings/mtd/partition.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ used for what purposes, but which don't use an on-flash partition table such
66
as RedBoot.
77

88
The partition table should be a subnode of the mtd node and should be named
9-
'partitions'. Partitions are defined in subnodes of the partitions node.
9+
'partitions'. This node should have the following property:
10+
- compatible : (required) must be "fixed-partitions"
11+
Partitions are then defined in subnodes of the partitions node.
1012

1113
For backwards compatibility partitions as direct subnodes of the mtd device are
1214
supported. This use is discouraged.
@@ -36,6 +38,7 @@ Examples:
3638

3739
flash@0 {
3840
partitions {
41+
compatible = "fixed-partitions";
3942
#address-cells = <1>;
4043
#size-cells = <1>;
4144

@@ -53,6 +56,7 @@ flash@0 {
5356

5457
flash@1 {
5558
partitions {
59+
compatible = "fixed-partitions";
5660
#address-cells = <1>;
5761
#size-cells = <2>;
5862

@@ -66,6 +70,7 @@ flash@1 {
6670

6771
flash@2 {
6872
partitions {
73+
compatible = "fixed-partitions";
6974
#address-cells = <2>;
7075
#size-cells = <2>;
7176

drivers/mtd/ofpart.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ static int parse_ofpart_partitions(struct mtd_info *master,
5555
master->name, mtd_node->full_name);
5656
ofpart_node = mtd_node;
5757
dedicated = false;
58+
} else if (!of_device_is_compatible(ofpart_node, "fixed-partitions")) {
59+
/* The 'partitions' subnode might be used by another parser */
60+
return 0;
5861
}
5962

6063
/* First count the subnodes */

0 commit comments

Comments
 (0)