diff options
Diffstat (limited to 'drivers/mtd/maps/l440gx.c')
-rw-r--r-- | drivers/mtd/maps/l440gx.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mtd/maps/l440gx.c b/drivers/mtd/maps/l440gx.c index dd0360ba2412..74bd98ee635f 100644 --- a/drivers/mtd/maps/l440gx.c +++ b/drivers/mtd/maps/l440gx.c | |||
@@ -27,17 +27,21 @@ static struct mtd_info *mymtd; | |||
27 | 27 | ||
28 | 28 | ||
29 | /* Is this really the vpp port? */ | 29 | /* Is this really the vpp port? */ |
30 | static DEFINE_SPINLOCK(l440gx_vpp_lock); | ||
31 | static int l440gx_vpp_refcnt; | ||
30 | static void l440gx_set_vpp(struct map_info *map, int vpp) | 32 | static void l440gx_set_vpp(struct map_info *map, int vpp) |
31 | { | 33 | { |
32 | unsigned long l; | 34 | unsigned long flags; |
33 | 35 | ||
34 | l = inl(VPP_PORT); | 36 | spin_lock_irqsave(&l440gx_vpp_lock, flags); |
35 | if (vpp) { | 37 | if (vpp) { |
36 | l |= 1; | 38 | if (++l440gx_vpp_refcnt == 1) /* first nested 'on' */ |
39 | outl(inl(VPP_PORT) | 1, VPP_PORT); | ||
37 | } else { | 40 | } else { |
38 | l &= ~1; | 41 | if (--l440gx_vpp_refcnt == 0) /* last nested 'off' */ |
42 | outl(inl(VPP_PORT) & ~1, VPP_PORT); | ||
39 | } | 43 | } |
40 | outl(l, VPP_PORT); | 44 | spin_unlock_irqrestore(&l440gx_vpp_lock, flags); |
41 | } | 45 | } |
42 | 46 | ||
43 | static struct map_info l440gx_map = { | 47 | static struct map_info l440gx_map = { |