aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAtsushi Nemoto <anemo@mba.ocn.ne.jp>2008-07-09 12:02:08 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-07-15 13:44:34 -0400
commit14476007c90005c8992b786c15a59cca31f53268 (patch)
tree625733f5555d157f9c304d889fce1d2e521dd3b4
parent315806cb19f9d375dccbc2d60fa14e16afdcd5ac (diff)
[MIPS] txx9: Make gpio_txx9 entirely spinlock-safe
TXx9 GPIO set/get routines are spinlock-safe. This patch make gpio_direction_{input,output} routines also spinlock-safe so that they can be used during early board setup. Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/kernel/gpio_txx9.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/mips/kernel/gpio_txx9.c b/arch/mips/kernel/gpio_txx9.c
index b1436a857998..c6854d9df926 100644
--- a/arch/mips/kernel/gpio_txx9.c
+++ b/arch/mips/kernel/gpio_txx9.c
@@ -47,23 +47,25 @@ static void txx9_gpio_set(struct gpio_chip *chip, unsigned int offset,
47 47
48static int txx9_gpio_dir_in(struct gpio_chip *chip, unsigned int offset) 48static int txx9_gpio_dir_in(struct gpio_chip *chip, unsigned int offset)
49{ 49{
50 spin_lock_irq(&txx9_gpio_lock); 50 unsigned long flags;
51 spin_lock_irqsave(&txx9_gpio_lock, flags);
51 __raw_writel(__raw_readl(&txx9_pioptr->dir) & ~(1 << offset), 52 __raw_writel(__raw_readl(&txx9_pioptr->dir) & ~(1 << offset),
52 &txx9_pioptr->dir); 53 &txx9_pioptr->dir);
53 mmiowb(); 54 mmiowb();
54 spin_unlock_irq(&txx9_gpio_lock); 55 spin_unlock_irqrestore(&txx9_gpio_lock, flags);
55 return 0; 56 return 0;
56} 57}
57 58
58static int txx9_gpio_dir_out(struct gpio_chip *chip, unsigned int offset, 59static int txx9_gpio_dir_out(struct gpio_chip *chip, unsigned int offset,
59 int value) 60 int value)
60{ 61{
61 spin_lock_irq(&txx9_gpio_lock); 62 unsigned long flags;
63 spin_lock_irqsave(&txx9_gpio_lock, flags);
62 txx9_gpio_set_raw(offset, value); 64 txx9_gpio_set_raw(offset, value);
63 __raw_writel(__raw_readl(&txx9_pioptr->dir) | (1 << offset), 65 __raw_writel(__raw_readl(&txx9_pioptr->dir) | (1 << offset),
64 &txx9_pioptr->dir); 66 &txx9_pioptr->dir);
65 mmiowb(); 67 mmiowb();
66 spin_unlock_irq(&txx9_gpio_lock); 68 spin_unlock_irqrestore(&txx9_gpio_lock, flags);
67 return 0; 69 return 0;
68} 70}
69 71