aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/drivers
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2009-06-06 15:56:03 +0000
committerGabor Juhos <juhosg@openwrt.org>2009-06-06 15:56:03 +0000
commite246e0ed0d470125cfd5eed23dfa8d57c4a37a65 (patch)
tree28cb20ca179619f334b1093fc62ff7e0ba359a3f /target/linux/ar71xx/files/drivers
parent455c6f7c88f337e38b55dbc27548dec68551b17f (diff)
downloadupstream-e246e0ed0d470125cfd5eed23dfa8d57c4a37a65.tar.gz
upstream-e246e0ed0d470125cfd5eed23dfa8d57c4a37a65.tar.bz2
upstream-e246e0ed0d470125cfd5eed23dfa8d57c4a37a65.zip
[ar71xx] update flash locking code
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@16359 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ar71xx/files/drivers')
-rw-r--r--target/linux/ar71xx/files/drivers/mtd/maps/ar91xx_flash.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/target/linux/ar71xx/files/drivers/mtd/maps/ar91xx_flash.c b/target/linux/ar71xx/files/drivers/mtd/maps/ar91xx_flash.c
index e83a1477f0..7ee831c12d 100644
--- a/target/linux/ar71xx/files/drivers/mtd/maps/ar91xx_flash.c
+++ b/target/linux/ar71xx/files/drivers/mtd/maps/ar91xx_flash.c
@@ -60,6 +60,41 @@ static void ar91xx_flash_write(struct map_info *map, map_word d,
mb();
}
+static map_word ar91xx_flash_read_lock(struct map_info *map, unsigned long ofs)
+{
+ map_word ret;
+
+ ar71xx_flash_acquire();
+ ret = ar91xx_flash_read(map, ofs);
+ ar71xx_flash_release();
+
+ return ret;
+}
+
+static void ar91xx_flash_write_lock(struct map_info *map, map_word d,
+ unsigned long ofs)
+{
+ ar71xx_flash_acquire();
+ ar91xx_flash_write(map, d, ofs);
+ ar71xx_flash_release();
+}
+
+static void ar91xx_flash_copy_from_lock(struct map_info *map, void *to,
+ unsigned long from, ssize_t len)
+{
+ ar71xx_flash_acquire();
+ inline_map_copy_from(map, to, from, len);
+ ar71xx_flash_release();
+}
+
+static void ar91xx_flash_copy_to_lock(struct map_info *map, unsigned long to,
+ const void *from, ssize_t len)
+{
+ ar71xx_flash_acquire();
+ inline_map_copy_to(map, to, from, len);
+ ar71xx_flash_release();
+}
+
static int ar91xx_flash_remove(struct platform_device *pdev)
{
struct ar91xx_flash_platform_data *pdata;
@@ -152,8 +187,15 @@ static int ar91xx_flash_probe(struct platform_device *pdev)
}
simple_map_init(&info->map);
- info->map.read = ar91xx_flash_read;
- info->map.write = ar91xx_flash_write;
+ if (pdata->is_shared) {
+ info->map.read = ar91xx_flash_read_lock;
+ info->map.write = ar91xx_flash_write_lock;
+ info->map.copy_from = ar91xx_flash_copy_from_lock;
+ info->map.copy_to = ar91xx_flash_copy_to_lock;
+ } else {
+ info->map.read = ar91xx_flash_read;
+ info->map.write = ar91xx_flash_write;
+ }
probe_type = rom_probe_types;
for (; info->mtd == NULL && *probe_type != NULL; probe_type++)