diff mbox series

[OpenWrt-Devel] ath79: add support for Ubiquiti AirRouter

Message ID 871s7l9xxh.fsf@husum.klickitat.com
State Changes Requested
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel] ath79: add support for Ubiquiti AirRouter | expand

Commit Message

Russell Senior Nov. 16, 2018, 9:25 a.m. UTC
Indoor low-power router with 2.4 GHz radio

CPU:    Atheros AR7241 rev 1
RAM:    32 MB
Flash:  8 MB NOR SPI
Switch: Atheros AR7240
Ports:  1x WAN, 4x LAN 10/100 Ethernet
WLAN:   Atheros AR9285 (2.4 GHz)
USB:	1x USB2 host port

Note: Ethernet WAN/LAN port naming is reversed from ar71xx.
WAN is eth0; LAN is eth1.1.

UART settings: 115200, 8N1

                LEDs
	+--------------------------
	|
	|
	|
	|
	|
	|
	|
	|
    VCC	| x x
     RX	| * x
	| x x
	| x x
     TX	| * x
    GND	| * x
	|
	|
	|
	|
	+--------------------------
		ETHERNET PORTS

Installation from Ubiquiti firmware, is as for other ubnt-xm AirOs devices.

Signed-off-by: Russell Senior <russell@personaltelco.net>
---
 .../linux/ath79/base-files/etc/board.d/01_leds  |  2 ++
 .../ath79/base-files/etc/board.d/02_network     |  5 +++++
 .../etc/hotplug.d/firmware/10-ath9k-eeprom      |  1 +
 .../linux/ath79/dts/ar7241_ubnt_airrouter.dts   | 17 +++++++++++++++++
 target/linux/ath79/image/generic-ubnt.mk        |  7 +++++++
 5 files changed, 32 insertions(+)
 create mode 100644 target/linux/ath79/dts/ar7241_ubnt_airrouter.dts

Comments

Chuanhong Guo Nov. 16, 2018, 11:05 a.m. UTC | #1
Several suggestions inline :)
Russell Senior <russell@personaltelco.net> 于2018年11月16日周五 下午5:25写道:
...
> diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds
> index f04eb7f5c6..1343e03f90 100755
> --- a/target/linux/ath79/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/base-files/etc/board.d/01_leds
> @@ -93,6 +93,8 @@ tplink,tl-wr841-v11)
>         ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04"
>         ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
>         ;;
> +ubnt,airrouter)
> +       ;;
This did nothing. 01_leds is used to add default led configurations.
If this device don't need this step you can skip modifying this file.
>  ubnt,bullet-m|\
>  ubnt,nano-m|\
>  ubnt,rocket-m)
> diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
> index 5f02c5769a..8fb0188bb6 100755
> --- a/target/linux/ath79/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/base-files/etc/board.d/02_network
> @@ -31,6 +31,11 @@ ath79_setup_interfaces()
>         wd,mynet-wifi-rangeextender)
>                 ucidef_set_interface_lan "eth0"
>                 ;;
> +       ubnt,airrouter)
these "case" statements are in alphabetical order. This should be moved below.
> +               ucidef_set_interfaces_lan_wan "eth1" "eth0"
lan has been handled by ucidef_add_switch. Using
ucidef_set_interface_wan "eth0" here should be enough.
And by doing so this default configuration is duplicated with
tp-link,tl-wr841-v7. You can add this router there.
> +               ucidef_add_switch "switch0" \
> +                       "0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
> +               ;;
>         avm,fritz4020)
>                 ucidef_set_interface_wan "eth0"
>                 ucidef_add_switch "switch0" \
...
Russell Senior Nov. 16, 2018, 1:05 p.m. UTC | #2
Indoor low-power router with 2.4 GHz radio

CPU:    Atheros AR7241 rev 1
RAM:    32 MB
Flash:  8 MB NOR SPI
Switch: Atheros AR7240
Ports:  1x WAN, 4x LAN 10/100 Ethernet
WLAN:   Atheros AR9285 (2.4 GHz)
USB:	1x USB2 host port

Note: Ethernet WAN/LAN port naming is reversed from ar71xx.
WAN is eth0; LAN is eth1.1.

UART settings: 115200, 8N1

                LEDs
	+--------------------------
	|
	|
	|
	|
	|
	|
	|
	|
    VCC	| x x
     RX	| * x
	| x x
	| x x
     TX	| * x
    GND	| * x
	|
	|
	|
	|
	+--------------------------
		ETHERNET PORTS

Installation from Ubiquiti firmware, is as for other ubnt-xm AirOs devices.

v2 adds some LED configuration in the device tree, cleans up some
braindamage from v1.

