[OpenWrt-Devel] [PATCH v2] ar71xx: Add UBNT airGateway Pro support

Matthew Reeve mreeve at tenxnetworks.com
Fri Aug 21 03:27:27 EDT 2015


This patch adds kernel and userspace support for the Ubiquiti Networks airGateway Pro.

v2: Modify file bases so that git apply will apply it.

Signed-off-by: Matthew Reeve <mreeve at tenxnetworks.com>

--- /dev/null	2015-08-07 21:02:55.557188068 -0600
+++ b/target/linux/ar71xx/patches-4.1/610-MIPS-ath79-UBNT-add-airGateway-pro-support.patch	2015-08-20 17:20:09.149209987 -0600
@@ -0,0 +1,62 @@ 
+--- a/arch/mips/ath79/mach-ubnt-xm.c	2015-08-19 21:26:47.694157530 -0600
++++ b/arch/mips/ath79/mach-ubnt-xm.c	2015-08-20 16:24:06.908537535 -0600
+@@ -642,3 +642,59 @@ static void __init ubnt_airgateway_setup
+ MIPS_MACHINE(ATH79_MACH_UBNT_AIRGW, "UBNT-AGW", "Ubiquiti AirGateway",
+ 	     ubnt_airgateway_setup);
+ 
++static struct gpio_led ubnt_airgateway_pro_gpio_leds[] __initdata = {
++	{
++		.name	   = "ubnt:blue:wlan",
++		.gpio	   = 13,
++	}, {
++		.name	   = "ubnt:white:status",
++		.gpio	   = 17,
++	},
++};
++
++
++static struct gpio_keys_button airgateway_pro_gpio_keys[] __initdata = {
++	{
++		.desc		= "reset",
++		.type		= EV_KEY,
++		.code		= KEY_RESTART,
++		.debounce_interval	= UBNT_XM_KEYS_DEBOUNCE_INTERVAL,
++		.gpio		= 12,
++		.active_low	= 1,
++	}
++};
++
++static void __init ubnt_airgateway_pro_setup(void)
++{
++	u8 *eeprom = (u8 *) KSEG1ADDR(0x1fff0000);
++	u8 *mac0 = (u8 *) KSEG1ADDR(0x1fff0000);
++
++	ath79_register_m25p80(NULL);
++	ath79_register_leds_gpio(-1, ARRAY_SIZE(ubnt_airgateway_pro_gpio_leds),
++				 ubnt_airgateway_pro_gpio_leds);
++
++	ath79_register_gpio_keys_polled(-1, UBNT_XM_KEYS_POLL_INTERVAL,
++					ARRAY_SIZE(airgateway_pro_gpio_keys),
++					airgateway_pro_gpio_keys);
++
++	ath79_register_wmac(eeprom + UAP_PRO_WMAC_CALDATA_OFFSET, NULL);
++	ap91_pci_init(eeprom + UAP_PRO_PCI_CALDATA_OFFSET, NULL);
++
++
++	ath79_setup_ar934x_eth_cfg(AR934X_ETH_CFG_SW_ONLY_MODE);
++
++	ath79_register_mdio(1, 0x0);
++
++	/* GMAC0 is left unused in this configuration */
++
++	/* GMAC1 is connected to MAC0 on the internal switch */
++	/* The PoE/WAN port connects to port 5 on the internal switch */
++	/* The LAN port connects to port 4 on the internal switch */
++	ath79_init_mac(ath79_eth1_data.mac_addr, mac0, 0);
++	ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
++	ath79_register_eth(1);
++
++}
++
++MIPS_MACHINE(ATH79_MACH_UBNT_AIRGWP, "UBNT-AGWP", "Ubiquiti AirGateway Pro",
++	     ubnt_airgateway_pro_setup);
--- a/target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch	2015-08-19 21:57:36.415324864 -0600
+++ b/target/linux/ar71xx/patches-4.1/700-MIPS-ath79-openwrt-machines.patch	2015-08-20 17:36:24.402046004 -0600
@@ -1,6 +1,6 @@ 
 --- a/arch/mips/ath79/machtypes.h
 +++ b/arch/mips/ath79/machtypes.h
