aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps/physmap_of.c
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2010-10-01 03:06:08 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-10-24 19:55:56 -0400
commit766f271a63d1ee7caed8030736e6aed253d02073 (patch)
tree198b4cf3efd5de59121bdca483a095b8234b588a /drivers/mtd/maps/physmap_of.c
parentd86fbdb8ed0ac957693ff475cca076021677166a (diff)
mtd: Fix endianness issues from device tree
This patch adds the appropriate conversions to correct the endianness issues in the MTD driver whenever it accesses the device tree (which is always big endian). Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/maps/physmap_of.c')
-rw-r--r--drivers/mtd/maps/physmap_of.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index fe63f6bd663c..ec4011c3d5f2 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -50,7 +50,7 @@ static int parse_obsolete_partitions(struct platform_device *dev,
50{ 50{
51 int i, plen, nr_parts; 51 int i, plen, nr_parts;
52 const struct { 52 const struct {
53 u32 offset, len; 53 __be32 offset, len;
54 } *part; 54 } *part;
55 const char *names; 55 const char *names;
56 56
@@ -69,9 +69,9 @@ static int parse_obsolete_partitions(struct platform_device *dev,
69 names = of_get_property(dp, "partition-names", &plen); 69 names = of_get_property(dp, "partition-names", &plen);
70 70
71 for (i = 0; i < nr_parts; i++) { 71 for (i = 0; i < nr_parts; i++) {
72 info->parts[i].offset = part->offset; 72 info->parts[i].offset = be32_to_cpu(part->offset);
73 info->parts[i].size = part->len & ~1; 73 info->parts[i].size = be32_to_cpu(part->len) & ~1;
74 if (part->len & 1) /* bit 0 set signifies read only partition */ 74 if (be32_to_cpu(part->len) & 1) /* bit 0 set signifies read only partition */
75 info->parts[i].mask_flags = MTD_WRITEABLE; 75 info->parts[i].mask_flags = MTD_WRITEABLE;
76 76
77 if (names && (plen > 0)) { 77 if (names && (plen > 0)) {
@@ -226,11 +226,11 @@ static int __devinit of_flash_probe(struct platform_device *dev,
226 struct resource res; 226 struct resource res;
227 struct of_flash *info; 227 struct of_flash *info;
228 const char *probe_type = match->data; 228 const char *probe_type = match->data;
229 const u32 *width; 229 const __be32 *width;
230 int err; 230 int err;
231 int i; 231 int i;
232 int count; 232 int count;
233 const u32 *p; 233 const __be32 *p;
234 int reg_tuple_size; 234 int reg_tuple_size;
235 struct mtd_info **mtd_list = NULL; 235 struct mtd_info **mtd_list = NULL;
236 resource_size_t res_size; 236 resource_size_t res_size;
@@ -294,7 +294,7 @@ static int __devinit of_flash_probe(struct platform_device *dev,
294 info->list[i].map.name = dev_name(&dev->dev); 294 info->list[i].map.name = dev_name(&dev->dev);
295 info->list[i].map.phys = res.start; 295 info->list[i].map.phys = res.start;
296 info->list[i].map.size = res_size; 296 info->list[i].map.size = res_size;
297 info->list[i].map.bankwidth = *width; 297 info->list[i].map.bankwidth = be32_to_cpup(width);
298 298
299 err = -ENOMEM; 299 err = -ENOMEM;
300 info->list[i].map.virt = ioremap(info->list[i].map.phys, 300 info->list[i].map.virt = ioremap(info->list[i].map.phys,