ar71xx: add support for nanostation m xw
authorJohn Crispin <john@openwrt.org>
Mon, 14 Jul 2014 07:38:43 +0000 (07:38 +0000)
committerJohn Crispin <john@openwrt.org>
Mon, 14 Jul 2014 07:38:43 +0000 (07:38 +0000)
SVN-Revision: 41636

target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
target/linux/ar71xx/base-files/etc/uci-defaults/02_network
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/image/Makefile
target/linux/ar71xx/patches-3.10/616-MIPS-ath79-ubnt-xw.patch [new file with mode: 0644]

index 32b82dd7d8313f31b094b39df987424fb506a6e9..a6ca71279b4b37996b620589b9829b3a5da6796d 100755 (executable)
@@ -34,7 +34,7 @@ get_status_led() {
        aw-nr580)
                status_led="aw-nr580:green:ready"
                ;;
-       bullet-m | rocket-m | nano-m | nanostation-m)
+       bullet-m | rocket-m | nano-m | nanostation-m | nanostation-m-xw)
                status_led="ubnt:green:link4"
                ;;
        bxu2000n-2-a1)
index 13d6faf6bc7eff1e45b6b26d0e1c159923ad48a9..41406eb01e26b3602ad848437a330f6ab3c5a6fc 100755 (executable)
@@ -34,7 +34,8 @@ ap113)
 
 bullet-m | \
 nanostation-m | \
-rocket-m)
+rocket-m | \
+nanostation-m-xw)
        ucidef_set_led_rssi "rssilow" "RSSILOW" "ubnt:red:link1" "wlan0" "1" "100" "0" "13"
        ucidef_set_led_rssi "rssimediumlow" "RSSIMEDIUMLOW" "ubnt:orange:link2" "wlan0" "26" "100" "-25" "13"
        ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH" "ubnt:green:link3" "wlan0" "51" "100" "-50" "13"
index 5416599f2a2ef00cf593145c34c3fd7e60d0bffc..cb3a83b301de2467160e3459d99e38c1654d0d04 100755 (executable)
@@ -215,6 +215,13 @@ uap-pro)
        ucidef_add_switch_vlan "switch0" "1" "0 1 2"
        ;;
 
+nanostation-m-xw)
+       ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+       ucidef_add_switch "switch0" "1" "1"
+       ucidef_add_switch_vlan "switch0" "1" "0t 5"
+       ucidef_add_switch_vlan "switch0" "2" "0t 1"
+       ;;
+
 wrt160nl)
        ucidef_set_interfaces_lan_wan "eth0" "eth1"
        ucidef_add_switch "switch0" "1" "1"
index b2ce50620a8a18560444968eeaddf6d1ec480f3c..cce8d25830041ff8dd9466fa2ac7fa12e7ccb159 100755 (executable)
@@ -340,6 +340,9 @@ ar71xx_board_detect() {
        *"Nanostation M")
                name="nanostation-m"
                ;;
+       *"Nanostation M XW")
+               name="nanostation-m-xw"
+               ;;
        *JWAP003)
                name="jwap003"
                ;;
index 30ea88821fe2294fd455e09632f41b52a44202be..d42a704e57e09f6dc0a18d83eec85ab4a5f6db18 100755 (executable)
@@ -166,6 +166,7 @@ platform_check_image() {
        bullet-m | \
        nanostation-m | \
        rocket-m | \
+       nanostation-m-xw | \
        rw2458n | \
        wndap360 | \
        wzr-hp-g300nh2 | \
index 63a6b6e263910302a7827f09684e3abdc1ad4d4d..b82001fa7f79251761796a933117cfacc22609cd 100644 (file)
@@ -554,7 +554,9 @@ define Image/Build/UAPPRO
                -o $(call factoryname,$(1),$(2))
 endef
 
-
+# $(4) = board (XS2, XS5, RS, XM)
+# $(5) = series (BZ, XM, XW)
+# $(6) = chip (ar7240, ar934x)
 define Image/Build/UBNT2
        $(eval fwsize=$(call mtdpartsize,firmware,$(3)))
        $(call Sysupgrade/KRuImage,$(1),$(2),0,$$$$(($(fwsize)-4*64*1024)),64)
@@ -1188,6 +1190,7 @@ $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTROCKETM,ubnt-rocket-m,UBNT-RM,ttyS
 $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTNANOM,ubnt-nano-m,UBNT-NM,ttyS0,115200,XM,XM,ar7240))
 $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTUNIFI,ubnt-unifi,UBNT-UF,ttyS0,115200,XM,BZ,ar7240))
 $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTUNIFIOUTDOOR,ubnt-unifi-outdoor,UBNT-U20,ttyS0,115200,XM,BZ,ar7240))
+$(eval $(call SingleProfile,UBNTXM,64kraw,UBNTNANOMXW,ubnt-nano-m-xw,UBNT-NM-XW,ttyS0,115200,XM,XW,ar934x))
 
 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRG301N,whr-g301n,WHR-G301N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-G301N))
 $(eval $(call SingleProfile,WHRHPG300N,64kraw,WHRHPG300N,whr-hp-g300n,WHR-HP-G300N,ttyS0,115200,$$(whrhpg300n_mtdlayout),WHR-HP-G300N))
