From: Gabor Juhos Date: Tue, 29 Jan 2013 08:19:13 +0000 (+0000) Subject: MIPS: ath79: simplify ath79_gpio_function_* routines X-Git-Tag: upstream/snapshot3+hdmi~5595^2~1^2~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f160a289e0e8848391f5ec48ff1a014b9c04b162;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git MIPS: ath79: simplify ath79_gpio_function_* routines Make ath79_gpio_function_{en,dis}able to be wrappers around ath79_gpio_function_setup. Signed-off-by: Gabor Juhos Patchwork: http://patchwork.linux-mips.org/patch/4871/ Signed-off-by: John Crispin --- diff --git a/arch/mips/ath79/gpio.c b/arch/mips/ath79/gpio.c index 662a10e..b7ed207 100644 --- a/arch/mips/ath79/gpio.c +++ b/arch/mips/ath79/gpio.c @@ -154,46 +154,28 @@ static void __iomem *ath79_gpio_get_function_reg(void) return ath79_gpio_base + reg; } -void ath79_gpio_function_enable(u32 mask) +void ath79_gpio_function_setup(u32 set, u32 clear) { void __iomem *reg = ath79_gpio_get_function_reg(); unsigned long flags; spin_lock_irqsave(&ath79_gpio_lock, flags); - __raw_writel(__raw_readl(reg) | mask, reg); + __raw_writel((__raw_readl(reg) & ~clear) | set, reg); /* flush write */ __raw_readl(reg); spin_unlock_irqrestore(&ath79_gpio_lock, flags); } -void ath79_gpio_function_disable(u32 mask) +void ath79_gpio_function_enable(u32 mask) { - void __iomem *reg = ath79_gpio_get_function_reg(); - unsigned long flags; - - spin_lock_irqsave(&ath79_gpio_lock, flags); - - __raw_writel(__raw_readl(reg) & ~mask, reg); - /* flush write */ - __raw_readl(reg); - - spin_unlock_irqrestore(&ath79_gpio_lock, flags); + ath79_gpio_function_setup(mask, 0); } -void ath79_gpio_function_setup(u32 set, u32 clear) +void ath79_gpio_function_disable(u32 mask) { - void __iomem *reg = ath79_gpio_get_function_reg(); - unsigned long flags; - - spin_lock_irqsave(&ath79_gpio_lock, flags); - - __raw_writel((__raw_readl(reg) & ~clear) | set, reg); - /* flush write */ - __raw_readl(reg); - - spin_unlock_irqrestore(&ath79_gpio_lock, flags); + ath79_gpio_function_setup(0, mask); } void __init ath79_gpio_init(void)