]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: physmap_of: Add "no-unaligned-direct-access" DT property
authorStefan Roese <sr@denx.de>
Fri, 17 Aug 2012 13:22:32 +0000 (15:22 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 29 Sep 2012 14:05:55 +0000 (15:05 +0100)
On some platforms (e.g. MPC5200) a direct 1:1 mapping may cause
problems with JFFS2 usage, as the local bus (LPB) doesn't support
unaligned accesses as implemented in the JFFS2 code via memcpy().
By defining "no-unaligned-direct-access", the flash will not be
exposed directly to the MTD users (e.g. JFFS2) any more.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Documentation/devicetree/bindings/mtd/mtd-physmap.txt
drivers/mtd/maps/physmap_of.c

index a63c2bd7de2b66f4d847618d31628d22cc2c870b..94de19b8f16bcd548e2e1163704b9fc3ae2ce31f 100644 (file)
@@ -16,6 +16,13 @@ file systems on embedded devices.
  - #address-cells, #size-cells : Must be present if the device has
    sub-nodes representing partitions (see below).  In this case
    both #address-cells and #size-cells must be equal to 1.
+ - no-unaligned-direct-access: boolean to disable the default direct
+   mapping of the flash.
+   On some platforms (e.g. MPC5200) a direct 1:1 mapping may cause
+   problems with JFFS2 usage, as the local bus (LPB) doesn't support
+   unaligned accesses as implemented in the JFFS2 code via memcpy().
+   By defining "no-unaligned-direct-access", the flash will not be
+   exposed directly to the MTD users (e.g. JFFS2) any more.
 
 For JEDEC compatible devices, the following additional properties
 are defined:
index 2e6fb6831d553802400862b3ed0356e864405ab9..6f19acadb06c97a521c29735de6813080bf626ed 100644 (file)
@@ -169,6 +169,7 @@ static int __devinit of_flash_probe(struct platform_device *dev)
        struct mtd_info **mtd_list = NULL;
        resource_size_t res_size;
        struct mtd_part_parser_data ppdata;
+       bool map_indirect;
 
        match = of_match_device(of_flash_match, &dev->dev);
        if (!match)
@@ -192,6 +193,8 @@ static int __devinit of_flash_probe(struct platform_device *dev)
        }
        count /= reg_tuple_size;
 
+       map_indirect = of_property_read_bool(dp, "no-unaligned-direct-access");
+
        err = -ENOMEM;
        info = kzalloc(sizeof(struct of_flash) +
                       sizeof(struct of_flash_list) * count, GFP_KERNEL);
@@ -247,6 +250,17 @@ static int __devinit of_flash_probe(struct platform_device *dev)
 
                simple_map_init(&info->list[i].map);
 
+               /*
+                * On some platforms (e.g. MPC5200) a direct 1:1 mapping
+                * may cause problems with JFFS2 usage, as the local bus (LPB)
+                * doesn't support unaligned accesses as implemented in the
+                * JFFS2 code via memcpy(). By setting NO_XIP, the
+                * flash will not be exposed directly to the MTD users
+                * (e.g. JFFS2) any more.
+                */
+               if (map_indirect)
+                       info->list[i].map.phys = NO_XIP;
+
                if (probe_type) {
                        info->list[i].mtd = do_map_probe(probe_type,
                                                         &info->list[i].map);