Signed-off-by: Russell Senior <russell@personaltelco.net>
---
 .../ath79/base-files/etc/board.d/02_network   |  3 +-
 .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  1 +
 .../linux/ath79/dts/ar7241_ubnt_airrouter.dts | 42 +++++++++++++++++++
 target/linux/ath79/image/generic-ubnt.mk      |  7 ++++
 4 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ath79/dts/ar7241_ubnt_airrouter.dts

diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
index 5f02c5769a..5fb0546d18 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -116,7 +116,8 @@ ath79_setup_interfaces()
 	buffalo,whr-g301n|\
 	tplink,tl-mr3220-v1|\
 	tplink,tl-mr3420-v1|\
-	tplink,tl-wr841-v7)
+	tplink,tl-wr841-v7|\
+	ubnt,airrouter)
 		ucidef_set_interface_wan "eth0"
 		ucidef_add_switch "switch0" \
 			"0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 020abe2913..68f70174bb 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -141,6 +141,7 @@ case "$FIRMWARE" in
 	tplink,tl-wr741-v1|\
 	tplink,tl-wr743nd-v1|\
 	tplink,tl-wr841-v7|\
+	ubnt,airrouter|\
 	ubnt,bullet-m|\
 	ubnt,nano-m|\
 	ubnt,rocket-m)
diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
new file mode 100644
index 0000000000..eecdf28108
--- /dev/null
+++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7241_ubnt_xm.dtsi"
+
+/ {
+	compatible = "ubnt,airrouter", "qca,ar7241";
+	model = "Ubiquiti AirRouter";
+
+	aliases {
+		led-boot = &globe;
+		led-failsafe = &globe;
+		led-running = &globe;
+		led-upgrade = &globe;
+	};
+
+	leds {
+		status = "disabled";
+	};
+
+	airrouter-leds {
+		compatible = "gpio-leds";
+
+		globe: globe {
+			label = "ubnt:green:globe";
+			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+		};
+
+		power {
+			label = "ubnt:green:power";
+			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&usb_phy {
+        status = "okay";
+};
+
+&usb {
+        status = "okay";
+};
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index bb86c8b288..a6d9b06332 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -63,6 +63,13 @@ define Device/ubnt-wa
   ATH_SOC := ar9342
 endef
 
+define Device/ubnt_airrouter
+  $(Device/ubnt-xm)
+  DEVICE_TITLE := Ubiquiti AirRouter
+  SUPPORTED_DEVICES += airrouter
+endef
+TARGET_DEVICES += ubnt_airrouter
+
 define Device/ubnt_bullet-m
   $(Device/ubnt-xm)
   DEVICE_TITLE := Ubiquiti Bullet-M
John Crispin Nov. 26, 2018, 9:02 a.m. UTC | #3
Hi Russel,

please resend as a new new thread, patchwork failed to properly pick this up

https://patchwork.ozlabs.org/patch/998802/

     John

On 16/11/2018 14:05, Russell Senior wrote:
> Indoor low-power router with 2.4 GHz radio
>
> CPU:    Atheros AR7241 rev 1
> RAM:    32 MB
> Flash:  8 MB NOR SPI
> Switch: Atheros AR7240
> Ports:  1x WAN, 4x LAN 10/100 Ethernet
> WLAN:   Atheros AR9285 (2.4 GHz)
> USB:	1x USB2 host port
>
> Note: Ethernet WAN/LAN port naming is reversed from ar71xx.
> WAN is eth0; LAN is eth1.1.
>
> UART settings: 115200, 8N1
>
>                  LEDs
> 	+--------------------------
> 	|
> 	|
> 	|
> 	|
> 	|
> 	|
> 	|
> 	|
>      VCC	| x x
>       RX	| * x
> 	| x x
> 	| x x
>       TX	| * x
>      GND	| * x
> 	|
> 	|
> 	|
> 	|
> 	+--------------------------
> 		ETHERNET PORTS
>
> Installation from Ubiquiti firmware, is as for other ubnt-xm AirOs devices.
>
> v2 adds some LED configuration in the device tree, cleans up some
> braindamage from v1.
>
> Signed-off-by: Russell Senior <russell@personaltelco.net>
> ---
>   .../ath79/base-files/etc/board.d/02_network   |  3 +-
>   .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  1 +
>   .../linux/ath79/dts/ar7241_ubnt_airrouter.dts | 42 +++++++++++++++++++
>   target/linux/ath79/image/generic-ubnt.mk      |  7 ++++
>   4 files changed, 52 insertions(+), 1 deletion(-)
>   create mode 100644 target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
>
> diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
> index 5f02c5769a..5fb0546d18 100755
> --- a/target/linux/ath79/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/base-files/etc/board.d/02_network
> @@ -116,7 +116,8 @@ ath79_setup_interfaces()
>   	buffalo,whr-g301n|\
>   	tplink,tl-mr3220-v1|\
>   	tplink,tl-mr3420-v1|\
> -	tplink,tl-wr841-v7)
> +	tplink,tl-wr841-v7|\
> +	ubnt,airrouter)
>   		ucidef_set_interface_wan "eth0"
>   		ucidef_add_switch "switch0" \
>   			"0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
> diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> index 020abe2913..68f70174bb 100644
> --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> @@ -141,6 +141,7 @@ case "$FIRMWARE" in
>   	tplink,tl-wr741-v1|\
>   	tplink,tl-wr743nd-v1|\
>   	tplink,tl-wr841-v7|\
> +	ubnt,airrouter|\
>   	ubnt,bullet-m|\
>   	ubnt,nano-m|\
>   	ubnt,rocket-m)
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> new file mode 100644
> index 0000000000..eecdf28108
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> @@ -0,0 +1,42 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar7241_ubnt_xm.dtsi"
> +
> +/ {
> +	compatible = "ubnt,airrouter", "qca,ar7241";
> +	model = "Ubiquiti AirRouter";
> +
> +	aliases {
> +		led-boot = &globe;
> +		led-failsafe = &globe;
> +		led-running = &globe;
> +		led-upgrade = &globe;
> +	};
> +
> +	leds {
> +		status = "disabled";
> +	};
> +
> +	airrouter-leds {
> +		compatible = "gpio-leds";
> +
> +		globe: globe {
> +			label = "ubnt:green:globe";
> +			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		power {
> +			label = "ubnt:green:power";
> +			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
> +		};
> +	};
> +};
> +
> +&usb_phy {
> +        status = "okay";
> +};
> +
> +&usb {
> +        status = "okay";
> +};
> diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
> index bb86c8b288..a6d9b06332 100644
> --- a/target/linux/ath79/image/generic-ubnt.mk
> +++ b/target/linux/ath79/image/generic-ubnt.mk
> @@ -63,6 +63,13 @@ define Device/ubnt-wa
>     ATH_SOC := ar9342
>   endef
>   
> +define Device/ubnt_airrouter
> +  $(Device/ubnt-xm)
> +  DEVICE_TITLE := Ubiquiti AirRouter
> +  SUPPORTED_DEVICES += airrouter
> +endef
> +TARGET_DEVICES += ubnt_airrouter
> +
>   define Device/ubnt_bullet-m
>     $(Device/ubnt-xm)
>     DEVICE_TITLE := Ubiquiti Bullet-M
diff mbox series

Patch

diff --git a/target/linux/ath79/base-files/etc/board.d/01_leds b/target/linux/ath79/base-files/etc/board.d/01_leds
index f04eb7f5c6..1343e03f90 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -93,6 +93,8 @@  tplink,tl-wr841-v11)
 	ucidef_set_led_switch "lan3" "LAN3" "tp-link:green:lan3" "switch0" "0x04"
 	ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
 	;;
