xref: /linux/Documentation/devicetree/bindings/mtd/partitions/partition.yaml (revision 53597deca0e38c30e6cd4ba2114fa42d2bcd85bb)
1# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/mtd/partitions/partition.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Partition
8
9description: |
10  This binding describes a single flash partition. Each partition must have its
11  relative offset and size specified. Depending on partition function extra
12  properties can be used.
13
14  A partition may be dynamically allocated by a specific parser at runtime.
15  In this specific case, a specific suffix is required to the node name.
16  Everything after 'partition-' will be used as the partition name to compare
17  with the one dynamically allocated by the specific parser.
18  If the partition contains invalid char a label can be provided that will
19  be used instead of the node name to make the comparison.
20  This is used to assign an OF node to the dynamiccally allocated partition
21  so that subsystem like NVMEM can provide an OF node and declare NVMEM cells.
22  The OF node will be assigned only if the partition label declared match the
23  one assigned by the parser at runtime.
24
25maintainers:
26  - Rafał Miłecki <rafal@milecki.pl>
27
28properties:
29  reg:
30    description: partition's offset and size within the flash
31    maxItems: 1
32
33  label:
34    description: The label / name for this partition. If omitted, the label
35      is taken from the node name (excluding the unit address).
36
37  read-only:
38    description: This parameter, if present, is a hint that this partition
39      should only be mounted read-only. This is usually used for flash
40      partitions containing early-boot firmware images or data which should
41      not be clobbered.
42    type: boolean
43
44  lock:
45    description: Do not unlock the partition at initialization time (not
46      supported on all devices)
47    type: boolean
48
49  slc-mode:
50    description: This parameter, if present, allows one to emulate SLC mode
51      on a partition attached to an MLC NAND thus making this partition
52      immune to paired-pages corruptions
53    type: boolean
54
55  linux,rootfs:
56    description: Marks partition that contains root filesystem to mount and boot
57      user space from
58    type: boolean
59
60  part-concat-next:
61    description: List of phandles to MTD partitions that need be concatenated
62      with the current partition.
63    $ref: /schemas/types.yaml#/definitions/phandle-array
64    minItems: 1
65    maxItems: 16
66    items:
67      maxItems: 1
68
69  align:
70    $ref: /schemas/types.yaml#/definitions/uint32
71    minimum: 2
72    maximum: 0x80000000
73    multipleOf: 2
74    description:
75      This sets the alignment of the entry in bytes.
76
77      The entry offset is adjusted so that the entry starts on an aligned
78      boundary within the containing section or image. For example ‘align =
79      <16>’ means that the entry will start on a 16-byte boundary. This may
80      mean that padding is added before the entry. The padding is part of
81      the containing section but is not included in the entry, meaning that
82      an empty space may be created before the entry starts. Alignment
83      must be a power of 2. If ‘align’ is not provided, no alignment is
84      performed.
85
86  align-size:
87    $ref: /schemas/types.yaml#/definitions/uint32
88    minimum: 2
89    maximum: 0x80000000
90    multipleOf: 2
91    description:
92      This sets the alignment of the entry size in bytes. It must be a power
93      of 2.
94
95      For example, to ensure that the size of an entry is a multiple of 64
96      bytes, set this to 64. While this does not affect the content of the
97      entry itself (the padding is performed only when its parent section is
98      assembled), the end result is that the entry ends with the padding
99      bytes, so may grow. If ‘align-size’ is not provided, no alignment is
100      performed.
101
102  align-end:
103    $ref: /schemas/types.yaml#/definitions/uint32
104    minimum: 2
105    maximum: 0x80000000
106    multipleOf: 2
107    description:
108      This sets the alignment (in bytes) of the end of an entry with respect
109      to the containing section. It must be a power of 2.
110
111      Some entries require that they end on an alignment boundary,
112      regardless of where they start. This does not move the start of the
113      entry, so the content of the entry will still start at the beginning.
114      But there may be padding at the end. While this does not affect the
115      content of the entry itself (the padding is performed only when its
116      parent section is assembled), the end result is that the entry ends
117      with the padding bytes, so may grow. If ‘align-end’ is not provided,
118      no alignment is performed.
119
120  compression:
121    $ref: /schemas/types.yaml#/definitions/string
122    description: |
123      Compression algorithm used to store the data in this partition, chosen
124      from a list of well-known algorithms.
125
126      The contents are compressed using this algorithm.
127
128    enum:
129      - none
130      - bzip2
131      - gzip
132      - lzop
133      - lz4
134      - lzma
135      - xz
136      - zstd
137
138  sercomm,scpart-id:
139    description: Partition id in Sercomm partition map. Mtd parser
140      uses this id to find a record in the partition map containing
141      offset and size of the current partition. The values from
142      partition map overrides partition offset and size defined in
143      reg property of the dts. Frequently these values are the same,
144      but may differ if device has bad eraseblocks on a flash.
145    $ref: /schemas/types.yaml#/definitions/uint32
146
147  nvmem-layout:
148    $ref: /schemas/nvmem/layouts/nvmem-layout.yaml
149
150if:
151  not:
152    required: [ reg ]
153then:
154  properties:
155    $nodename:
156      pattern: '^partitions?(-.+)?$'
157
158# This is a generic file other binding inherit from and extend
159additionalProperties: true
160
161$defs:
162  partition-node:
163    type: object
164    if:
165      not:
166        required: [ compatible ]
167    then:
168      $ref: '#'
169      unevaluatedProperties: false
170    else:
171      $ref: '#'
172
173examples:
174  - |
175    partitions {
176        compatible = "fixed-partitions";
177        #address-cells = <1>;
178        #size-cells = <1>;
179
180        partition@100000 {
181            compatible = "u-boot";
182            reg = <0x100000 0xf00000>;
183            align-size = <0x1000>;
184            align-end = <0x10000>;
185        };
186
187        partition@200000 {
188            compatible = "tfa-bl31";
189            reg = <0x200000 0x100000>;
190            align = <0x4000>;
191        };
192
193        part0: partition@400000 {
194            part-concat-next = <&part1>;
195            label = "part0_0";
196            reg = <0x400000 0x100000>;
197        };
198
199        part1: partition@800000 {
200            label = "part0_1";
201            reg = <0x800000 0x800000>;
202        };
203    };
204