-@@ -16,24 +16,207 @@
+@@ -16,24 +16,208 @@
  
  enum ath79_mach_type {
  	ATH79_MACH_GENERIC = 0,
@@ -159,6 +159,7 @@ 
 +	ATH79_MACH_TL_WR941ND_V5,	/* TP-LINK TL-WR941ND v5 */
 +	ATH79_MACH_TUBE2H,		/* Alfa Network Tube2H */
 +	ATH79_MACH_UBNT_AIRGW,		/* Ubiquiti AirGateway */
++	ATH79_MACH_UBNT_AIRGWP,		/* Ubiquiti AirGateway Pro */
  	ATH79_MACH_UBNT_AIRROUTER,	/* Ubiquiti AirRouter */
  	ATH79_MACH_UBNT_BULLET_M,	/* Ubiquiti Bullet M */
 +	ATH79_MACH_UBNT_LOCO_M_XW, 	/* Ubiquiti Loco M XW */
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh	2015-08-19 22:04:31.601383634 -0600
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh	2015-08-20 17:21:07.789500768 -0600
@@ -326,6 +326,9 @@  ar71xx_board_detect() {
 	*"AirGateway")
 		name="airgateway"
 		;;
+	*"AirGateway Pro")
+		name="airgatewaypro"
+		;;
 	*"AirRouter")
 		name="airrouter"
 		;;
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh	2015-08-19 22:06:58.438111803 -0600
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh	2015-08-20 17:21:21.997571222 -0600
@@ -226,6 +226,7 @@  platform_check_image() {
 	tew-732br | \
 	wrt400n | \
 	airgateway | \
+	airgatewaypro | \
 	airrouter | \
 	bullet-m | \
 	loco-m-xw | \
--- a/target/linux/ar71xx/image/Makefile	2015-08-19 22:07:52.094377841 -0600
+++ b/target/linux/ar71xx/image/Makefile	2015-08-20 17:22:34.965933053 -0600
@@ -840,6 +840,15 @@  define Device/ubnt-air-gateway
 endef
 TARGET_DEVICES += ubnt-air-gateway
 
+define Device/ubnt-air-gateway-pro
+  $(Device/ubnt-xm)
+  BOARDNAME := UBNT-AGWP
+  UBNT_TYPE := AirGWP
+  UBNT_CHIP := ar934x
+  CONSOLE = ttyS0,115200
+endef
+TARGET_DEVICES += ubnt-air-gateway-pro
+
 define Device/ubdev01
   $(Device/ubnt-xm)
   MTDPARTS := spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,7488k(firmware),64k(certs),256k(cfg)ro,64k(EEPROM)ro
--- a/target/linux/ar71xx/base-files/etc/diag.sh	2015-08-20 16:48:36.539825043 -0600
+++ b/target/linux/ar71xx/base-files/etc/diag.sh	2015-08-20 17:22:55.610035421 -0600
@@ -304,7 +304,8 @@  get_status_led() {
 	unifi-outdoor-plus)
 		status_led="ubnt:white:front"
 		;;
-	airgateway)
+	airgateway | \
+	airgatewaypro)
 		status_led="ubnt:white:status"
 		;;
 	whr-g301n | \
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds	2015-08-20 16:48:56.323923147 -0600
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/01_leds	2015-08-20 17:23:16.790140448 -0600
@@ -9,7 +9,8 @@ 
 board=$(ar71xx_board_name)
 
 case "$board" in
-airgateway)
+airgateway | \
+airgatewaypro)
 	ucidef_set_led_wlan "wlan" "WLAN" "ubnt:blue:wlan" "phy0tpt"
 	;;
 alfa-nx)
--- a/target/linux/ar71xx/base-files/etc/uci-defaults/02_network	2015-08-20 16:49:32.100100552 -0600
+++ b/target/linux/ar71xx/base-files/etc/uci-defaults/02_network	2015-08-20 17:24:34.674526656 -0600
@@ -86,6 +86,13 @@  cpe510)
 	ucidef_add_switch_vlan "switch0" "2" "0t 4"
 	;;
 
+airgatewaypro)
+	ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+	ucidef_add_switch "switch0" "1" "1"
+	ucidef_add_switch_vlan "switch0" "1" "0t 4"
+	ucidef_add_switch_vlan "switch0" "2" "0t 5"
+	;;
+
 db120 |\
 rb-2011l | \
 rb-2011uas |\
_______________________________________________
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