mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] of: partition: set device_node of the newly created partition
@ 2014-04-28  9:31 Sascha Hauer
  2014-04-28  9:31 ` [PATCH 2/3] of: move of_find_device_by_node_path to drivers/of/of_path.c Sascha Hauer
  2014-04-28  9:31 ` [PATCH 3/3] of_path: Allow to specify path with phandle only Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2014-04-28  9:31 UTC (permalink / raw)
  To: barebox

So that we can find the devicenode for a partition.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/partition.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index 5ed44a8..0560eb3 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -60,6 +60,8 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
 	filename = asprintf("%s.%s", cdev->name, partname);
 
 	new = devfs_add_partition(cdev->name, offset, size, flags, filename);
+	if (new && new->dev)
+		new->dev->device_node = node;
 
 	if (cdev->mtd && cdev->mtd->type == MTD_NANDFLASH)
 		dev_add_bb_dev(filename, NULL);
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/3] of: move of_find_device_by_node_path to drivers/of/of_path.c
  2014-04-28  9:31 [PATCH 1/3] of: partition: set device_node of the newly created partition Sascha Hauer
@ 2014-04-28  9:31 ` Sascha Hauer
  2014-04-28  9:31 ` [PATCH 3/3] of_path: Allow to specify path with phandle only Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2014-04-28  9:31 UTC (permalink / raw)
  To: barebox

As it's generic helper function which should not stay in driver
specific code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/barebox.c | 14 --------------
 drivers/of/of_path.c | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/of/barebox.c b/drivers/of/barebox.c
index 44ec820..92471f8 100644
--- a/drivers/of/barebox.c
+++ b/drivers/of/barebox.c
@@ -34,20 +34,6 @@ struct of_partition {
 
 static LIST_HEAD(of_partition_list);
 
-struct device_d *of_find_device_by_node_path(const char *path)
-{
-	struct device_d *dev;
-
-	for_each_device(dev) {
-		if (!dev->device_node)
-			continue;
-		if (!strcmp(path, dev->device_node->full_name))
-			return dev;
-	}
-
-	return NULL;
-}
-
 static int environment_probe(struct device_d *dev)
 {
 	char *path;
diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index ab8618e..20eb771 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -31,6 +31,20 @@ struct of_path_type {
 	int (*parse)(struct of_path *op, const char *str);
 };
 
+struct device_d *of_find_device_by_node_path(const char *path)
+{
+	struct device_d *dev;
+
+	for_each_device(dev) {
+		if (!dev->device_node)
+			continue;
+		if (!strcmp(path, dev->device_node->full_name))
+			return dev;
+	}
+
+	return NULL;
+}
+
 /**
  * of_path_type_partname - find a partition based on physical device and
  *                         partition name
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/3] of_path: Allow to specify path with phandle only
  2014-04-28  9:31 [PATCH 1/3] of: partition: set device_node of the newly created partition Sascha Hauer
  2014-04-28  9:31 ` [PATCH 2/3] of: move of_find_device_by_node_path to drivers/of/of_path.c Sascha Hauer
@ 2014-04-28  9:31 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2014-04-28  9:31 UTC (permalink / raw)
  To: barebox

Instead of just allowing to specify an OF path with additional
partname: property allow to specify a phandle to the partition
directly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/of_path.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index 20eb771..6a2d634 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -148,6 +148,9 @@ int of_find_path(struct device_node *node, const char *propname, char **outpath)
 
 	device_detect(op.dev);
 
+	if (list_is_singular(&op.dev->cdevs))
+		op.cdev = list_first_entry(&op.dev->cdevs, struct cdev, devices_list);
+
 	i = 1;
 
 	while (1) {
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2014-04-28  9:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-28  9:31 [PATCH 1/3] of: partition: set device_node of the newly created partition Sascha Hauer
2014-04-28  9:31 ` [PATCH 2/3] of: move of_find_device_by_node_path to drivers/of/of_path.c Sascha Hauer
2014-04-28  9:31 ` [PATCH 3/3] of_path: Allow to specify path with phandle only Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox