[OpenWrt-Devel] [PATCH 2/2] ar71xx: add support for nanostation m xw

Alexander Couzens lynxis at fe80.eu
Mon Jul 14 01:23:09 EDT 2014


---
 target/linux/ar71xx/base-files/etc/diag.sh         |  2 +-
 .../ar71xx/base-files/etc/uci-defaults/01_leds     |  3 +-
 .../ar71xx/base-files/etc/uci-defaults/02_network  |  7 +++
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |  3 +
 .../ar71xx/base-files/lib/upgrade/platform.sh      |  1 +
 target/linux/ar71xx/image/Makefile                 |  7 ++-
 .../patches-3.10/616-MIPS-ath79-ubnt-xw.patch      | 73 ++++++++++++++++++++++
 7 files changed, 92 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ar71xx/patches-3.10/616-MIPS-ath79-ubnt-xw.patch

diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh
index ef172b4..ea7ac74 100755
--- a/target/linux/ar71xx/base-files/etc/diag.sh
+++ b/target/linux/ar71xx/base-files/etc/diag.sh
@@ -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)
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
index fe5ff93..5f0f73e 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds
@@ -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"
diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
index 646425c..a90d846 100755
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network
@@ -207,6 +207,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"
diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index bd277ab..1e50f68 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -331,6 +331,9 @@ ar71xx_board_detect() {
 	*"Nanostation M")
 		name="nanostation-m"
 		;;
+	*"Nanostation M XW")
+		name="nanostation-m-xw"
+		;;
 	*JWAP003)
 		name="jwap003"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 8af9580..a990e1a 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -165,6 +165,7 @@ platform_check_image() {
 	bullet-m | \
 	nanostation-m | \
 	rocket-m | \
+	nanostation-m-xw | \
 	rw2458n | \
 	wndap360 | \
 	wzr-hp-g300nh2 | \
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 6bc1105..487fbe4 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -553,7 +553,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)
@@ -1183,6 +1185,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))
@@ -1226,7 +1229,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
index 0000000..ed2fd24
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.10/616-MIPS-ath79-ubnt-xw.patch
@@ -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 */
-- 
2.0.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list