<p dir="ltr">Ah…Someone added an LED trigger for ath10k serveral days ago…So phy0tpt is able to use now:D</p>
<div class="gmail_quote">2015年2月8日 下午10:25于  <<a href="mailto:roger.pueyo@guifi.net">roger.pueyo@guifi.net</a>>写道:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Roger Pueyo Centelles <<a href="mailto:roger.pueyo@guifi.net">roger.pueyo@guifi.net</a>><br>
<br>
This patch adds support for MERCURY MAC1200R, a dual band 802.11bgn + 802.11ac<br>
router based on the AR9344, with QCA988x ath10k radio and 5 Fast Ethernet ports<br>
<br>
Signed-off-by: Roger Pueyo Centelles <<a href="mailto:roger.pueyo@guifi.net">roger.pueyo@guifi.net</a>><br>
---<br>
 target/linux/ar71xx/base-files/etc/diag.sh         |   3 +<br>
 .../ar71xx/base-files/etc/uci-defaults/01_leds     |   5 +<br>
 .../ar71xx/base-files/etc/uci-defaults/02_network  |   1 +<br>
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |   6 +<br>
 .../ar71xx/base-files/lib/upgrade/platform.sh      |   1 +<br>
 target/linux/ar71xx/config-3.14                    |   1 +<br>
 .../files/arch/mips/ath79/mach-mc-mac1200r.c       | 155 +++++++++++++++++++++<br>
 target/linux/ar71xx/generic/profiles/<a href="http://mercury.mk" target="_blank">mercury.mk</a>    |  17 +++<br>
 target/linux/ar71xx/image/Makefile                 |   1 +<br>
 .../736-MIPS-ath79-add-MC-MAC1200R-support.patch   |  39 ++++++<br>
 10 files changed, 229 insertions(+)<br>
 create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-mc-mac1200r.c<br>
 create mode 100644 target/linux/ar71xx/generic/profiles/<a href="http://mercury.mk" target="_blank">mercury.mk</a><br>
 create mode 100644 target/linux/ar71xx/patches-3.14/736-MIPS-ath79-add-MC-MAC1200R-support.patch<br>
<br>
diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh<br>
index 03ca864..47d99fa 100644<br>
--- a/target/linux/ar71xx/base-files/etc/diag.sh<br>
+++ b/target/linux/ar71xx/base-files/etc/diag.sh<br>
@@ -105,6 +105,9 @@ get_status_led() {<br>
        ls-sr71)<br>
                status_led="ubnt:green:d22"<br>
                ;;<br>
+       mc-mac1200r)<br>
+               status_led="mercury:green:system"<br>
+               ;;<br>
        mr600)<br>
                status_led="mr600:orange:power"<br>
                ;;<br>
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds<br>
index 61d0314..4d7a4a3 100644<br>
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds<br>
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds<br>
@@ -171,6 +171,11 @@ hornet-ub)<br>
        ucidef_set_led_usbdev "usb" "USB" "alfa:blue:usb" "1-1"<br>
        ;;<br>
<br>
+mc-mac1200r)<br>
+       ucidef_set_led_wlan "wlan2g" "WLAN2G" "mercury:green:wlan2g" "phy1tpt"<br>
+       ucidef_set_led_netdev "wlan5g" "WLAN5G" "mercury:green:wlan5g" "wlan0"<br>
+       ;;<br>
+<br>
 mr600)<br>
        ucidef_set_led_wlan "wlan58" "WLAN58" "mr600:green:wlan58" "phy0tpt"<br>
        ;;<br>
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network<br>
index 144fd28..706cb7f 100644<br>
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network<br>
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network<br>
@@ -367,6 +367,7 @@ dir-615-e1 |\<br>
 dir-615-e4 |\<br>
 hiwifi-hc6361 |\<br>
 ja76pf |\<br>
+mc-mac1200r|\<br>
 mynet-n600 |\<br>
 oolite |\<br>
 qihoo-c301 |\<br>
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh<br>
index b5224ae..99e4467 100755<br>
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh<br>
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh<br>
@@ -97,6 +97,9 @@ tplink_board_detect() {<br>
        "015300"*)<br>
                model="EasyLink EL-MINI"<br>
                ;;<br>
