8aded43526b23274aaed0a5e7f3f8d8bfc450e7a
[openwrt/staging/aparcar.git] /
1 From 04e9ab75267489224364fa510a88ada83e11c325 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Thu, 10 Dec 2020 18:23:52 +0100
4 Subject: [PATCH] dt-bindings: mtd: convert "fixed-partitions" to the
5 json-schema
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 This standardizes its documentation, allows validating with Makefile
11 checks and helps writing DTS files.
12
13 Noticeable changes:
14 1. Dropped "Partitions can be represented by sub-nodes of a flash
15 device." as we also support subpartitions (don't have to be part of
16 flash device node)
17 2. Dropped "to Linux" as bindings are meant to be os agnostic.
18
19 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
20 Link: https://lore.kernel.org/r/20201210172352.31632-1-zajec5@gmail.com
21 Signed-off-by: Rob Herring <robh@kernel.org>
22 ---
23 .../devicetree/bindings/mtd/partition.txt | 131 +--------------
24 .../mtd/partitions/fixed-partitions.yaml | 152 ++++++++++++++++++
25 2 files changed, 154 insertions(+), 129 deletions(-)
26 create mode 100644 Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml
27
28 --- a/Documentation/devicetree/bindings/mtd/partition.txt
29 +++ b/Documentation/devicetree/bindings/mtd/partition.txt
30 @@ -24,137 +24,10 @@ another partitioning method.
31 Available bindings are listed in the "partitions" subdirectory.
32
33
34 -Fixed Partitions
35 -================
36 -
37 -Partitions can be represented by sub-nodes of a flash device. This can be used
38 -on platforms which have strong conventions about which portions of a flash are
39 -used for what purposes, but which don't use an on-flash partition table such
40 -as RedBoot.
41 -
42 -The partition table should be a subnode of the flash node and should be named
43 -'partitions'. This node should have the following property:
44 -- compatible : (required) must be "fixed-partitions"
45 -Partitions are then defined in subnodes of the partitions node.
46 +Deprecated: partitions defined in flash node
47 +============================================
48
49 For backwards compatibility partitions as direct subnodes of the flash device are
50 supported. This use is discouraged.
51 NOTE: also for backwards compatibility, direct subnodes that have a compatible
52 string are not considered partitions, as they may be used for other bindings.
53 -
54 -#address-cells & #size-cells must both be present in the partitions subnode of the
55 -flash device. There are two valid values for both:
56 -<1>: for partitions that require a single 32-bit cell to represent their
57 - size/address (aka the value is below 4 GiB)
58 -<2>: for partitions that require two 32-bit cells to represent their
59 - size/address (aka the value is 4 GiB or greater).
60 -
61 -Required properties:
62 -- reg : The partition's offset and size within the flash
63 -
64 -Optional properties:
65 -- label : The label / name for this partition. If omitted, the label is taken
66 - from the node name (excluding the unit address).
67 -- read-only : This parameter, if present, is a hint to Linux that this
68 - partition should only be mounted read-only. This is usually used for flash
69 - partitions containing early-boot firmware images or data which should not be
70 - clobbered.
71 -- lock : Do not unlock the partition at initialization time (not supported on
72 - all devices)
73 -- slc-mode: This parameter, if present, allows one to emulate SLC mode on a
74 - partition attached to an MLC NAND thus making this partition immune to
75 - paired-pages corruptions
76 -
77 -Examples:
78 -
79 -
80 -flash@0 {
81 - partitions {
82 - compatible = "fixed-partitions";
83 - #address-cells = <1>;
84 - #size-cells = <1>;
85 -
86 - partition@0 {
87 - label = "u-boot";
88 - reg = <0x0000000 0x100000>;
89 - read-only;
90 - };
91 -
92 - uimage@100000 {
93 - reg = <0x0100000 0x200000>;
94 - };
95 - };
96 -};
97 -
98 -flash@1 {
99 - partitions {
100 - compatible = "fixed-partitions";
101 - #address-cells = <1>;
102 - #size-cells = <2>;
103 -
104 - /* a 4 GiB partition */
105 - partition@0 {
106 - label = "filesystem";
107 - reg = <0x00000000 0x1 0x00000000>;
108 - };
109 - };
110 -};
111 -
112 -flash@2 {
113 - partitions {
114 - compatible = "fixed-partitions";
115 - #address-cells = <2>;
116 - #size-cells = <2>;
117 -
118 - /* an 8 GiB partition */
119 - partition@0 {
120 - label = "filesystem #1";
121 - reg = <0x0 0x00000000 0x2 0x00000000>;
122 - };
123 -
124 - /* a 4 GiB partition */
125 - partition@200000000 {
126 - label = "filesystem #2";
127 - reg = <0x2 0x00000000 0x1 0x00000000>;
128 - };
129 - };
130 -};
131 -
132 -flash@3 {
133 - partitions {
134 - compatible = "fixed-partitions";
135 - #address-cells = <1>;
136 - #size-cells = <1>;
137 -
138 - partition@0 {
139 - label = "bootloader";
140 - reg = <0x000000 0x100000>;
141 - read-only;
142 - };
143 -
144 - firmware@100000 {
145 - label = "firmware";
146 - reg = <0x100000 0xe00000>;
147 - compatible = "brcm,trx";
148 - };
149 -
150 - calibration@f00000 {
151 - label = "calibration";
152 - reg = <0xf00000 0x100000>;
153 - compatible = "fixed-partitions";
154 - ranges = <0 0xf00000 0x100000>;
155 - #address-cells = <1>;
156 - #size-cells = <1>;
157 -
158 - partition@0 {
159 - label = "wifi0";
160 - reg = <0x000000 0x080000>;
161 - };
162 -
163 - partition@80000 {
164 - label = "wifi1";
165 - reg = <0x080000 0x080000>;
166 - };
167 - };
168 - };
169 -};
170 --- /dev/null
171 +++ b/Documentation/devicetree/bindings/mtd/partitions/fixed-partitions.yaml
172 @@ -0,0 +1,152 @@
173 +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
174 +%YAML 1.2
175 +---
176 +$id: http://devicetree.org/schemas/mtd/partitions/fixed-partitions.yaml#
177 +$schema: http://devicetree.org/meta-schemas/core.yaml#
178 +
179 +title: Fixed partitions
180 +
181 +description: |
182 + This binding can be used on platforms which have strong conventions about
183 + which portions of a flash are used for what purposes, but which don't use an
184 + on-flash partition table such as RedBoot.
185 +
186 + The partition table should be a node named "partitions". Partitions are then
187 + defined as subnodes.
188 +
189 +maintainers:
190 + - Rafał Miłecki <rafal@milecki.pl>
191 +
192 +properties:
193 + compatible:
194 + const: fixed-partitions
195 +
196 + "#address-cells": true
197 +
198 + "#size-cells": true
199 +
200 +patternProperties:
201 + "@[0-9a-f]+$":
202 + description: node describing a single flash partition
203 + type: object
204 +
205 + properties:
206 + reg:
207 + description: partition's offset and size within the flash
208 + maxItems: 1
209 +
210 + label:
211 + description: The label / name for this partition. If omitted, the label
212 + is taken from the node name (excluding the unit address).
213 +
214 + read-only:
215 + description: This parameter, if present, is a hint that this partition
216 + should only be mounted read-only. This is usually used for flash
217 + partitions containing early-boot firmware images or data which should
218 + not be clobbered.
219 + type: boolean
220 +
221 + lock:
222 + description: Do not unlock the partition at initialization time (not
223 + supported on all devices)
224 + type: boolean
225 +
226 + slc-mode:
227 + description: This parameter, if present, allows one to emulate SLC mode
228 + on a partition attached to an MLC NAND thus making this partition
229 + immune to paired-pages corruptions
230 + type: boolean
231 +
232 + required:
233 + - reg
234 +
235 +required:
236 + - "#address-cells"
237 + - "#size-cells"
238 +
239 +additionalProperties: true
240 +
241 +examples:
242 + - |
243 + partitions {
244 + compatible = "fixed-partitions";
245 + #address-cells = <1>;
246 + #size-cells = <1>;
247 +
248 + partition@0 {
249 + label = "u-boot";
250 + reg = <0x0000000 0x100000>;
251 + read-only;
252 + };
253 +
254 + uimage@100000 {
255 + reg = <0x0100000 0x200000>;
256 + };
257 + };
258 + - |
259 + partitions {
260 + compatible = "fixed-partitions";
261 + #address-cells = <1>;
262 + #size-cells = <2>;
263 +
264 + /* a 4 GiB partition */
265 + partition@0 {
266 + label = "filesystem";
267 + reg = <0x00000000 0x1 0x00000000>;
268 + };
269 + };
270 + - |
271 + partitions {
272 + compatible = "fixed-partitions";
273 + #address-cells = <2>;
274 + #size-cells = <2>;
275 +
276 + /* an 8 GiB partition */
277 + partition@0 {
278 + label = "filesystem #1";
279 + reg = <0x0 0x00000000 0x2 0x00000000>;
280 + };
281 +
282 + /* a 4 GiB partition */
283 + partition@200000000 {
284 + label = "filesystem #2";
285 + reg = <0x2 0x00000000 0x1 0x00000000>;
286 + };
287 + };
288 + - |
289 + partitions {
290 + compatible = "fixed-partitions";
291 + #address-cells = <1>;
292 + #size-cells = <1>;
293 +
294 + partition@0 {
295 + label = "bootloader";
296 + reg = <0x000000 0x100000>;
297 + read-only;
298 + };
299 +
300 + firmware@100000 {
301 + compatible = "brcm,trx";
302 + label = "firmware";
303 + reg = <0x100000 0xe00000>;
304 + };
305 +
306 + calibration@f00000 {
307 + compatible = "fixed-partitions";
308 + label = "calibration";
309 + reg = <0xf00000 0x100000>;
310 + ranges = <0 0xf00000 0x100000>;
311 + #address-cells = <1>;
312 + #size-cells = <1>;
313 +
314 + partition@0 {
315 + label = "wifi0";
316 + reg = <0x000000 0x080000>;
317 + };
318 +
319 + partition@80000 {
320 + label = "wifi1";
321 + reg = <0x080000 0x080000>;
322 + };
323 + };
324 + };