Hey,guys!I am working on a patch for this tl-wr843n based on ar9341 soc.With 
this mach,the lans and wan are arraged like this:
http://postimage.org/image/fhynzvipd/ 


Hope some guy can tell me the method to get the Wan into right place.


/*
 *  TP-LINK TL-WR843N v1 board support
 *
 *  Copyright (C) 2010-2011 Jaiganesh Narayanan <jnaraya...@atheros.com>
 *  Copyright (C) 2011-2012 dongyuqi <729650...@qq.com>
 *
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License version 2 as published
 *  by the Free Software Foundation.
 */


#include <linux/gpio.h>
#include <linux/pci.h>
#include <linux/phy.h>
#include <linux/platform_device.h>
#include <linux/ath9k_platform.h>
#include <linux/ar8216_platform.h>


#include <asm/mach-ath79/ar71xx_regs.h>


#include "common.h"
#include "dev-ap9x-pci.h"
#include "dev-eth.h"
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "dev-spi.h"
#include "dev-usb.h"
#include "dev-wmac.h"
#include "machtypes.h"


#define TL_WR843N_GPIO_LED_3G           11
#define TL_WR843N_GPIO_BTN_RESET        17
#define TL_WR843N_GPIO_LED_WPS          15
#define TL_WR843N_GPIO_USB_POWER        8
#define TL_WR843N_GPIO_LED_WLAN         13
#define TL_WR843N_GPIO_LED_WAN          18
#define TL_WR843N_GPIO_LED_LAN1         19
#define TL_WR843N_GPIO_LED_LAN2         20
#define TL_WR843N_GPIO_LED_LAN3         21
#define TL_WR843N_GPIO_LED_LAN4         12


#define TL_WR843N_GPIO_LED_SYSTEM       14


#define TL_WR843N_KEYS_POLL_INTERVAL    20      /* msecs */
#define TL_WR843N_KEYS_DEBOUNCE_INTERVAL        (3 * 
TL_WR843N_KEYS_POLL_INTERVAL)
/*
#define AR934X_GPIO_FUNC_ETH_SWITCH_LED4_EN     BIT(7)
#define AR934X_GPIO_FUNC_ETH_SWITCH_LED3_EN     BIT(6)
#define AR934X_GPIO_FUNC_ETH_SWITCH_LED2_EN     BIT(5)
#define AR934X_GPIO_FUNC_ETH_SWITCH_LED1_EN     BIT(4)
#define AR934X_GPIO_FUNC_ETH_SWITCH_LED0_EN     BIT(3)*/


static const char *tl_wr843n_part_probes[] = {
        "tp-link",
        NULL,
};


static struct flash_platform_data tl_wr843n_flash_data = {
        .part_probes    = tl_wr843n_part_probes,
};


static struct gpio_led tl_wr843n_leds_gpio[] __initdata = {
        {
                .name           = "tp-link:green:3g",
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:system",
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:wps",
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:wlan",
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:wan",
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:lan1",
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:lan2",
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:lan3",
                .active_low     = 1,
        }, {
                .name           = "tp-link:green:lan4",
                .active_low     = 1,
        }
};


static struct gpio_keys_button tl_wr843n_gpio_keys[] __initdata = {
        {
                .desc           = "reset",
                .type           = EV_KEY,
                .code           = KEY_RESTART,
                .debounce_interval = TL_WR843N_KEYS_DEBOUNCE_INTERVAL,
                .gpio           = 17,
                .active_low     = 1,
        }
};


static void __init tl_wr843n_usb_setup(void)
{
        /* enable power for the USB port */
        gpio_request(TL_WR843N_GPIO_USB_POWER, "USB power");
        gpio_direction_output(TL_WR843N_GPIO_USB_POWER, 1);


        ath79_register_usb();
}


static void __init tl_db12x_setup(void)
{
        u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);
        u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000);
        
/*      ath79_gpio_function_disable(AR934X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
                                     AR934X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
                                     AR934X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
                                     AR934X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
                                     AR934X_GPIO_FUNC_ETH_SWITCH_LED4_EN);*/


//      ath79_gpio_output_select(TL_WR843N_GPIO_LED_USB, AR934X_GPIO_OUT_GPIO);
        
//      db120_gmac_setup();


        ath79_register_mdio(1, 0x0);
        ath79_register_mdio(0, 0x0);


        /* WAN port */
        ath79_init_mac(ath79_eth1_data.mac_addr, mac, 0);
        
        ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
        ath79_eth1_data.speed = SPEED_1000;
        ath79_eth1_data.duplex = DUPLEX_FULL;
//      ath79_eth1_data.has_ar7240_switch = 1;
        
        ath79_register_eth(1);
        
        /* LAN ports */
        ath79_init_mac(ath79_eth0_data.mac_addr, mac, 1);
        
        /*ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
        ath79_eth0_data.speed = SPEED_100;
        ath79_eth0_data.duplex = DUPLEX_FULL;
        ath79_eth0_data.phy_mask = BIT(4);*/
        
        ath79_switch_data.phy4_mii_en = 1;
        ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
        ath79_eth0_data.duplex = DUPLEX_FULL;
        ath79_eth0_data.phy_mask = BIT(4);
        ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;
        
        ath79_register_eth(0);


        ath79_register_wmac(ee, mac);


        //db120_pci_init(ee, mac);
}


static void __init tl_wr843n_setup(void)
{                                        
        ath79_register_m25p80(&tl_wr843n_flash_data);
                                         
        tl_wr843n_usb_setup();
        
        ath79_register_leds_gpio(-1, ARRAY_SIZE(tl_wr843n_leds_gpio),
                                        tl_wr843n_leds_gpio);


        ath79_register_gpio_keys_polled(-1, TL_WR843N_KEYS_POLL_INTERVAL,
                                         ARRAY_SIZE(tl_wr843n_gpio_keys),
                                         tl_wr843n_gpio_keys);
        
        tl_db12x_setup();
}


MIPS_MACHINE(ATH79_MACH_TL_WR843N, "TL-WR843N",
             "TP-LINK TL-WR843N", tl_wr843n_setup);
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to