+       "120000"*)<br>
+               model="MERCURY MAC1200R"<br>
+               ;;<br>
        "3C0001"*)<br>
                model="OOLITE"<br>
                ;;<br>
@@ -435,6 +438,9 @@ ar71xx_board_detect() {<br>
        *LS-SR71)<br>
                name="ls-sr71"<br>
                ;;<br>
+       *"MAC1200R")<br>
+               name="mc-mac1200r"<br>
+               ;;<br>
        *MR600v2)<br>
                name="mr600v2"<br>
                ;;<br>
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh<br>
index 576ce56..d2a7d8e 100755<br>
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh<br>
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh<br>
@@ -297,6 +297,7 @@ platform_check_image() {<br>
        el-m150 | \<br>
        el-mini | \<br>
        gl-inet | \<br>
+       mc-mac1200r | \<br>
        oolite | \<br>
        smart-300 | \<br>
        tl-mr10u | \<br>
diff --git a/target/linux/ar71xx/config-3.14 b/target/linux/ar71xx/config-3.14<br>
index 82b2d13..b78d4d2 100644<br>
--- a/target/linux/ar71xx/config-3.14<br>
+++ b/target/linux/ar71xx/config-3.14<br>
@@ -64,6 +64,7 @@ CONFIG_ATH79_MACH_HIWIFI_HC6361=y<br>
 CONFIG_ATH79_MACH_HORNET_UB=y<br>
 CONFIG_ATH79_MACH_JA76PF=y<br>
 CONFIG_ATH79_MACH_JWAP003=y<br>
+CONFIG_ATH79_MACH_MC_MAC1200R=y<br>
 CONFIG_ATH79_MACH_MR600=y<br>
 CONFIG_ATH79_MACH_MR900=y<br>
 CONFIG_ATH79_MACH_MYNET_N600=y<br>
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mc-mac1200r.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mc-mac1200r.c<br>
new file mode 100644<br>
index 0000000..70051cf<br>
--- /dev/null<br>
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mc-mac1200r.c<br>
@@ -0,0 +1,155 @@<br>
+/*<br>
+ *  MERCURY MAC1200R board support<br>
+ *<br>
+ *  Copyright (C) 2012 Gabor Juhos <<a href="mailto:juhosg@openwrt.org">juhosg@openwrt.org</a>><br>
+ *  Copyright (C) 2013 Gui Iribarren <<a href="mailto:gui@altermundi.net">gui@altermundi.net</a>><br>
+ *<br>
+ *  This program is free software; you can redistribute it and/or modify it<br>
+ *  under the terms of the GNU General Public License version 2 as published<br>
+ *  by the Free Software Foundation.<br>
+ */<br>
+<br>
+#include <linux/pci.h><br>
+#include <linux/phy.h><br>
+#include <linux/gpio.h><br>
+#include <linux/platform_device.h><br>
+#include <linux/ath9k_platform.h><br>
+#include <linux/ar8216_platform.h><br>
+<br>
+#include <asm/mach-ath79/ar71xx_regs.h><br>
+<br>
+#include "common.h"<br>
+#include "dev-ap9x-pci.h"<br>
+#include "dev-eth.h"<br>
+#include "dev-gpio-buttons.h"<br>
+#include "dev-leds-gpio.h"<br>
+#include "dev-m25p80.h"<br>
+#include "dev-spi.h"<br>
+#include "dev-wmac.h"<br>
+#include "machtypes.h"<br>
+<br>
+#define MAC1200R_GPIO_LED_WLAN2G       13<br>
+#define MAC1200R_GPIO_LED_WLAN5G       17<br>
+#define MAC1200R_GPIO_LED_SYSTEM       14<br>
+#define MAC1200R_GPIO_LED_WPS          11<br>
+#define MAC1200R_GPIO_LED_WAN          12<br>
+#define MAC1200R_GPIO_LED_LAN1         15<br>
+#define MAC1200R_GPIO_LED_LAN2         21<br>
+#define MAC1200R_GPIO_LED_LAN3         22<br>
+#define MAC1200R_GPIO_LED_LAN4         20<br>
+<br>
+#define MAC1200R_GPIO_BTN_WPS          16<br>
+<br>
+#define MAC1200R_KEYS_POLL_INTERVAL    20      /* msecs */<br>
+#define MAC1200R_KEYS_DEBOUNCE_INTERVAL        (3 * MAC1200R_KEYS_POLL_INTERVAL)<br>
+<br>
+#define MAC1200R_MAC0_OFFSET           0<br>
+#define MAC1200R_MAC1_OFFSET           6<br>
+#define MAC1200R_WMAC_CALDATA_OFFSET   0x1000<br>
+#define MAC1200R_PCIE_CALDATA_OFFSET   0x5000<br>
+<br>
+static const char *mac1200r_part_probes[] = {<br>
+       "tp-link",<br>
+       NULL,<br>
+};<br>
+<br>
+static struct flash_platform_data mac1200r_flash_data = {<br>
+       .part_probes    = mac1200r_part_probes,<br>
+};<br>
+<br>
+static struct gpio_led mac1200r_leds_gpio[] __initdata = {<br>
+       {<br>
+               .name           = "mercury:green:wps",<br>
+               .gpio           = MAC1200R_GPIO_LED_WPS,<br>
+               .active_low     = 1,<br>
+       },<br>
+       {<br>
+               .name           = "mercury:green:system",<br>
+               .gpio           = MAC1200R_GPIO_LED_SYSTEM,<br>
+               .active_low     = 1,<br>
+       },<br>
+       {<br>
+               .name           = "mercury:green:wlan2g",<br>
+               .gpio           = MAC1200R_GPIO_LED_WLAN2G,<br>
+               .active_low     = 1,<br>
+       },<br>
+       {<br>
+               .name           = "mercury:green:wlan5g",<br>
+               .gpio           = MAC1200R_GPIO_LED_WLAN5G,<br>
+               .active_low     = 1,<br>
+       },<br>
+};<br>
+<br>
+static struct gpio_keys_button mac1200r_gpio_keys[] __initdata = {<br>
+       {<br>
+               .desc           = "Reset button",<br>
+               .type           = EV_KEY,<br>
+               .code           = KEY_RESTART,<br>
+               .debounce_interval = MAC1200R_KEYS_DEBOUNCE_INTERVAL,<br>
+               .gpio           = MAC1200R_GPIO_BTN_WPS,<br>
+               .active_low     = 1,<br>
+       },<br>
+};<br>
+<br>
+<br>
+static void __init mac1200r_setup(void)<br>
+{<br>
+       u8 *mac = (u8 *) KSEG1ADDR(0x1f01fc00);<br>
+       u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);<br>
+       u8 tmpmac[ETH_ALEN];<br>
+<br>
+       ath79_register_m25p80(&mac1200r_flash_data);<br>
+<br>
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(mac1200r_leds_gpio),<br>
+                                       mac1200r_leds_gpio);<br>
+<br>
+       ath79_register_gpio_keys_polled(-1, MAC1200R_KEYS_POLL_INTERVAL,<br>
+                                       ARRAY_SIZE(mac1200r_gpio_keys),<br>
+                                       mac1200r_gpio_keys);<br>
+<br>
+       ath79_init_mac(tmpmac, mac, 0);<br>
+       ath79_wmac_disable_5ghz();<br>
+       ath79_register_wmac(art + MAC1200R_WMAC_CALDATA_OFFSET, tmpmac);<br>
+<br>
+       ath79_init_mac(tmpmac, mac, 1);<br>
+       ap91_pci_init(art + MAC1200R_PCIE_CALDATA_OFFSET, tmpmac);<br>
+<br>
+       ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE);<br>
+<br>
+       ath79_register_mdio(1, 0x0);<br>
+<br>
+       /* LAN */<br>
+       ath79_init_mac(ath79_eth1_data.mac_addr, mac, -1);<br>
+<br>
+       /* GMAC1 is connected to the internal switch */<br>
+       ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;<br>
+<br>
+       ath79_register_eth(1);<br>
+<br>
+       /* WAN */<br>
+       ath79_init_mac(ath79_eth0_data.mac_addr, mac, 2);<br>
+<br>
+       /* GMAC0 is connected to the PHY4 of the internal switch */<br>
+       ath79_switch_data.phy4_mii_en = 1;<br>
+       ath79_switch_data.phy_poll_mask = BIT(4);<br>
+       ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;<br>
+       ath79_eth0_data.phy_mask = BIT(4);<br>
+       ath79_eth0_data.mii_bus_dev = &ath79_mdio1_device.dev;<br>
+<br>
+       ath79_register_eth(0);<br>
+<br>
+       ath79_gpio_output_select(MAC1200R_GPIO_LED_LAN1,<br>
+                                AR934X_GPIO_OUT_LED_LINK3);<br>
+       ath79_gpio_output_select(MAC1200R_GPIO_LED_LAN2,<br>
+                                AR934X_GPIO_OUT_LED_LINK2);<br>
+       ath79_gpio_output_select(MAC1200R_GPIO_LED_LAN3,<br>
+                                AR934X_GPIO_OUT_LED_LINK1);<br>
+       ath79_gpio_output_select(MAC1200R_GPIO_LED_LAN4,<br>
+                                AR934X_GPIO_OUT_LED_LINK0);<br>
+       ath79_gpio_output_select(MAC1200R_GPIO_LED_WAN,<br>
+                                AR934X_GPIO_OUT_LED_LINK4);<br>
+}<br>
+<br>
+MIPS_MACHINE(ATH79_MACH_MC_MAC1200R, "MC-MAC1200R",<br>
+            "MERCURY MAC1200R",<br>
+            mac1200r_setup);<br>
diff --git a/target/linux/ar71xx/generic/profiles/<a href="http://mercury.mk" target="_blank">mercury.mk</a> b/target/linux/ar71xx/generic/profiles/<a href="http://mercury.mk" target="_blank">mercury.mk</a><br>
new file mode 100644<br>
index 0000000..e66d70d<br>
--- /dev/null<br>
+++ b/target/linux/ar71xx/generic/profiles/<a href="http://mercury.mk" target="_blank">mercury.mk</a><br>
@@ -0,0 +1,17 @@<br>
+#<br>
+# Copyright (C) 2015 OpenWrt.org<br>
+#<br>
+# This is free software, licensed under the GNU General Public License v2.<br>
+# See /LICENSE for more information.<br>
+#<br>
+<br>
+<br>
+define Profile/MAC1200R<br>
+       NAME:=MERCURY MAC1200R<br>
+       PACKAGES:=kmod-ath10k<br>
+endef<br>
+<br>
+define Profile/MAC1200R/Description<br>
+       Package set optimized for the MERCURY MAC1200R.<br>
+endef<br>
+$(eval $(call Profile,MAC1200R))<br>
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile<br>
index 84dd22d..24e025e 100644<br>
--- a/target/linux/ar71xx/image/Makefile<br>
+++ b/target/linux/ar71xx/image/Makefile<br>
@@ -1382,6 +1382,7 @@ $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,ELM150,el-m150,EL-M150,ttyATH0,11<br>
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,ELMINI,el-mini,EL-MINI,ttyATH0,115200,0x01530001,1,8Mlzma))<br>
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,GLINET6408A,gl-inet-6408A-v1,GL-INET,ttyATH0,115200,0x08000001,1,8Mlzma))<br>
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,GLINET6416A,gl-inet-6416A-v1,GL-INET,ttyATH0,115200,0x08000001,1,16Mlzma))<br>
+$(eval $(call SingleProfile,TPLINK-LZMA,64kraw,MAC1200R,mc-mac1200r,MC-MAC1200R,ttyS0,115200,0x12000001,1,8Mlzma))<br>
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLMR10U,tl-mr10u-v1,TL-MR10U,ttyATH0,115200,0x00100101,1,4Mlzma))<br>
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLMR11UV1,tl-mr11u-v1,TL-MR11U,ttyATH0,115200,0x00110101,1,4Mlzma))<br>
 $(eval $(call SingleProfile,TPLINK-LZMA,64kraw,TLMR11UV2,tl-mr11u-v2,TL-MR11U,ttyATH0,115200,0x00110102,1,4Mlzma))<br>
