Re: [PATCH] [MTD] ofpart: Partitions at same address cannot have the same name v3

2009-04-28 Thread Segher Boessenkool
Sometimes, an special partition is included in the device tree  
including all the

partitions. Like in:

partit...@ff00 {
   reg =  0x00 0x80 ;
   label = Root File System;
};
partit...@ff80 {
   reg =  0x80 0x1a ;
   label = Bitstream;
};
...
f...@ff00 {
   compatible = partition;
   reg =  0x00 0x100 ;
   label = Full FLASH;
};


Your special partition isn't really a partition then, is it.
Because of that, device nodes to represent your partitions doesn't
work very well.

You really want to use something else, a partition table on the
flash itself for example.  Or maybe the (platform? MTD?) code
should create a Linux device for the full device.


Because two nodes of a device tree cannot have the same name,


This isn't true.


but all the
partitions must be named partition,


Bad binding, no cookie for you!


-   if (strcmp(partname, partition) != 0) {
+   if ((strcmp(partname, partition) != 0) 
+   (of_device_is_compatible(pp, partition) != 1))
+   {


You cannot claim a name as generic as partition for this.  Pick
something else if you really must do things this way.


Segher

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [MTD] ofpart: Partitions at same address cannot have the same name v3

2009-04-27 Thread Benjamin Krill
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -48,7 +48,9 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
 
   /* check if this is a partition node */
   partname = of_get_property(pp, name, len);
-  if (strcmp(partname, partition) != 0) {
+  if ((strcmp(partname, partition) != 0) 
+  (of_device_is_compatible(pp, partition) != 1))
+  {
   nr_parts--;
   continue;
   }

If this is the way, how to go, you get my ack.

Acked-by: Benjamin Krill b...@codiert.org
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] [MTD] ofpart: Partitions at same address cannot have the same name v3

2009-04-24 Thread Ricardo Ribalda Delgado
Sometimes, an special partition is included in the device tree including all the
partitions. Like in:

partit...@ff00 {
   reg =  0x00 0x80 ;
   label = Root File System;
};
partit...@ff80 {
   reg =  0x80 0x1a ;
   label = Bitstream;
};
...
f...@ff00 {
   compatible = partition;
   reg =  0x00 0x100 ;
   label = Full FLASH;
};

Because two nodes of a device tree cannot have the same name, but all the
partitions must be named partition, this special partition is invalid.

This patch makes ofpart.c accept spetial partitions compatible with
partition but not named partition.

These spetial partitions are very useful for flashing the full firmware
of a device from linux
---
This v3 includes feedback from Scott Wood, Peter Korsgaard  Benjamin Kril

v3: Use the compatible propierty
v2: buggy implementation, strlen-1 instead of strlen
v1: Just check the firt part of the name


 drivers/mtd/ofpart.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 3e164f0..59c1e4a 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -48,7 +48,9 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
 
/* check if this is a partition node */
partname = of_get_property(pp, name, len);
-   if (strcmp(partname, partition) != 0) {
+   if ((strcmp(partname, partition) != 0) 
+   (of_device_is_compatible(pp, partition) != 1))
+   {
nr_parts--;
continue;
}
-- 
1.6.2.4

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev