Jamie Lentin | 83619ea | 2012-03-27 22:54:15 +0100 | [diff] [blame] | 1 | Representing flash partitions in devicetree |
| 2 | |
| 3 | Partitions can be represented by sub-nodes of an mtd device. This can be used |
| 4 | on platforms which have strong conventions about which portions of a flash are |
| 5 | used for what purposes, but which don't use an on-flash partition table such |
| 6 | as RedBoot. |
| 7 | |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 8 | The partition table should be a subnode of the mtd node and should be named |
Brian Norris | e488ca9 | 2015-12-03 14:47:32 -0800 | [diff] [blame] | 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. |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 12 | |
| 13 | For backwards compatibility partitions as direct subnodes of the mtd device are |
| 14 | supported. This use is discouraged. |
| 15 | NOTE: also for backwards compatibility, direct subnodes that have a compatible |
| 16 | string are not considered partitions, as they may be used for other bindings. |
| 17 | |
| 18 | #address-cells & #size-cells must both be present in the partitions subnode of the |
| 19 | mtd device. There are two valid values for both: |
Joe Schaack | 05ff8c2 | 2013-02-21 16:29:45 -0600 | [diff] [blame] | 20 | <1>: for partitions that require a single 32-bit cell to represent their |
| 21 | size/address (aka the value is below 4 GiB) |
| 22 | <2>: for partitions that require two 32-bit cells to represent their |
| 23 | size/address (aka the value is 4 GiB or greater). |
Jamie Lentin | 83619ea | 2012-03-27 22:54:15 +0100 | [diff] [blame] | 24 | |
| 25 | Required properties: |
| 26 | - reg : The partition's offset and size within the mtd bank. |
| 27 | |
| 28 | Optional properties: |
| 29 | - label : The label / name for this partition. If omitted, the label is taken |
| 30 | from the node name (excluding the unit address). |
| 31 | - read-only : This parameter, if present, is a hint to Linux that this |
| 32 | partition should only be mounted read-only. This is usually used for flash |
| 33 | partitions containing early-boot firmware images or data which should not be |
| 34 | clobbered. |
Michal Suchanek | 89a41cb | 2015-10-30 13:34:00 -0700 | [diff] [blame] | 35 | - lock : Do not unlock the partition at initialization time (not supported on |
| 36 | all devices) |
Jamie Lentin | 83619ea | 2012-03-27 22:54:15 +0100 | [diff] [blame] | 37 | |
| 38 | Examples: |
| 39 | |
| 40 | |
| 41 | flash@0 { |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 42 | partitions { |
Brian Norris | e488ca9 | 2015-12-03 14:47:32 -0800 | [diff] [blame] | 43 | compatible = "fixed-partitions"; |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 44 | #address-cells = <1>; |
| 45 | #size-cells = <1>; |
Jamie Lentin | 83619ea | 2012-03-27 22:54:15 +0100 | [diff] [blame] | 46 | |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 47 | partition@0 { |
| 48 | label = "u-boot"; |
| 49 | reg = <0x0000000 0x100000>; |
| 50 | read-only; |
| 51 | }; |
Jamie Lentin | 83619ea | 2012-03-27 22:54:15 +0100 | [diff] [blame] | 52 | |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 53 | uimage@100000 { |
| 54 | reg = <0x0100000 0x200000>; |
| 55 | }; |
Jamie Lentin | 83619ea | 2012-03-27 22:54:15 +0100 | [diff] [blame] | 56 | }; |
Rob Herring | bf6c9734 | 2012-07-06 07:16:14 -0500 | [diff] [blame] | 57 | }; |
Joe Schaack | 05ff8c2 | 2013-02-21 16:29:45 -0600 | [diff] [blame] | 58 | |
| 59 | flash@1 { |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 60 | partitions { |
Brian Norris | e488ca9 | 2015-12-03 14:47:32 -0800 | [diff] [blame] | 61 | compatible = "fixed-partitions"; |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 62 | #address-cells = <1>; |
| 63 | #size-cells = <2>; |
Joe Schaack | 05ff8c2 | 2013-02-21 16:29:45 -0600 | [diff] [blame] | 64 | |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 65 | /* a 4 GiB partition */ |
| 66 | partition@0 { |
| 67 | label = "filesystem"; |
| 68 | reg = <0x00000000 0x1 0x00000000>; |
| 69 | }; |
Joe Schaack | 05ff8c2 | 2013-02-21 16:29:45 -0600 | [diff] [blame] | 70 | }; |
| 71 | }; |
| 72 | |
| 73 | flash@2 { |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 74 | partitions { |
Brian Norris | e488ca9 | 2015-12-03 14:47:32 -0800 | [diff] [blame] | 75 | compatible = "fixed-partitions"; |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 76 | #address-cells = <2>; |
| 77 | #size-cells = <2>; |
Joe Schaack | 05ff8c2 | 2013-02-21 16:29:45 -0600 | [diff] [blame] | 78 | |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 79 | /* an 8 GiB partition */ |
| 80 | partition@0 { |
| 81 | label = "filesystem #1"; |
| 82 | reg = <0x0 0x00000000 0x2 0x00000000>; |
| 83 | }; |
Joe Schaack | 05ff8c2 | 2013-02-21 16:29:45 -0600 | [diff] [blame] | 84 | |
Michal Suchanek | fe2585e | 2015-10-28 15:48:06 -0700 | [diff] [blame] | 85 | /* a 4 GiB partition */ |
| 86 | partition@200000000 { |
| 87 | label = "filesystem #2"; |
| 88 | reg = <0x2 0x00000000 0x1 0x00000000>; |
| 89 | }; |
Joe Schaack | 05ff8c2 | 2013-02-21 16:29:45 -0600 | [diff] [blame] | 90 | }; |
| 91 | }; |