[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>
This commit is contained in:
parent
315806cb19
commit
14476007c9
|
@ -47,23 +47,25 @@ static void txx9_gpio_set(struct gpio_chip *chip, unsigned int offset,
|
||||||
|
|
||||||
static int txx9_gpio_dir_in(struct gpio_chip *chip, unsigned int offset)
|
static int txx9_gpio_dir_in(struct gpio_chip *chip, unsigned int offset)
|
||||||
{
|
{
|
||||||
spin_lock_irq(&txx9_gpio_lock);
|
unsigned long flags;
|
||||||
|
spin_lock_irqsave(&txx9_gpio_lock, flags);
|
||||||
__raw_writel(__raw_readl(&txx9_pioptr->dir) & ~(1 << offset),
|
__raw_writel(__raw_readl(&txx9_pioptr->dir) & ~(1 << offset),
|
||||||
&txx9_pioptr->dir);
|
&txx9_pioptr->dir);
|
||||||
mmiowb();
|
mmiowb();
|
||||||
spin_unlock_irq(&txx9_gpio_lock);
|
spin_unlock_irqrestore(&txx9_gpio_lock, flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int txx9_gpio_dir_out(struct gpio_chip *chip, unsigned int offset,
|
static int txx9_gpio_dir_out(struct gpio_chip *chip, unsigned int offset,
|
||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
spin_lock_irq(&txx9_gpio_lock);
|
unsigned long flags;
|
||||||
|
spin_lock_irqsave(&txx9_gpio_lock, flags);
|
||||||
txx9_gpio_set_raw(offset, value);
|
txx9_gpio_set_raw(offset, value);
|
||||||
__raw_writel(__raw_readl(&txx9_pioptr->dir) | (1 << offset),
|
__raw_writel(__raw_readl(&txx9_pioptr->dir) | (1 << offset),
|
||||||
&txx9_pioptr->dir);
|
&txx9_pioptr->dir);
|
||||||
mmiowb();
|
mmiowb();
|
||||||
spin_unlock_irq(&txx9_gpio_lock);
|
spin_unlock_irqrestore(&txx9_gpio_lock, flags);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue