diff mbox series

[OpenWrt-Devel,5/5] ath79: Add support for Ubiquiti Nanostation M (XW)

Message ID 1544481988-30032-6-git-send-email-ynezz@true.cz
State Changes Requested
Delegated to: Mathias Kresin
Headers show
Series ath79: Add support for Ubiquiti Nanostation M (XW) | expand

Commit Message

Petr Štetiar Dec. 10, 2018, 10:46 p.m. UTC
CPU:  AR9342 SoC
RAM:      64 MB DDR2
Flash:     8 MB NOR SPI
Ports: 2x100 MBit (24V PoE in, 24V PoE out), AR8236 switch
WLAN:  2.4/5 GHz
UART:      1 UART
LEDs:        Power, 2x Ethernet, 4x RSSI LEDs (orange, red, 2x green)
Buttons:     Reset

Flashing instructions using recovery method over TFTP

 1. Unplug the ethernet cable from the router.
 2. Using paper clip press and hold the router's reset button. Make sure
    you can feel it depressed by the paper clip. Do not release the button
    until step 4.
 3. While keeping the reset button pressed in, plug the ethernet cable
    back into the AP. Keep the reset button depressed until you see the
    device's LEDs flashing in upgrade mode (alternating LED1/LED3 and
    LED2/LED4), this may take up to 25 seconds.
 4. You may release the reset button, now the device should be in TFTP
    transfer mode.
 5. Set a static IP on your Computer's NIC. A static IP of 192.168.1.25/24
    should work.
 6. Plug the PoE injector's LAN cable directly to your computer.
 7. Start tftp client and issue following commands:
     tftp> binary
     tftp> connect 192.168.1.20
     tftp> put openwrt-ath79-generic-ubnt-nano-m-xw-squashfs-factory.bin

Tested-by: Joe Ayers <ae6xe@arrl.net>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 target/linux/ath79/base-files/etc/board.d/01_leds  |  1 +
 .../linux/ath79/base-files/etc/board.d/02_network  |  4 +++
 target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts   | 38 ++++++++++++++++++++++
 target/linux/ath79/image/generic-ubnt.mk           |  7 ++++
 4 files changed, 50 insertions(+)
 create mode 100644 target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts

Comments

Mathias Kresin Dec. 12, 2018, 12:40 p.m. UTC | #1
Hey Petr,

more comments inline.

Mathias

10/12/2018 23:46, Petr Štetiar:
> CPU:  AR9342 SoC
> RAM:      64 MB DDR2
> Flash:     8 MB NOR SPI
> Ports: 2x100 MBit (24V PoE in, 24V PoE out), AR8236 switch
> WLAN:  2.4/5 GHz
> UART:      1 UART
> LEDs:        Power, 2x Ethernet, 4x RSSI LEDs (orange, red, 2x green)
> Buttons:     Reset
> 
> Flashing instructions using recovery method over TFTP
> 
>   1. Unplug the ethernet cable from the router.
>   2. Using paper clip press and hold the router's reset button. Make sure
>      you can feel it depressed by the paper clip. Do not release the button
>      until step 4.
>   3. While keeping the reset button pressed in, plug the ethernet cable
>      back into the AP. Keep the reset button depressed until you see the
>      device's LEDs flashing in upgrade mode (alternating LED1/LED3 and
>      LED2/LED4), this may take up to 25 seconds.
>   4. You may release the reset button, now the device should be in TFTP
>      transfer mode.
>   5. Set a static IP on your Computer's NIC. A static IP of 192.168.1.25/24
>      should work.
>   6. Plug the PoE injector's LAN cable directly to your computer.
>   7. Start tftp client and issue following commands:
>       tftp> binary
>       tftp> connect 192.168.1.20
>       tftp> put openwrt-ath79-generic-ubnt-nano-m-xw-squashfs-factory.bin
> 
> Tested-by: Joe Ayers <ae6xe@arrl.net>
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---
>   target/linux/ath79/base-files/etc/board.d/01_leds  |  1 +
>   .../linux/ath79/base-files/etc/board.d/02_network  |  4 +++
>   target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts   | 38 ++++++++++++++++++++++
>   target/linux/ath79/image/generic-ubnt.mk           |  7 ++++
>   4 files changed, 50 insertions(+)
>   create mode 100644 target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts
> 
> 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 06fb8f4..0f725c0 100755
> --- a/target/linux/ath79/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/base-files/etc/board.d/01_leds
> @@ -104,6 +104,7 @@ tplink,tl-wr841-v11)
>   ubnt,bullet-m|\
>   ubnt,bullet-m-xw|\
>   ubnt,nano-m|\
> +ubnt,nano-m-xw|\
>   ubnt,rocket-m)
>   	ucidef_set_rssimon "wlan0" "200000" "1"
>   	ucidef_set_led_rssi "rssilow" "RSSILOW" "ubnt:red:link1" "wlan0" "1" "100"
> 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 fa7a618..7e1ec4c 100755
> --- a/target/linux/ath79/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/base-files/etc/board.d/02_network
> @@ -188,6 +188,10 @@ ath79_setup_interfaces()
>   		ucidef_add_switch "switch0" \
>   			"0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
>   		;;
> +	ubnt,nano-m-xw)
> +		ucidef_add_switch "switch0" \
> +			"0@eth0" "5:lan" "1:wan"
> +		;;
>   	ubnt,nanostation-ac|\
>   	ubnt,unifiac-mesh-pro|\
>   	ubnt,unifiac-pro)
> diff --git a/target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts b/target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts
> new file mode 100644
> index 0000000..eb5f0b4
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts
> @@ -0,0 +1,38 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +#include "ar9342_ubnt_xw.dtsi"
> +
> +/ {
> +	compatible = "ubnt,nano-m-xw", "ubnt,xw";
> +	model = "Ubiquiti Nanostation M (XW)";
> +};
> +
> +&mdio0 {
> +	status = "okay";
> +
> +	phy4-mii-enable;
> +	phy-mask = <0x23>;
> +
> +	phy4: ethernet-phy@4 {
> +		reg = <0>;
> +		phy-mode = "mii";
> +	};
> +};
> +
> +&eth0 {
> +	status = "okay";
> +
> +	phy-mode = "mii";
> +	phy-handle = <&phy4>;
> +	mtd-mac-address = <&eeprom 0x0>;

Can't the mtd-mac-address be moved to the ar9342_ubnt_xw.dtsi? Don't we 
need pll-data here?

I guess it is related to the issues in "[PATCH 2/5] ath79: 
ubnt-bullet-m-xw: Move common DTS bits into XW include file".

> +
> +	gmac-config {
> +		device = <&gmac>;
> +		mii-gmac0 = <1>;
> +		mii-gmac0-slave = <1>;
> +	};
> +};
> diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
> index cb65aed..e1ba72c 100644
> --- a/target/linux/ath79/image/generic-ubnt.mk
> +++ b/target/linux/ath79/image/generic-ubnt.mk
> @@ -113,6 +113,13 @@ define Device/ubnt_nano-m
>   endef
>   TARGET_DEVICES += ubnt_nano-m
>   
> +define Device/ubnt_nano-m-xw
> +  $(Device/ubnt-xw)
> +  DEVICE_TITLE := Ubiquiti Nanostation M (XW)
> +  SUPPORTED_DEVICES += nano-m-xw nanostation-m-xw

I can not find an ar71xx board which uses "nano-m-xw" as userspace 
boardname. What's the purpose of adding the string to the supported devices?

> +endef
> +TARGET_DEVICES += ubnt_nano-m-xw
> +
>   define Device/ubnt_lap-120
>     $(Device/ubnt-wa)
>     DEVICE_TITLE := Ubiquiti LiteAP ac (LAP-120)
>
Petr Štetiar Dec. 12, 2018, 1:14 p.m. UTC | #2
Mathias Kresin <dev@kresin.me> [2018-12-12 13:40:40]:

Hi,

> > +&eth0 {
> > +	status = "okay";
> > +
> > +	phy-mode = "mii";
> > +	phy-handle = <&phy4>;
> > +	mtd-mac-address = <&eeprom 0x0>;
> 
> Can't the mtd-mac-address be moved to the ar9342_ubnt_xw.dtsi? 

yes, I'll do it.

> Don't we need pll-data here?

Well, I don't think so, as it seems that those defined ar934x.dtsi are good enough
and match what is in ar71xx today. So I've droped it. I'll make it more clear in
v2.

> > +define Device/ubnt_nano-m-xw
> > +  $(Device/ubnt-xw)
> > +  DEVICE_TITLE := Ubiquiti Nanostation M (XW)
> > +  SUPPORTED_DEVICES += nano-m-xw nanostation-m-xw
> 
> I can not find an ar71xx board which uses "nano-m-xw" as userspace
> boardname. What's the purpose of adding the string to the supported devices?

I think, that I've forget to remove nano-m-xw since that's one is added
automatically from device name, but I've added nanostation-m-xw, because I
wasn't able to upgrade from ar71xx without -F.

I wanted to make it first as separate patch with the error message included,
but I've then decided to just add it in the board support patch. Anyway, I've
returned my Nanostation already, so it's going to take some time to reproduce
it again and provide proper explanation for you.

-- ynezz
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 06fb8f4..0f725c0 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -104,6 +104,7 @@  tplink,tl-wr841-v11)
 ubnt,bullet-m|\
 ubnt,bullet-m-xw|\
 ubnt,nano-m|\
+ubnt,nano-m-xw|\
 ubnt,rocket-m)
 	ucidef_set_rssimon "wlan0" "200000" "1"
 	ucidef_set_led_rssi "rssilow" "RSSILOW" "ubnt:red:link1" "wlan0" "1" "100"
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 fa7a618..7e1ec4c 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -188,6 +188,10 @@  ath79_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0@eth1" "2:lan:3" "3:lan:2" "4:lan:1"
 		;;
+	ubnt,nano-m-xw)
+		ucidef_add_switch "switch0" \
+			"0@eth0" "5:lan" "1:wan"
+		;;
 	ubnt,nanostation-ac|\
 	ubnt,unifiac-mesh-pro|\
 	ubnt,unifiac-pro)
diff --git a/target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts b/target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts
new file mode 100644
index 0000000..eb5f0b4
--- /dev/null
+++ b/target/linux/ath79/dts/ar9342_ubnt_nano-m-xw.dts
@@ -0,0 +1,38 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar9342_ubnt_xw.dtsi"
+
+/ {
+	compatible = "ubnt,nano-m-xw", "ubnt,xw";
+	model = "Ubiquiti Nanostation M (XW)";
+};
+
+&mdio0 {
+	status = "okay";
+
+	phy4-mii-enable;
+	phy-mask = <0x23>;
+
+	phy4: ethernet-phy@4 {
+		reg = <0>;
+		phy-mode = "mii";
+	};
+};
+
+&eth0 {
+	status = "okay";
+
+	phy-mode = "mii";
+	phy-handle = <&phy4>;
+	mtd-mac-address = <&eeprom 0x0>;
+
+	gmac-config {
+		device = <&gmac>;
+		mii-gmac0 = <1>;
+		mii-gmac0-slave = <1>;
+	};
+};
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index cb65aed..e1ba72c 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -113,6 +113,13 @@  define Device/ubnt_nano-m
 endef
 TARGET_DEVICES += ubnt_nano-m
 
+define Device/ubnt_nano-m-xw
+  $(Device/ubnt-xw)
+  DEVICE_TITLE := Ubiquiti Nanostation M (XW)
+  SUPPORTED_DEVICES += nano-m-xw nanostation-m-xw
+endef
+TARGET_DEVICES += ubnt_nano-m-xw
+
 define Device/ubnt_lap-120
   $(Device/ubnt-wa)
   DEVICE_TITLE := Ubiquiti LiteAP ac (LAP-120)