1 --- a/arch/mips/ath79/common.h
2 +++ b/arch/mips/ath79/common.h
3 @@ -27,6 +27,7 @@ void ath79_ddr_ctrl_init(void);
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 @@ -57,3 +57,26 @@ void ath79_gpio_function_disable(u32 mas
15 ath79_gpio_function_setup(0, mask);
18 +void __init ath79_gpio_output_select(unsigned gpio, u8 val)
20 + void __iomem *base = ath79_gpio_base;
24 + BUG_ON(!soc_is_ar934x());
26 + if (gpio >= AR934X_GPIO_COUNT)
29 + reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
32 + t = __raw_readl(base + reg);
35 + __raw_writel(t, base + reg);
38 + (void) __raw_readl(base + reg);