From d19530c69337ad0b378d8d74ae7fa6185c95aeb6 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sun, 20 Jul 2014 17:30:17 +0000 Subject: [PATCH] ar71xx: Add UBNT airGateway support This patch adds support for the Ubiquiti Networks airGateway. Based in part on code posted by David Hutchison on openwrt-devel: https://lists.openwrt.org/pipermail/openwrt-devel/2013-December/023035.html Signed-off-by: Matthew Reeve SVN-Revision: 41766 --- target/linux/ar71xx/base-files/etc/diag.sh | 3 + .../base-files/etc/uci-defaults/01_leds | 3 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 1 + target/linux/ar71xx/image/Makefile | 3 +- ...22-MIPS-ath79-add-airGateway-support.patch | 75 +++++++++++++++++++ 6 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 target/linux/ar71xx/patches-3.10/722-MIPS-ath79-add-airGateway-support.patch diff --git a/target/linux/ar71xx/base-files/etc/diag.sh b/target/linux/ar71xx/base-files/etc/diag.sh index 69590027d8..d94d410863 100755 --- a/target/linux/ar71xx/base-files/etc/diag.sh +++ b/target/linux/ar71xx/base-files/etc/diag.sh @@ -229,6 +229,9 @@ get_status_led() { uap-pro) status_led="ubnt:white:dome" ;; + airgateway) + status_led="ubnt:white:status" + ;; whr-g301n | \ whr-hp-g300n | \ whr-hp-gn | \ 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 b1477ae070..f7757de0f3 100755 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds @@ -9,6 +9,9 @@ board=$(ar71xx_board_name) case "$board" in +airgateway) + ucidef_set_led_wlan "wlan" "WLAN" "ubnt:blue:wlan" "phy0tpt" + ;; alfa-nx) ucidef_set_led_netdev "wan" "WAN" "alfa:green:led_2" "eth0" ucidef_set_led_netdev "lan" "LAN" "alfa:green:led_3" "eth1" diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index 23cee9acb7..ef7240efdb 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -229,6 +229,9 @@ ar71xx_board_detect() { *"Oolite V1.0") name="oolite" ;; + *"AirGateway") + name="airgateway" + ;; *"AirRouter") name="airrouter" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index fe627ab4f4..e25410bc9f 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -186,6 +186,7 @@ platform_check_image() { tew-712br | \ tew-732br | \ wrt400n | \ + airgateway | \ airrouter | \ bullet-m | \ nanostation-m | \ diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile index 822f95d342..a7fd5687ac 100644 --- a/target/linux/ar71xx/image/Makefile +++ b/target/linux/ar71xx/image/Makefile @@ -1218,6 +1218,7 @@ $(eval $(call SingleProfile,UBNTXM,64kraw,UBNTNANOM,ubnt-nano-m,UBNT-NM,ttyS0,11 $(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,UBNTXM,64kraw,UBNTAIRGW,ubnt-air-gateway,UBNT-AGW,ttyATH0,115200,XM,AirGW,ar933x)) $(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)) @@ -1262,7 +1263,7 @@ $(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,TUBE2H,TUBE2H8M TUBE2H16M)) -$(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTNANOMXW UBNTUNIFI UBNTUNIFIOUTDOOR UAPPRO)) +$(eval $(call MultiProfile,UBNT,UBNTAIRROUTER UBNTRS UBNTRSPRO UBNTLSSR71 UBNTBULLETM UBNTROCKETM UBNTNANOM UBNTNANOMXW UBNTUNIFI UBNTUNIFIOUTDOOR UAPPRO UBNTAIRGW)) $(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/722-MIPS-ath79-add-airGateway-support.patch b/target/linux/ar71xx/patches-3.10/722-MIPS-ath79-add-airGateway-support.patch new file mode 100644 index 0000000000..d26cc2c153 --- /dev/null +++ b/target/linux/ar71xx/patches-3.10/722-MIPS-ath79-add-airGateway-support.patch @@ -0,0 +1,75 @@ +--- a/arch/mips/ath79/mach-ubnt-xm.c 2014-07-18 02:43:23.110693216 +0000 ++++ b/arch/mips/ath79/mach-ubnt-xm.c 2014-07-18 03:20:28.542701485 +0000 +@@ -17,9 +17,11 @@ + #include + #include + ++#include + #include + #include + ++#include "common.h" + #include "dev-ap9x-pci.h" + #include "dev-eth.h" + #include "dev-gpio-buttons.h" +@@ -389,3 +391,50 @@ static void __init ubnt_nano_m_xw_setup( + + MIPS_MACHINE(ATH79_MACH_UBNT_NANO_M_XW, "UBNT-NM-XW", "Ubiquiti Nanostation M XW", + ubnt_nano_m_xw_setup); ++ ++static struct gpio_led ubnt_airgateway_gpio_leds[] __initdata = { ++ { ++ .name = "ubnt:blue:wlan", ++ .gpio = 0, ++ }, { ++ .name = "ubnt:white:status", ++ .gpio = 1, ++ }, ++}; ++ ++static void __init ubnt_airgateway_setup(void) ++{ ++ u32 t; ++ u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000); ++ u8 *mac1 = (u8 *) KSEG1ADDR(0x1fff0000 + ETH_ALEN); ++ u8 *ee = (u8 *) KSEG1ADDR(0x1fff1000); ++ ++ ++ ath79_gpio_function_disable(AR933X_GPIO_FUNC_ETH_SWITCH_LED0_EN | ++ AR933X_GPIO_FUNC_ETH_SWITCH_LED1_EN | ++ AR933X_GPIO_FUNC_ETH_SWITCH_LED2_EN | ++ AR933X_GPIO_FUNC_ETH_SWITCH_LED3_EN | ++ AR933X_GPIO_FUNC_ETH_SWITCH_LED4_EN); ++ ++ t = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP); ++ t |= AR933X_BOOTSTRAP_MDIO_GPIO_EN; ++ ath79_reset_wr(AR933X_RESET_REG_BOOTSTRAP, t); ++ ++ ath79_register_m25p80(NULL); ++ ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_gpio_leds), ++ ubnt_airgateway_gpio_leds); ++ ++ ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0); ++ ath79_init_mac(ath79_eth0_data.mac_addr, mac1, 0); ++ ++ ath79_register_mdio(0, 0x0); ++ ++ ath79_register_eth(1); ++ ath79_register_eth(0); ++ ++ ath79_register_wmac(ee, NULL); ++} ++ ++MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway", ++ ubnt_airgateway_setup); ++ +--- a/arch/mips/ath79/machtypes.h 2014-07-18 02:45:30.590693688 +0000 ++++ b/arch/mips/ath79/machtypes.h 2014-07-18 02:51:02.490694922 +0000 +@@ -143,6 +143,7 @@ enum ath79_mach_type { + ATH79_MACH_TL_WR842N_V2, /* TP-LINK TL-WR842N/ND v2 */ + ATH79_MACH_TL_WR941ND, /* TP-LINK TL-WR941ND */ + ATH79_MACH_TUBE2H, /* Alfa Network Tube2H */ ++ ATH79_MACH_UBNT_AIRGW, /* Ubiquiti AirGateway */ + ATH79_MACH_UBNT_AIRROUTER, /* Ubiquiti AirRouter */ + ATH79_MACH_UBNT_BULLET_M, /* Ubiquiti Bullet M */ + ATH79_MACH_UBNT_LSSR71, /* Ubiquiti LS-SR71 */ -- 2.25.1