8606f3bf6131168101458b9ead7e03572863a6c2
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.8 / 008-MIPS-ath79-simplify-ath79_gpio_function_-routines.patch
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
5
6 commit f160a289e0e8848391f5ec48ff1a014b9c04b162 upstream.
7
8 Make ath79_gpio_function_{en,dis}able to be wrappers
9 around ath79_gpio_function_setup.
10
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>
14 ---
15 arch/mips/ath79/gpio.c | 30 ++++++------------------------
16 1 file changed, 6 insertions(+), 24 deletions(-)
17
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;
22 }
23
24 -void ath79_gpio_function_enable(u32 mask)
25 +void ath79_gpio_function_setup(u32 set, u32 clear)
26 {
27 void __iomem *reg = ath79_gpio_get_function_reg();
28 unsigned long flags;
29
30 spin_lock_irqsave(&ath79_gpio_lock, flags);
31
32 - __raw_writel(__raw_readl(reg) | mask, reg);
33 + __raw_writel((__raw_readl(reg) & ~clear) | set, reg);
34 /* flush write */
35 __raw_readl(reg);
36
37 spin_unlock_irqrestore(&ath79_gpio_lock, flags);
38 }
39
40 -void ath79_gpio_function_disable(u32 mask)
41 +void ath79_gpio_function_enable(u32 mask)
42 {
43 - void __iomem *reg = ath79_gpio_get_function_reg();
44 - unsigned long flags;
45 -
46 - spin_lock_irqsave(&ath79_gpio_lock, flags);
47 -
48 - __raw_writel(__raw_readl(reg) & ~mask, reg);
49 - /* flush write */
50 - __raw_readl(reg);
51 -
52 - spin_unlock_irqrestore(&ath79_gpio_lock, flags);
53 + ath79_gpio_function_setup(mask, 0);
54 }
55
56 -void ath79_gpio_function_setup(u32 set, u32 clear)
57 +void ath79_gpio_function_disable(u32 mask)
58 {
59 - void __iomem *reg = ath79_gpio_get_function_reg();
60 - unsigned long flags;
61 -
62 - spin_lock_irqsave(&ath79_gpio_lock, flags);
63 -
64 - __raw_writel((__raw_readl(reg) & ~clear) | set, reg);
65 - /* flush write */
66 - __raw_readl(reg);
67 -
68 - spin_unlock_irqrestore(&ath79_gpio_lock, flags);
69 + ath79_gpio_function_setup(0, mask);
70 }
71
72 void __init ath79_gpio_init(void)