[PATCH v2 0/2] dt-bindings: mtd: partitions: Export special values
Edward Chow
equu at openmail.cc
Fri Oct 27 02:46:08 PDT 2023
There are special "offset" and "size" values defined and documented in
linux/mtd/partitions.h:
/* consume as much as possible, leaving size after the end of partition. */
#define MTDPART_OFS_RETAIN (uint64_t)(-3)
/* the partition will start at the next erase block. */
#define MTDPART_OFS_NXTBLK (uint64_t)(-2)
/* the partition will start where the previous one ended. */
#define MTDPART_OFS_APPEND (uint64_t)(-1)
(Though not explicitly, they are compared against variables in uint64_t
in drivers/mtd/mtdpart.c, so they had better be considered as such.)
/* the partition will extend to the end of the master MTD device. */
#define MTDPART_SIZ_FULL (0)
These special values could be used to define partitions automatically
fitting to the size of the master MTD device at runtime.
However, these values used not to be exported to dt-bindings, thus
seldom used before, since they might have been only used in numeric form,
such as "(-1) (-3)" for MTDPART_OFS_RETAIN.
Now, they are exported in dt-bindings/mtd/partitions.h as 32-bit cell
values, so 2-cell addressed should be defined to use special offset values,
such as "MTDPART_OFS_SPECIAL MTDPART_OFS_RETAIN" for MTDPART_OFS_RETAIN in
linux/mtd/partitions.h. An example is added to fixed-partitions.yaml.
Edward Chow (2):
dt-bindings: mtd: partitions: Export special values
dt-bindings: mtd: partitions: Document special values
.../mtd/partitions/fixed-partitions.yaml | 30 +++++++++++++++++++
MAINTAINERS | 2 ++
include/dt-bindings/mtd/partitions.h | 15 ++++++++++
3 files changed, 47 insertions(+)
create mode 100644 include/dt-bindings/mtd/partitions.h
--
2.42.0
More information about the linux-mtd
mailing list