All of lore.kernel.org
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org,
	Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH 3/3] mtd: physmap_of: handle the new "partition-type"
Date: Thu, 29 Oct 2015 13:52:32 +0100	[thread overview]
Message-ID: <1446123152-22666-3-git-send-email-linus.walleij@linaro.org> (raw)
In-Reply-To: <1446123152-22666-1-git-send-email-linus.walleij@linaro.org>

We defined a new device tree binding for partitions, and if they
are found these need to be translated into a string array of
Linux partitions. Reuse the string-to-array split function and
support "arm,arm-flash-structure" by splitting "afs" into
{"afs", NULL} and passing that along.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mtd/maps/physmap_of.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 1b66ca66206b..8c09d7e23b6e 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -105,7 +105,7 @@ static struct mtd_info *obsolete_probe(struct platform_device *dev,
 	}
 }
 
-/* When partitions are set we look for a linux,part-probe property which
+/* When partitions are set we look for a partition-type property which
    specifies the list of partition probers to use. If none is given then the
    default is use. These take precedence over other device tree
    information. */
@@ -150,9 +150,25 @@ static const char * const *of_get_probes(struct device_node *dp)
 	int cplen;
 	int ret;
 
+	/*
+	 * The proper device tree bindings take precedence.
+	 */
+	ret = of_property_read_string(dp, "partition-type", &cp);
+	if (!ret) {
+		pr_info("check for partition type \"%s\"\n", cp);
+		if (!strcmp(cp, "arm,arm-flash-structure"))
+			return string_to_array("afs", 1);
+	}
+
+	/*
+	 * Else look for the deprecated binding, or fall back to
+	 * defaults.
+	 */
 	cp = of_get_property(dp, "linux,part-probe", &cplen);
 	if (cp == NULL)
 		return part_probe_types_def;
+	pr_info("DT is using the deprecated \"linux,part-probe\" binding\n");
+	pr_info("please move to the standard \"partition-type\" binding\n");
 	return string_to_array(cp, cplen);
 }
 
-- 
2.4.3

WARNING: multiple messages have this Message-ID (diff)
From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] mtd: physmap_of: handle the new "partition-type"
Date: Thu, 29 Oct 2015 13:52:32 +0100	[thread overview]
Message-ID: <1446123152-22666-3-git-send-email-linus.walleij@linaro.org> (raw)
In-Reply-To: <1446123152-22666-1-git-send-email-linus.walleij@linaro.org>

We defined a new device tree binding for partitions, and if they
are found these need to be translated into a string array of
Linux partitions. Reuse the string-to-array split function and
support "arm,arm-flash-structure" by splitting "afs" into
{"afs", NULL} and passing that along.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/mtd/maps/physmap_of.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 1b66ca66206b..8c09d7e23b6e 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -105,7 +105,7 @@ static struct mtd_info *obsolete_probe(struct platform_device *dev,
 	}
 }
 
-/* When partitions are set we look for a linux,part-probe property which
+/* When partitions are set we look for a partition-type property which
    specifies the list of partition probers to use. If none is given then the
    default is use. These take precedence over other device tree
    information. */
@@ -150,9 +150,25 @@ static const char * const *of_get_probes(struct device_node *dp)
 	int cplen;
 	int ret;
 
+	/*
+	 * The proper device tree bindings take precedence.
+	 */
+	ret = of_property_read_string(dp, "partition-type", &cp);
+	if (!ret) {
+		pr_info("check for partition type \"%s\"\n", cp);
+		if (!strcmp(cp, "arm,arm-flash-structure"))
+			return string_to_array("afs", 1);
+	}
+
+	/*
+	 * Else look for the deprecated binding, or fall back to
+	 * defaults.
+	 */
 	cp = of_get_property(dp, "linux,part-probe", &cplen);
 	if (cp == NULL)
 		return part_probe_types_def;
+	pr_info("DT is using the deprecated \"linux,part-probe\" binding\n");
+	pr_info("please move to the standard \"partition-type\" binding\n");
 	return string_to_array(cp, cplen);
 }
 
-- 
2.4.3

  parent reply	other threads:[~2015-10-29 12:53 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-29 12:52 [PATCH 1/3] mtd: create a partition type device tree binding Linus Walleij
2015-10-29 12:52 ` Linus Walleij
2015-10-29 12:52 ` Linus Walleij
2015-10-29 12:52 ` [PATCH 2/3] mtd: physmap_of: break out array clone code Linus Walleij
2015-10-29 12:52   ` Linus Walleij
2015-10-29 12:52 ` Linus Walleij [this message]
2015-10-29 12:52   ` [PATCH 3/3] mtd: physmap_of: handle the new "partition-type" Linus Walleij
     [not found] ` <1446123152-22666-1-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-10-29 16:29   ` [PATCH 1/3] mtd: create a partition type device tree binding Brian Norris
2015-10-29 16:29     ` Brian Norris
2015-10-29 16:29     ` Brian Norris
2015-10-30 14:00     ` Linus Walleij
2015-10-30 14:00       ` Linus Walleij
2015-10-30 14:00       ` Linus Walleij
     [not found]       ` <CACRpkdYS5Jf8UC2K0bNdEQZDjTeZZx44Uu-kkof+9E=4Ny0oDg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-10-30 17:51         ` Brian Norris
2015-10-30 17:51           ` Brian Norris
2015-10-30 17:51           ` Brian Norris
     [not found]           ` <20151030175145.GF13239-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-11-06 14:13             ` Rob Herring
2015-11-06 14:13               ` Rob Herring
2015-11-06 14:13               ` Rob Herring
     [not found]               ` <CAL_JsqL2F3p7qBPbOiGytVyzF_aNLWbrCT0mAX1WZo6SxE3JoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-10  3:26                 ` Brian Norris
2015-11-10  3:26                   ` Brian Norris
2015-11-10  3:26                   ` Brian Norris
     [not found]                   ` <20151110032626.GN12143-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-11-10  8:43                     ` Linus Walleij
2015-11-10  8:43                       ` Linus Walleij
2015-11-10  8:43                       ` Linus Walleij
2015-11-13 22:00                 ` Brian Norris
2015-11-13 22:00                   ` Brian Norris
2015-11-13 22:00                   ` Brian Norris
     [not found]                   ` <20151113220039.GA74382-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-11-14 10:46                     ` Linus Walleij
2015-11-14 10:46                       ` Linus Walleij
2015-11-14 10:46                       ` Linus Walleij
     [not found]                       ` <CACRpkdakyae95f_Lc-R7Uf7wndj5hyfCqqHziwmZjwm-uNkGAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-16  4:12                         ` Brian Norris
2015-11-16  4:12                           ` Brian Norris
2015-11-16  4:12                           ` Brian Norris
2015-11-15  9:06                 ` Geert Uytterhoeven
2015-11-15  9:06                   ` Geert Uytterhoeven
2015-11-15  9:06                   ` Geert Uytterhoeven

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=1446123152-22666-3-git-send-email-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@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 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.