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