* [PATCH] mtd: Extend physmap_of to let the device tree specify the parition probe
@ 2010-03-09 19:27 Jason Gunthorpe
2010-04-06 8:44 ` Artem Bityutskiy
0 siblings, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2010-03-09 19:27 UTC (permalink / raw)
To: linux-mtd; +Cc: David Woodhouse, linux-kernel
This is to support custom partitioning schemes for embedded PPC. To use
define your own mtd_part_parser and then add something like:
linux,part-probe = "my_probe", "cmdlinepart";
To the board's dts file.
If linux,part-probe is not specified then this behaves the same as before.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
drivers/mtd/maps/physmap_of.c | 53 +++++++++++++++++++++++++++++++++++++----
1 files changed, 48 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 61e4eb4..fe4438c 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -172,12 +172,53 @@ static struct mtd_info * __devinit obsolete_probe(struct of_device *dev,
}
}
+#ifdef CONFIG_MTD_PARTITIONS
+/* When partitions are set we look for a linux,part-probe 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. */
+static const char *part_probe_types_def[] = { "cmdlinepart", "RedBoot", NULL };
+static const char ** __devinit of_get_probes(struct device_node *dp)
+{
+ const char *cp;
+ int cplen;
+ unsigned int l;
+ unsigned int count;
+ const char **res;
+
+ cp = of_get_property(dp, "linux,part-probe", &cplen);
+ if (cp == NULL)
+ return part_probe_types_def;
+
+ count = 0;
+ for (l = 0; l != cplen; l++)
+ if (cp[l] == 0)
+ count++;
+
+ res = kzalloc((count + 1)*sizeof(*res), GFP_KERNEL);
+ count = 0;
+ while (cplen > 0) {
+ res[count] = cp;
+ l = strlen(cp) + 1;
+ cp += l;
+ cplen -= l;
+ count++;
+ }
+ return res;
+}
+
+static void __devinit of_free_probes(const char **probes)
+{
+ if (probes != part_probe_types_def)
+ kfree(probes);
+}
+#endif
+
static int __devinit of_flash_probe(struct of_device *dev,
const struct of_device_id *match)
{
#ifdef CONFIG_MTD_PARTITIONS
- static const char *part_probe_types[]
- = { "cmdlinepart", "RedBoot", NULL };
+ const char **part_probe_types;
#endif
struct device_node *dp = dev->node;
struct resource res;
@@ -306,12 +347,14 @@ static int __devinit of_flash_probe(struct of_device *dev,
goto err_out;
#ifdef CONFIG_MTD_PARTITIONS
- /* First look for RedBoot table or partitions on the command
- * line, these take precedence over device tree information */
+ part_probe_types = of_get_probes(dp);
err = parse_mtd_partitions(info->cmtd, part_probe_types,
&info->parts, 0);
- if (err < 0)
+ if (err < 0) {
+ of_free_probes(part_probe_types);
return err;
+ }
+ of_free_probes(part_probe_types);
#ifdef CONFIG_MTD_OF_PARTS
if (err == 0) {
--
1.5.4.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: Extend physmap_of to let the device tree specify the parition probe
2010-03-09 19:27 [PATCH] mtd: Extend physmap_of to let the device tree specify the parition probe Jason Gunthorpe
@ 2010-04-06 8:44 ` Artem Bityutskiy
2010-04-12 21:20 ` Jason Gunthorpe
0 siblings, 1 reply; 4+ messages in thread
From: Artem Bityutskiy @ 2010-04-06 8:44 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: David Woodhouse, linux-mtd, linux-kernel
On Tue, 2010-03-09 at 12:27 -0700, Jason Gunthorpe wrote:
> This is to support custom partitioning schemes for embedded PPC. To use
> define your own mtd_part_parser and then add something like:
> linux,part-probe = "my_probe", "cmdlinepart";
> To the board's dts file.
>
> If linux,part-probe is not specified then this behaves the same as before.
>
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Taken to my l2-mtd-2.6.git / dunno
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: Extend physmap_of to let the device tree specify the parition probe
2010-04-06 8:44 ` Artem Bityutskiy
@ 2010-04-12 21:20 ` Jason Gunthorpe
2010-04-27 12:53 ` Artem Bityutskiy
0 siblings, 1 reply; 4+ messages in thread
From: Jason Gunthorpe @ 2010-04-12 21:20 UTC (permalink / raw)
To: Artem Bityutskiy; +Cc: David Woodhouse, linux-mtd, linux-kernel
On Tue, Apr 06, 2010 at 11:44:38AM +0300, Artem Bityutskiy wrote:
> On Tue, 2010-03-09 at 12:27 -0700, Jason Gunthorpe wrote:
> > This is to support custom partitioning schemes for embedded PPC. To use
> > define your own mtd_part_parser and then add something like:
> > linux,part-probe = "my_probe", "cmdlinepart";
> > To the board's dts file.
> >
> > If linux,part-probe is not specified then this behaves the same as before.
> >
> > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>
> Taken to my l2-mtd-2.6.git / dunno
Thanks Artem, not sure what that means? Do you need anything
additional from me?
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: Extend physmap_of to let the device tree specify the parition probe
2010-04-12 21:20 ` Jason Gunthorpe
@ 2010-04-27 12:53 ` Artem Bityutskiy
0 siblings, 0 replies; 4+ messages in thread
From: Artem Bityutskiy @ 2010-04-27 12:53 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: David Woodhouse, linux-mtd, linux-kernel
On Mon, 2010-04-12 at 15:20 -0600, Jason Gunthorpe wrote:
> On Tue, Apr 06, 2010 at 11:44:38AM +0300, Artem Bityutskiy wrote:
> > On Tue, 2010-03-09 at 12:27 -0700, Jason Gunthorpe wrote:
> > > This is to support custom partitioning schemes for embedded PPC. To use
> > > define your own mtd_part_parser and then add something like:
> > > linux,part-probe = "my_probe", "cmdlinepart";
> > > To the board's dts file.
> > >
> > > If linux,part-probe is not specified then this behaves the same as before.
> > >
> > > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> >
> > Taken to my l2-mtd-2.6.git / dunno
>
> Thanks Artem, not sure what that means? Do you need anything
> additional from me?
This means that this patch will most probably not forgotten by David
Woodhouse. So for nothing is required from you. But if you do not see
your patch in 2.6.35, then you should probably sent a question.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-27 12:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-09 19:27 [PATCH] mtd: Extend physmap_of to let the device tree specify the parition probe Jason Gunthorpe
2010-04-06 8:44 ` Artem Bityutskiy
2010-04-12 21:20 ` Jason Gunthorpe
2010-04-27 12:53 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).