mtd: Fix endianness issues from device tree
[pandora-kernel.git] / drivers / mtd / maps / physmap_of.c
index fe63f6b..ec4011c 100644 (file)
@@ -50,7 +50,7 @@ static int parse_obsolete_partitions(struct platform_device *dev,
 {
        int i, plen, nr_parts;
        const struct {
-               u32 offset, len;
+               __be32 offset, len;
        } *part;
        const char *names;
 
@@ -69,9 +69,9 @@ static int parse_obsolete_partitions(struct platform_device *dev,
        names = of_get_property(dp, "partition-names", &plen);
 
        for (i = 0; i < nr_parts; i++) {
-               info->parts[i].offset = part->offset;
-               info->parts[i].size   = part->len & ~1;
-               if (part->len & 1) /* bit 0 set signifies read only partition */
+               info->parts[i].offset = be32_to_cpu(part->offset);
+               info->parts[i].size   = be32_to_cpu(part->len) & ~1;
+               if (be32_to_cpu(part->len) & 1) /* bit 0 set signifies read only partition */
                        info->parts[i].mask_flags = MTD_WRITEABLE;
 
                if (names && (plen > 0)) {
@@ -226,11 +226,11 @@ static int __devinit of_flash_probe(struct platform_device *dev,
        struct resource res;
        struct of_flash *info;
        const char *probe_type = match->data;
-       const u32 *width;
+       const __be32 *width;
        int err;
        int i;
        int count;
-       const u32 *p;
+       const __be32 *p;
        int reg_tuple_size;
        struct mtd_info **mtd_list = NULL;
        resource_size_t res_size;
@@ -294,7 +294,7 @@ static int __devinit of_flash_probe(struct platform_device *dev,
                info->list[i].map.name = dev_name(&dev->dev);
                info->list[i].map.phys = res.start;
                info->list[i].map.size = res_size;
-               info->list[i].map.bankwidth = *width;
+               info->list[i].map.bankwidth = be32_to_cpup(width);
 
                err = -ENOMEM;
                info->list[i].map.virt = ioremap(info->list[i].map.phys,