1Flash partitions in device tree 2=============================== 3 4Flash devices can be partitioned into one or more functional ranges (e.g. "boot 5code", "nvram", "kernel"). 6 7Different devices may be partitioned in a different ways. Some may use a fixed 8flash layout set at production time. Some may use on-flash table that describes 9the geometry and naming/purpose of each functional region. It is also possible 10to see these methods mixed. 11 12To assist system software in locating partitions, we allow describing which 13method is used for a given flash device. To describe the method there should be 14a subnode of the flash device that is named 'partitions'. It must have a 15'compatible' property, which is used to identify the method to use. 16 17When a single partition is represented with a DT node (it depends on a used 18format) it may also be described using above rules ('compatible' and optionally 19some extra properties / subnodes). It allows describing more complex, 20hierarchical (multi-level) layouts and should be used if there is some 21significant relation between partitions or some partition internally uses 22another partitioning method. 23 24Available bindings are listed in the "partitions" subdirectory. 25 26 27Fixed Partitions 28================ 29 30Partitions can be represented by sub-nodes of a flash device. This can be used 31on platforms which have strong conventions about which portions of a flash are 32used for what purposes, but which don't use an on-flash partition table such 33as RedBoot. 34 35The partition table should be a subnode of the flash node and should be named 36'partitions'. This node should have the following property: 37- compatible : (required) must be "fixed-partitions" 38Partitions are then defined in subnodes of the partitions node. 39 40For backwards compatibility partitions as direct subnodes of the flash device are 41supported. This use is discouraged. 42NOTE: also for backwards compatibility, direct subnodes that have a compatible 43string are not considered partitions, as they may be used for other bindings. 44 45#address-cells & #size-cells must both be present in the partitions subnode of the 46flash device. There are two valid values for both: 47<1>: for partitions that require a single 32-bit cell to represent their 48 size/address (aka the value is below 4 GiB) 49<2>: for partitions that require two 32-bit cells to represent their 50 size/address (aka the value is 4 GiB or greater). 51 52Required properties: 53- reg : The partition's offset and size within the flash 54 55Optional properties: 56- label : The label / name for this partition. If omitted, the label is taken 57 from the node name (excluding the unit address). 58- read-only : This parameter, if present, is a hint to Linux that this 59 partition should only be mounted read-only. This is usually used for flash 60 partitions containing early-boot firmware images or data which should not be 61 clobbered. 62- lock : Do not unlock the partition at initialization time (not supported on 63 all devices) 64- slc-mode: This parameter, if present, allows one to emulate SLC mode on a 65 partition attached to an MLC NAND thus making this partition immune to 66 paired-pages corruptions 67 68Examples: 69 70 71flash@0 { 72 partitions { 73 compatible = "fixed-partitions"; 74 #address-cells = <1>; 75 #size-cells = <1>; 76 77 partition@0 { 78 label = "u-boot"; 79 reg = <0x0000000 0x100000>; 80 read-only; 81 }; 82 83 uimage@100000 { 84 reg = <0x0100000 0x200000>; 85 }; 86 }; 87}; 88 89flash@1 { 90 partitions { 91 compatible = "fixed-partitions"; 92 #address-cells = <1>; 93 #size-cells = <2>; 94 95 /* a 4 GiB partition */ 96 partition@0 { 97 label = "filesystem"; 98 reg = <0x00000000 0x1 0x00000000>; 99 }; 100 }; 101}; 102 103flash@2 { 104 partitions { 105 compatible = "fixed-partitions"; 106 #address-cells = <2>; 107 #size-cells = <2>; 108 109 /* an 8 GiB partition */ 110 partition@0 { 111 label = "filesystem #1"; 112 reg = <0x0 0x00000000 0x2 0x00000000>; 113 }; 114 115 /* a 4 GiB partition */ 116 partition@200000000 { 117 label = "filesystem #2"; 118 reg = <0x2 0x00000000 0x1 0x00000000>; 119 }; 120 }; 121}; 122 123flash@3 { 124 partitions { 125 compatible = "fixed-partitions"; 126 #address-cells = <1>; 127 #size-cells = <1>; 128 129 partition@0 { 130 label = "bootloader"; 131 reg = <0x000000 0x100000>; 132 read-only; 133 }; 134 135 firmware@100000 { 136 label = "firmware"; 137 reg = <0x100000 0xe00000>; 138 compatible = "brcm,trx"; 139 }; 140 141 calibration@f00000 { 142 label = "calibration"; 143 reg = <0xf00000 0x100000>; 144 compatible = "fixed-partitions"; 145 ranges = <0 0xf00000 0x100000>; 146 #address-cells = <1>; 147 #size-cells = <1>; 148 149 partition@0 { 150 label = "wifi0"; 151 reg = <0x000000 0x080000>; 152 }; 153 154 partition@80000 { 155 label = "wifi1"; 156 reg = <0x080000 0x080000>; 157 }; 158 }; 159 }; 160}; 161