@@ -412,6 +412,7 @@ static struct mtd_part *allocate_partition(struct mtd_info *master,
slave->mtd.dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) ?
&master->dev :
master->dev.parent;
+ slave->mtd.dev.of_node = part->of_node;
slave->mtd._read = part_read;
slave->mtd._write = part_write;
@@ -120,6 +120,8 @@ static int parse_ofpart_partitions(struct mtd_info *master,
if (of_get_property(pp, "lock", &len))
parts[i].mask_flags |= MTD_POWERUP_LOCK;
+ parts[i].of_node = pp;
+
i++;
}
@@ -41,6 +41,7 @@ struct mtd_partition {
uint64_t size; /* partition size */
uint64_t offset; /* offset within the master MTD space */
uint32_t mask_flags; /* master MTD flags to mask out for this partition */
+ struct device_node *of_node; /* device tree node of this partition */
};
#define MTDPART_OFS_RETAIN (-3)
This adds the of_node to each partition when it was defined in device tree. This makes it possible to define additional attributes at each partition for example which file system or other layer to use. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> --- drivers/mtd/mtdpart.c | 1 + drivers/mtd/ofpart.c | 2 ++ include/linux/mtd/partitions.h | 1 + 3 files changed, 4 insertions(+)