diff --git a/target/linux/ar71xx/patches-3.14/736-MIPS-ath79-add-MC-MAC1200R-support.patch b/target/linux/ar71xx/patches-3.14/736-MIPS-ath79-add-MC-MAC1200R-support.patch<br>
new file mode 100644<br>
index 0000000..44c115f<br>
--- /dev/null<br>
+++ b/target/linux/ar71xx/patches-3.14/736-MIPS-ath79-add-MC-MAC1200R-support.patch<br>
@@ -0,0 +1,39 @@<br>
+--- a/arch/mips/ath79/Kconfig<br>
++++ b/arch/mips/ath79/Kconfig<br>
+@@ -374,6 +374,16 @@<br>
+       select ATH79_DEV_LEDS_GPIO<br>
+       select ATH79_DEV_M25P80<br>
+<br>
++config ATH79_MACH_MC_MAC1200R<br>
++      bool "MERCURY MAC1200R board support"<br>
++      select SOC_AR934X<br>
++      select ATH79_DEV_AP9X_PCI if PCI<br>
++      select ATH79_DEV_ETH<br>
++      select ATH79_DEV_GPIO_BUTTONS<br>
++      select ATH79_DEV_LEDS_GPIO<br>
++      select ATH79_DEV_M25P80<br>
++      select ATH79_DEV_WMAC<br>
++<br>
+ config ATH79_MACH_RB4XX<br>
+       bool "MikroTik RouterBOARD 4xx series support"<br>
+       select SOC_AR71XX<br>
+--- a/arch/mips/ath79/Makefile<br>
++++ b/arch/mips/ath79/Makefile<br>
+@@ -66,6 +66,7 @@<br>
+ obj-$(CONFIG_ATH79_MACH_JA76PF)               += mach-ja76pf.o<br>
+ obj-$(CONFIG_ATH79_MACH_JWAP003)      += mach-jwap003.o<br>
+ obj-$(CONFIG_ATH79_MACH_HORNET_UB)    += mach-hornet-ub.o<br>
++obj-$(CONFIG_ATH79_MACH_MC_MAC1200R)     += mach-mc-mac1200r.o<br>
+ obj-$(CONFIG_ATH79_MACH_MR600)                += mach-mr600.o<br>
+ obj-$(CONFIG_ATH79_MACH_MYNET_N600)   += mach-mynet-n600.o<br>
+ obj-$(CONFIG_ATH79_MACH_MYNET_REXT)   += mach-mynet-rext.o<br>
+--- a/arch/mips/ath79/machtypes.h<br>
++++ b/arch/mips/ath79/machtypes.h<br>
+@@ -89,6 +89,7 @@<br>
+       ATH79_MACH_TEW_673GRU,          /* TRENDnet TEW-673GRU */<br>
+       ATH79_MACH_TEW_712BR,           /* TRENDnet TEW-712BR */<br>
+       ATH79_MACH_TEW_732BR,           /* TRENDnet TEW-732BR */<br>
++      ATH79_MACH_MC_MAC1200R,         /* MERCURY MAC1200R*/<br>
+       ATH79_MACH_TL_MR10U,            /* TP-LINK TL-MR10U */<br>
+       ATH79_MACH_TL_MR11U,            /* TP-LINK TL-MR11U */<br>
+       ATH79_MACH_TL_MR13U,            /* TP-LINK TL-MR13U */<br>
--<br>
2.1.4<br>
_______________________________________________<br>
openwrt-devel mailing list<br>
<a href="mailto:openwrt-devel@lists.openwrt.org">openwrt-devel@lists.openwrt.org</a><br>
<a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" target="_blank">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a><br>
</blockquote></div>