mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 2/3] of_path: Allow pointing directly to the partition
Date: Tue,  1 Sep 2015 08:14:48 +0200	[thread overview]
Message-ID: <1441088089-20649-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1441088089-20649-1-git-send-email-s.hauer@pengutronix.de>

We could only point to partitions in the device tree by using
&norflash, "partname:barebox-environment". Allow to point to the
partition directly without having to parse the partition labels.

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

diff --git a/Documentation/devicetree/bindings/barebox/barebox,environment.rst b/Documentation/devicetree/bindings/barebox/barebox,environment.rst
index d472f66..d5e52ea 100644
--- a/Documentation/devicetree/bindings/barebox/barebox,environment.rst
+++ b/Documentation/devicetree/bindings/barebox/barebox,environment.rst
@@ -8,8 +8,9 @@ Required properties:
 * ``compatible``: should be ``barebox,environment``
 * ``device-path``: path to the environment
 
-The device-path is a multistring property. The first string should be a
-nodepath to the node containing the physical device of the environment.
+The device-path is a multistring property. The first string should contain
+a nodepath to the node containing the physical device of the environment or
+a nodepath to a partition described by the OF partition binding.
 The subsequent strings are of the form <type>:<options> to further describe
 the path to the environment. Supported values for <type>:
 
diff --git a/drivers/of/of_path.c b/drivers/of/of_path.c
index 2dc7848..992972c 100644
--- a/drivers/of/of_path.c
+++ b/drivers/of/of_path.c
@@ -117,7 +117,8 @@ out:
  * @flags: use OF_FIND_PATH_FLAGS_BB to return the .bb device if available
  *
  * paths in the devicetree have the form of a multistring property. The first
- * string contains the full path to the physical device containing the path.
+ * string contains the full path to the physical device containing the path or
+ * a full path to a partition described by the OF partition binding.
  * The remaining strings have the form "<type>:<options>". Currently supported
  * for <type> are:
  *
@@ -129,6 +130,7 @@ out:
  *
  * device-path = &mmc0, "partname:0";
  * device-path = &norflash, "partname:barebox-environment";
+ * device-path = &environment_nor;
  */
 int of_find_path(struct device_node *node, const char *propname, char **outpath, unsigned flags)
 {
@@ -147,13 +149,15 @@ int of_find_path(struct device_node *node, const char *propname, char **outpath,
 		return -ENODEV;
 
 	op.dev = of_find_device_by_node_path(rnode->full_name);
-	if (!op.dev)
-		return -ENODEV;
+	if (!op.dev) {
+		op.dev = of_find_device_by_node_path(rnode->parent->full_name);
+		if (!op.dev)
+			return -ENODEV;
+	}
 
 	device_detect(op.dev);
 
-	if (list_is_singular(&op.dev->cdevs))
-		op.cdev = list_first_entry(&op.dev->cdevs, struct cdev, devices_list);
+	op.cdev = cdev_by_device_node(rnode);
 
 	i = 1;
 
-- 
2.5.0


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

  reply	other threads:[~2015-09-01  6:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-01  6:14 [PATCH 1/3] cdev: Add function to find cdev by device_node Sascha Hauer
2015-09-01  6:14 ` Sascha Hauer [this message]
2015-09-01  6:14 ` [PATCH 3/3] ARM: dts: directly point to partitions in the barebox, environment binding Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441088089-20649-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox