1 --- a/arch/mips/ath79/dev-wmac.c
2 +++ b/arch/mips/ath79/dev-wmac.c
4 #include <linux/etherdevice.h>
5 #include <linux/platform_device.h>
6 #include <linux/ath9k_platform.h>
7 +#include <linux/gpio.h>
9 #include <asm/mach-ath79/ath79.h>
10 #include <asm/mach-ath79/ar71xx_regs.h>
14 static u8 ath79_wmac_mac[ETH_ALEN];
15 @@ -325,6 +327,51 @@ void __init ath79_wmac_set_tx_gain_buffa
16 ath79_wmac_data.tx_gain_buffalo = true;
19 +static int ath79_request_ext_lna_gpio(unsigned chain, int gpio)
24 + label = kasprintf(GFP_KERNEL, "external LNA%u", chain);
28 + err = gpio_request_one(gpio, GPIOF_DIR_OUT | GPIOF_INIT_LOW, label);
30 + pr_err("unable to request GPIO%d for external LNA%u\n",
38 +static void ar934x_set_ext_lna_gpio(unsigned chain, int gpio)
43 + if (WARN_ON(chain > 1))
46 + err = ath79_request_ext_lna_gpio(chain, gpio);
51 + sel = AR934X_GPIO_OUT_EXT_LNA0;
53 + sel = AR934X_GPIO_OUT_EXT_LNA1;
55 + ath79_gpio_output_select(gpio, sel);
58 +void __init ath79_wmac_set_ext_lna_gpio(unsigned chain, int gpio)
60 + if (soc_is_ar934x())
61 + ar934x_set_ext_lna_gpio(chain, gpio);
64 void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr)
67 --- a/arch/mips/ath79/dev-wmac.h
68 +++ b/arch/mips/ath79/dev-wmac.h
69 @@ -17,6 +17,7 @@ void ath79_register_wmac_simple(void);
70 void ath79_wmac_disable_2ghz(void);
71 void ath79_wmac_disable_5ghz(void);
72 void ath79_wmac_set_tx_gain_buffalo(void);
73 +void ath79_wmac_set_ext_lna_gpio(unsigned chain, int gpio);
75 bool ar93xx_wmac_read_mac_address(u8 *dest);