All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: add of_node in partition parser
@ 2016-06-18 19:16 Hauke Mehrtens
  2016-07-14 23:39 ` Moritz Fischer
  0 siblings, 1 reply; 2+ messages in thread
From: Hauke Mehrtens @ 2016-06-18 19:16 UTC (permalink / raw)
  To: dwmw2, computersforpeace; +Cc: linux-mtd, Hauke Mehrtens

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(+)

diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 1f13e32..2f557ab 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -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;
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index ede407d..de7d66d 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -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++;
 	}
 
diff --git a/include/linux/mtd/partitions.h b/include/linux/mtd/partitions.h
index 70736e1..b97315e 100644
--- a/include/linux/mtd/partitions.h
+++ b/include/linux/mtd/partitions.h
@@ -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)
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mtd: add of_node in partition parser
  2016-06-18 19:16 [PATCH] mtd: add of_node in partition parser Hauke Mehrtens
@ 2016-07-14 23:39 ` Moritz Fischer
  0 siblings, 0 replies; 2+ messages in thread
From: Moritz Fischer @ 2016-07-14 23:39 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: David Woodhouse, Brian Norris, linux-mtd

Hi Hauke,

I sent a similar patch some time ago:

https://lkml.org/lkml/2016/5/24/732

David, Brian? Can either of you take this? Apparently I wouldn't be
the only user with Hauke asking for the same ;-)

Moritz

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-14 23:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-18 19:16 [PATCH] mtd: add of_node in partition parser Hauke Mehrtens
2016-07-14 23:39 ` Moritz Fischer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.