401-v5.11-dt-bindings-mtd-convert-fixed-partitions-to-the-json.patch 9.0 KB

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