Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f160a289 authored by Gabor Juhos's avatar Gabor Juhos Committed by John Crispin
Browse files

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: default avatarGabor Juhos <juhosg@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/4871/


Signed-off-by: default avatarJohn Crispin <blogic@openwrt.org>
parent 8838becd
Loading
Loading
Loading
Loading
+6 −24
Original line number Diff line number Diff line
@@ -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)