+ubnt,airrouter)
+	;;
 ubnt,bullet-m|\
 ubnt,nano-m|\
 ubnt,rocket-m)
diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
index 5f02c5769a..8fb0188bb6 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -31,6 +31,11 @@  ath79_setup_interfaces()
 	wd,mynet-wifi-rangeextender)
 		ucidef_set_interface_lan "eth0"
 		;;
+	ubnt,airrouter)
+		ucidef_set_interfaces_lan_wan "eth1" "eth0"
+		ucidef_add_switch "switch0" \
+			"0@eth1" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
+		;;
 	avm,fritz4020)
 		ucidef_set_interface_wan "eth0"
 		ucidef_add_switch "switch0" \
diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 020abe2913..68f70174bb 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -141,6 +141,7 @@  case "$FIRMWARE" in
 	tplink,tl-wr741-v1|\
 	tplink,tl-wr743nd-v1|\
 	tplink,tl-wr841-v7|\
+	ubnt,airrouter|\
 	ubnt,bullet-m|\
 	ubnt,nano-m|\
 	ubnt,rocket-m)
diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
new file mode 100644
index 0000000000..5b629a63f8
--- /dev/null
+++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
@@ -0,0 +1,17 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7241_ubnt_xm.dtsi"
+
+/ {
+	compatible = "ubnt,airrouter", "qca,ar7241";
+	model = "Ubiquiti AirRouter";
+};
+
+&usb_phy {
+        status = "okay";
+};
+
+&usb {
+        status = "okay";
+};
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index bb86c8b288..a6d9b06332 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -63,6 +63,13 @@  define Device/ubnt-wa
   ATH_SOC := ar9342
 endef
 
+define Device/ubnt_airrouter
+  $(Device/ubnt-xm)
+  DEVICE_TITLE := Ubiquiti AirRouter
+  SUPPORTED_DEVICES += airrouter
+endef
+TARGET_DEVICES += ubnt_airrouter
+
 define Device/ubnt_bullet-m
   $(Device/ubnt-xm)
   DEVICE_TITLE := Ubiquiti Bullet-M