1 From 6c888a88f2a9939182bf41151f079a6b59f1593c Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Tue, 29 Jan 2013 08:19:13 +0000
4 Subject: [PATCH] MIPS: ath79: simplify ath79_gpio_function_* routines
6 commit f160a289e0e8848391f5ec48ff1a014b9c04b162 upstream.
8 Make ath79_gpio_function_{en,dis}able to be wrappers
9 around ath79_gpio_function_setup.
11 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
12 Patchwork: http://patchwork.linux-mips.org/patch/4871/
13 Signed-off-by: John Crispin <blogic@openwrt.org>
15 arch/mips/ath79/gpio.c | 30 ++++++------------------------
16 1 file changed, 6 insertions(+), 24 deletions(-)
18 --- a/arch/mips/ath79/gpio.c
19 +++ b/arch/mips/ath79/gpio.c
20 @@ -154,46 +154,28 @@ static void __iomem *ath79_gpio_get_func
21 return ath79_gpio_base + reg;
24 -void ath79_gpio_function_enable(u32 mask)
25 +void ath79_gpio_function_setup(u32 set, u32 clear)
27 void __iomem *reg = ath79_gpio_get_function_reg();
30 spin_lock_irqsave(&ath79_gpio_lock, flags);
32 - __raw_writel(__raw_readl(reg) | mask, reg);
33 + __raw_writel((__raw_readl(reg) & ~clear) | set, reg);
37 spin_unlock_irqrestore(&ath79_gpio_lock, flags);
40 -void ath79_gpio_function_disable(u32 mask)
41 +void ath79_gpio_function_enable(u32 mask)
43 - void __iomem *reg = ath79_gpio_get_function_reg();
44 - unsigned long flags;
46 - spin_lock_irqsave(&ath79_gpio_lock, flags);
48 - __raw_writel(__raw_readl(reg) & ~mask, reg);
52 - spin_unlock_irqrestore(&ath79_gpio_lock, flags);
53 + ath79_gpio_function_setup(mask, 0);
56 -void ath79_gpio_function_setup(u32 set, u32 clear)
57 +void ath79_gpio_function_disable(u32 mask)
59 - void __iomem *reg = ath79_gpio_get_function_reg();
60 - unsigned long flags;
62 - spin_lock_irqsave(&ath79_gpio_lock, flags);
64 - __raw_writel((__raw_readl(reg) & ~clear) | set, reg);
68 - spin_unlock_irqrestore(&ath79_gpio_lock, flags);
69 + ath79_gpio_function_setup(0, mask);
72 void __init ath79_gpio_init(void)