1 --- a/arch/mips/ath79/common.h
2 +++ b/arch/mips/ath79/common.h
3 @@ -26,6 +26,7 @@ void ath79_ddr_wb_flush(unsigned int reg
4 void ath79_gpio_function_enable(u32 mask);
5 void ath79_gpio_function_disable(u32 mask);
6 void ath79_gpio_function_setup(u32 set, u32 clear);
7 +void ath79_gpio_output_select(unsigned gpio, u8 val);
8 void ath79_gpio_init(void);
10 #endif /* __ATH79_COMMON_H */
11 --- a/arch/mips/ath79/gpio.c
12 +++ b/arch/mips/ath79/gpio.c
13 @@ -184,6 +184,34 @@ void ath79_gpio_function_setup(u32 set,
14 spin_unlock_irqrestore(&ath79_gpio_lock, flags);
17 +void __init ath79_gpio_output_select(unsigned gpio, u8 val)
19 + void __iomem *base = ath79_gpio_base;
20 + unsigned long flags;
24 + BUG_ON(!soc_is_ar934x());
26 + if (gpio >= AR934X_GPIO_COUNT)
29 + reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
32 + spin_lock_irqsave(&ath79_gpio_lock, flags);
34 + t = __raw_readl(base + reg);
37 + __raw_writel(t, base + reg);
40 + (void) __raw_readl(base + reg);
42 + spin_unlock_irqrestore(&ath79_gpio_lock, flags);
45 void __init ath79_gpio_init(void)