[PATCH 2/7] of: MTD: Fix OF probing on little-endian systems

Michal Simek monstr at monstr.eu
Wed Sep 29 01:52:13 EDT 2010


Convert big-endian DTB to little-endian if necessary.

Signed-off-by: Michal Simek <monstr at monstr.eu>
CC: David Woodhouse <dwmw2 at infradead.org>
CC: Tejun Heo <tj at kernel.org>
CC: Grant Likely <grant.likely at secretlab.ca>
CC: linux-mtd at lists.infradead.org
CC: linux-kernel at vger.kernel.org
CC: devicetree-discuss at lists.ozlabs.org
---
 drivers/mtd/maps/physmap_of.c |    2 +-
 drivers/mtd/ofpart.c          |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index fe63f6b..ec3edf6 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -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,
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 8bf7dc6..7bd171e 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -53,8 +53,8 @@ int __devinit of_mtd_parse_partitions(struct device *dev,
 			continue;
 		}
 
-		(*pparts)[i].offset = reg[0];
-		(*pparts)[i].size = reg[1];
+		(*pparts)[i].offset = be32_to_cpu(reg[0]);
+		(*pparts)[i].size = be32_to_cpu(reg[1]);
 
 		partname = of_get_property(pp, "label", &len);
 		if (!partname)
-- 
1.5.5.1




More information about the linux-mtd mailing list