@@ -1231,7 +1234,7 @@ $(eval $(call MultiProfile,TLWR842,TLWR842V1 TLWR842V2))
 $(eval $(call MultiProfile,TLWR941,TLWR941NV2 TLWR941NV3 TLWR941NV4 TLWR941NV6))
 $(eval $(call MultiProfile,TLWR1043,TLWR1043V1 TLWR1043V2))
 $(eval $(call MultiProfile,TLWDR4300,TLWDR3500V1 TLWDR3600V1 TLWDR4300V1 TLWDR4300V1IL TLWDR4310V1 MW4530RV1))
-$(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTUNIFI UBNTUNIFIOUTDOOR UAPPRO))
+$(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTNANOMXW UBNTUNIFI UBNTUNIFIOUTDOOR UAPPRO))
 $(eval $(call MultiProfile,WNDR3700,WNDR3700V1 WNDR3700V2 WNDR3800 WNDRMAC WNDRMACV2))
 $(eval $(call MultiProfile,WNR612V2,REALWNR612V2 N150R))
 $(eval $(call MultiProfile,WP543,WP543_2M WP543_4M WP543_8M WP543_16M))
diff --git a/target/linux/ar71xx/patches-3.10/616-MIPS-ath79-ubnt-xw.patch b/target/linux/ar71xx/patches-3.10/616-MIPS-ath79-ubnt-xw.patch
new file mode 100644 (file)
index 0000000..ed2fd24
--- /dev/null
@@ -0,0 +1,73 @@
+--- a/arch/mips/ath79/mach-ubnt-xm.c
++++ b/arch/mips/ath79/mach-ubnt-xm.c
+@@ -332,3 +332,60 @@ static void __init ubnt_uap_pro_setup(vo
+ MIPS_MACHINE(ATH79_MACH_UBNT_UAP_PRO, "UAP-PRO", "Ubiquiti UniFi AP Pro",
+            ubnt_uap_pro_setup);
++#define UBNT_XW_GPIO_LED_L1           11
++#define UBNT_XW_GPIO_LED_L2           16
++#define UBNT_XW_GPIO_LED_L3           13
++#define UBNT_XW_GPIO_LED_L4           14
++
++static struct gpio_led ubnt_xw_leds_gpio[] __initdata = {
++      {
++              .name           = "ubnt:red:link1",
++              .gpio           = UBNT_XW_GPIO_LED_L1,
++              .active_low     = 1,
++      }, {
++              .name           = "ubnt:orange:link2",
++              .gpio           = UBNT_XW_GPIO_LED_L2,
++              .active_low     = 1,
++      }, {
++              .name           = "ubnt:green:link3",
++              .gpio           = UBNT_XW_GPIO_LED_L3,
++              .active_low     = 1,
++      }, {
++              .name           = "ubnt:green:link4",
++              .gpio           = UBNT_XW_GPIO_LED_L4,
++              .active_low     = 1,
++      },
++};
++
++static void __init ubnt_nano_m_xw_setup(void)
++{
++      u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
++
++      ath79_register_m25p80(NULL);
++
++      ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_xw_leds_gpio),
++                               ubnt_xw_leds_gpio);
++      ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
++                                        ARRAY_SIZE(ubnt_xm_gpio_keys),
++                                        ubnt_xm_gpio_keys);
++
++      ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
++      ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
++
++      ath79_register_mdio(0, ~(BIT(0) | BIT(1) | BIT(5)));
++
++      ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_MII_GMAC0 | AR934X_ETH_CFG_MII_GMAC0_SLAVE);
++      ath79_init_mac(ath79_eth0_data.mac_addr,
++                     eeprom + UAP_PRO_MAC0_OFFSET, 0);
++
++      /* GMAC0 is connected to an AR8326 switch */
++      ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
++      ath79_eth0_data.phy_mask = (BIT(0) | BIT(1) | BIT(5));
++      ath79_eth0_data.speed = SPEED_100;
++      ath79_eth0_data.duplex = DUPLEX_FULL;
++      ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
++      ath79_register_eth(0);
++}
++
++MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW",
++           ubnt_nano_m_xw_setup);
+--- a/arch/mips/ath79/machtypes.h
++++ b/arch/mips/ath79/machtypes.h
+@@ -124,6 +124,7 @@ enum ath79_mach_type {
+       ATH79_MACH_UBNT_LSSR71,         /* Ubiquiti LS-SR71 */
+       ATH79_MACH_UBNT_LSX,            /* Ubiquiti LSX */
+       ATH79_MACH_UBNT_NANO_M,         /* Ubiquiti NanoStation M */
++      ATH79_MACH_UBNT_NANO_M_XW,      /* Ubiquiti NanoStation M XW */
+       ATH79_MACH_UBNT_ROCKET_M,       /* Ubiquiti Rocket M */
+       ATH79_MACH_UBNT_RSPRO,          /* Ubiquiti RouterStation Pro */
+       ATH79_MACH_UBNT_RS,             /* Ubiquiti RouterStation */