summaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files/drivers/mtd
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-06-28 17:28:31 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-06-28 17:28:31 +0000
commit22c1090f91c625ea0922df56653758c142234271 (patch)
tree281f1363fa968df433684a06a8fd44a4abc66595 /target/linux/ifxmips/files/drivers/mtd
parent6ddec82f97677610a82261d7c22cf2dd82b407b5 (diff)
add proper ebu locking to ifxmips
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11597 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips/files/drivers/mtd')
-rw-r--r--target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c b/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c
index b38c6269b..808904a56 100644
--- a/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c
+++ b/target/linux/ifxmips/files/drivers/mtd/maps/ifxmips.c
@@ -27,6 +27,7 @@
#include <linux/mtd/partitions.h>
#include <linux/mtd/cfi.h>
#include <asm/ifxmips/ifxmips.h>
+#include <asm/ifxmips/ifxmips_ebu.h>
#include <linux/magic.h>
#include <linux/platform_device.h>
@@ -41,19 +42,23 @@ ifxmips_map = {
static map_word
ifxmips_read16(struct map_info * map, unsigned long adr)
{
+ unsigned long flags;
map_word temp;
-
+ spin_lock_irqsave(&ebu_lock, flags);
adr ^= 2;
temp.x[0] = *((__u16 *) (map->virt + adr));
-
+ spin_unlock_irqrestore(&ebu_lock, flags);
return temp;
}
static void
ifxmips_write16(struct map_info *map, map_word d, unsigned long adr)
{
+ unsigned long flags;
+ spin_lock_irqsave(&ebu_lock, flags);
adr ^= 2;
*((__u16 *) (map->virt + adr)) = d.x[0];
+ spin_unlock_irqrestore(&ebu_lock, flags);
}
void
@@ -61,12 +66,14 @@ ifxmips_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t le
{
unsigned char *p;
unsigned char *to_8;
-
+ unsigned long flags;
+ spin_lock_irqsave(&ebu_lock, flags);
from = (unsigned long)(from + map->virt);
p = (unsigned char*) from;
to_8 = (unsigned char*) to;
while(len--)
*to_8++ = *p++;
+ spin_unlock_irqrestore(&ebu_lock, flags);
}
void
@@ -74,12 +81,14 @@ ifxmips_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_
{
unsigned char *p = (unsigned char*)from;
unsigned char *to_8;
-
+ unsigned long flags;
+ spin_lock_irqsave(&ebu_lock, flags);
to += (unsigned long) map->virt;
to_8 = (unsigned char*)to;
while(len--){
*p++ = *to_8++;
}
+ spin_unlock_irqrestore(&ebu_lock, flags);
}
static struct mtd_partition