Could this be back ported to AA?

Kind Regards

Hanno Schupp



On 11/03/2013, at 8:23 AM, Dmytro <dioptimi...@gmail.com> wrote:

> Index: target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c
> ===================================================================
> --- target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c    (revision
> 35934)
> +++ target/linux/ar71xx/files/arch/mips/ath79/mach-tl-wr841n-v8.c    (working 
> copy)
> @@ -1,5 +1,5 @@
> /*
> - *  TP-LINK TL-WR841N/ND v8 board support
> + *  TP-LINK TL-WR841N/ND v8/TL-MR3420 v2 board support
>  *
>  *  Copyright (C) 2012 Gabor Juhos <juh...@openwrt.org>
>  *
> @@ -8,6 +8,7 @@
>  *  by the Free Software Foundation.
>  */
> 
> +#include <linux/gpio.h>
> #include <linux/platform_device.h>
> 
> #include <asm/mach-ath79/ath79.h>
> @@ -18,6 +19,7 @@
> #include "dev-gpio-buttons.h"
> #include "dev-leds-gpio.h"
> #include "dev-m25p80.h"
> +#include "dev-usb.h"
> #include "dev-wmac.h"
> #include "machtypes.h"
> 
> @@ -31,8 +33,11 @@
> #define TL_WR841NV8_GPIO_LED_SYSTEM    14
> 
> #define TL_WR841NV8_GPIO_BTN_RESET    17
> -#define TL_WR841NV8_GPIO_SW_RFKILL    16
> +#define TL_WR841NV8_GPIO_SW_RFKILL    16    /* WPS for MR3420 v2 */
> 
> +#define TL_MR3420V2_GPIO_LED_3G    11
> +#define TL_MR3420V2_GPIO_USB_POWER    4
> +
> #define TL_WR841NV8_KEYS_POLL_INTERVAL    20    /* msecs */
> #define TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL (3 * 
> TL_WR841NV8_KEYS_POLL_INTERVAL)
> 
> @@ -78,6 +83,11 @@
>        .name        = "tp-link:green:wlan",
>        .gpio        = TL_WR841NV8_GPIO_LED_WLAN,
>        .active_low    = 1,
> +    }, {
> +        /* the 3G LED is only present on the MR3420 v2 */
> +        .name        = "tp-link:green:3g",
> +        .gpio        = TL_MR3420V2_GPIO_LED_3G,
> +        .active_low    = 1,
>    },
> };
> 
> @@ -99,24 +109,33 @@
>    }
> };
> 
> -static void __init tl_wr841n_v8_setup(void)
> +static struct gpio_keys_button tl_mr3420v2_gpio_keys[] __initdata = {
> +    {
> +        .desc        = "Reset button",
> +        .type        = EV_KEY,
> +        .code        = KEY_RESTART,
> +        .debounce_interval = TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL,
> +        .gpio        = TL_WR841NV8_GPIO_BTN_RESET,
> +        .active_low    = 1,
> +    }, {
> +        .desc        = "WPS",
> +        .type        = EV_KEY,
> +        .code        = KEY_WPS_BUTTON,
> +        .debounce_interval = TL_WR841NV8_KEYS_DEBOUNCE_INTERVAL,
> +        .gpio        = TL_WR841NV8_GPIO_SW_RFKILL,
> +        .active_low    = 0,
> +    }
> +};
> +
> +static void __init tl_ap123_setup(void)
> {
>    u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
>    u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
> 
> -    ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v8_leds_gpio),
> -                 tl_wr841n_v8_leds_gpio);
> -
> -    ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL,
> -                    ARRAY_SIZE(tl_wr841n_v8_gpio_keys),
> -                    tl_wr841n_v8_gpio_keys);
> -
>    ath79_register_m25p80(&tl_wr841n_v8_flash_data);
> 
>    ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_PHY_SWAP);
> 
> -    ath79_register_mdio(1, 0x0);
> -
>    ath79_init_mac(ath79_eth0_data.mac_addr, mac, -1);
>    ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
> 
> @@ -135,5 +154,43 @@
>    ath79_register_wmac(ee, mac);
> }
> 
> +static void __init tl_wr841n_v8_setup(void)
> +{
> +    tl_ap123_setup();
> +
> +    ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v8_leds_gpio) - 1,
> +                 tl_wr841n_v8_leds_gpio);
> +
> +    ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL,
> +                    ARRAY_SIZE(tl_wr841n_v8_gpio_keys),
> +                    tl_wr841n_v8_gpio_keys);
> +
> +    ath79_register_mdio(1, 0x0);
> +}
> +
> MIPS_MACHINE(ATH79_MACH_TL_WR841N_V8, "TL-WR841N-v8", "TP-LINK
> TL-WR841N/ND v8",
>         tl_wr841n_v8_setup);
> +
> +static void __init tl_mr3420v2_setup(void)
> +{
> +    tl_ap123_setup();
> +
> +    ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr841n_v8_leds_gpio),
> +                tl_wr841n_v8_leds_gpio);
> +
> +    ath79_register_gpio_keys_polled(1, TL_WR841NV8_KEYS_POLL_INTERVAL,
> +                ARRAY_SIZE(tl_mr3420v2_gpio_keys),
> +                tl_mr3420v2_gpio_keys);
> +
> +    ath79_register_mdio(0, 0x0);
> +
> +    /* enable power for the USB port */
> +    gpio_request(TL_MR3420V2_GPIO_USB_POWER, "USB power");
> +    gpio_direction_input(TL_MR3420V2_GPIO_USB_POWER);
> +
> +    ath79_register_usb();
> +    /* END for the USB port */
> +}
> +
> +MIPS_MACHINE(ATH79_MACH_TL_MR3420_V2, "TL-MR3420-v2", "TP-LINK TL-MR3420 v2",
> +         tl_mr3420v2_setup);
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to