diff options
author | Stefan Roese <sr@denx.de> | 2012-08-17 09:22:32 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-09-29 10:05:55 -0400 |
commit | d0788ce4924758249c9552c91cc33024d3434419 (patch) | |
tree | 5d490b8024a663de0fa4fc8cf3c876f94fd4c7c9 /drivers/mtd/maps/physmap_of.c | |
parent | e1ed147fd4a322741e63f66d76e68ad83876d2ea (diff) |
mtd: physmap_of: Add "no-unaligned-direct-access" DT property
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>
Diffstat (limited to 'drivers/mtd/maps/physmap_of.c')
-rw-r--r-- | drivers/mtd/maps/physmap_of.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 2e6fb6831d55..6f19acadb06c 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -169,6 +169,7 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
169 | struct mtd_info **mtd_list = NULL; | 169 | struct mtd_info **mtd_list = NULL; |
170 | resource_size_t res_size; | 170 | resource_size_t res_size; |
171 | struct mtd_part_parser_data ppdata; | 171 | struct mtd_part_parser_data ppdata; |
172 | bool map_indirect; | ||
172 | 173 | ||
173 | match = of_match_device(of_flash_match, &dev->dev); | 174 | match = of_match_device(of_flash_match, &dev->dev); |
174 | if (!match) | 175 | if (!match) |
@@ -192,6 +193,8 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
192 | } | 193 | } |
193 | count /= reg_tuple_size; | 194 | count /= reg_tuple_size; |
194 | 195 | ||
196 | map_indirect = of_property_read_bool(dp, "no-unaligned-direct-access"); | ||
197 | |||
195 | err = -ENOMEM; | 198 | err = -ENOMEM; |
196 | info = kzalloc(sizeof(struct of_flash) + | 199 | info = kzalloc(sizeof(struct of_flash) + |
197 | sizeof(struct of_flash_list) * count, GFP_KERNEL); | 200 | sizeof(struct of_flash_list) * count, GFP_KERNEL); |
@@ -247,6 +250,17 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
247 | 250 | ||
248 | simple_map_init(&info->list[i].map); | 251 | simple_map_init(&info->list[i].map); |
249 | 252 | ||
253 | /* | ||
254 | * On some platforms (e.g. MPC5200) a direct 1:1 mapping | ||
255 | * may cause problems with JFFS2 usage, as the local bus (LPB) | ||
256 | * doesn't support unaligned accesses as implemented in the | ||
257 | * JFFS2 code via memcpy(). By setting NO_XIP, the | ||
258 | * flash will not be exposed directly to the MTD users | ||
259 | * (e.g. JFFS2) any more. | ||
260 | */ | ||
261 | if (map_indirect) | ||
262 | info->list[i].map.phys = NO_XIP; | ||
263 | |||
250 | if (probe_type) { | 264 | if (probe_type) { |
251 | info->list[i].mtd = do_map_probe(probe_type, | 265 | info->list[i].mtd = do_map_probe(probe_type, |
252 | &info->list[i].map); | 266 | &info->list[i].map); |