diff mbox series

[OpenWrt-Devel] ath79: Add support for Ubiquity Bullet M2HP

Message ID 1542285163-12370-1-git-send-email-ynezz@true.cz
State Superseded
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel] ath79: Add support for Ubiquity Bullet M2HP | expand

Commit Message

Petr Štetiar Nov. 15, 2018, 12:32 p.m. UTC
From: Petr Štetiar <pstetiar@ext.nomosphere.fr>

CPU: AR9342 SoC
RAM:     64 MB DDR2
Flash:    8 MB NOR SPI
Ports:  100 MBit (24V PoE in)
WLAN:   2.4 GHz
UART:     1 UART on PCB marked as J1 with 115200 8N1 config
LEDs:       Power, Ethernet, WPS, USB, RF 2.4G, RF 5G
Buttons:    Reset

UART connection details

  .---------------------------------.
  |                                 |
[ETH]          J1                 [ANT]
  |    o VCC o RX o TX o GND        |
  `---------------------------------'

Flashing instructions

 A) Serial console, U-Boot and TFTP

   1. Connect to serial header J1 on the PCB
   2. Power on device and enter U-Boot console
   3. Set up TFTP server serving an OpenWrt initramfs build
   4. Load initramfs build using the command tftpboot in the U-Boot cli
   5. Boot the loaded image using the command bootm
   6. Copy squashfs OpenWrt sysupgrade build to the booted device
   7. Use mtd to write sysupgrade to partition "firmware"
   8. Reboot and enjoy

 B) Sysupgrade over SSH in airOS v6.1.7

   1. Upgrade or downgrade airOS to v6.1.7
   2. git clone https://github.com/true-systems/ubnt-bullet-m2hp-openwrt-flashing
   3. cd ubnt-bullet-m2hp-openwrt-flashing
   4. less README.md
   5. make flash FW_UBNT=/path/to/your/openwrt-ath79-generic-ubnt_bullet-m2hp-squashfs-sysupgrade.bin

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  |  1 +
 target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts | 66 ++++++++++++++++
 target/linux/ath79/dts/ar9342_ubnt_xw.dtsi         | 88 ++++++++++++++++++++++
 target/linux/ath79/image/generic-ubnt.mk           | 16 ++++
 5 files changed, 172 insertions(+)
 create mode 100644 target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts
 create mode 100644 target/linux/ath79/dts/ar9342_ubnt_xw.dtsi

Comments

Lech Perczak Nov. 15, 2018, 6:30 p.m. UTC | #1
Hi,

Just a couple of remarks inline, based on my knowledge about XM series.

W dniu 2018-11-15 o 13:32, Petr Štetiar pisze:
> From: Petr Štetiar <pstetiar@ext.nomosphere.fr>
>
> CPU: AR9342 SoC
> RAM:     64 MB DDR2
> Flash:    8 MB NOR SPI
> Ports:  100 MBit (24V PoE in)
> WLAN:   2.4 GHz
> UART:     1 UART on PCB marked as J1 with 115200 8N1 config
> LEDs:       Power, Ethernet, WPS, USB, RF 2.4G, RF 5G
> Buttons:    Reset
>
> UART connection details
>
>    .---------------------------------.
>    |                                 |
> [ETH]          J1                 [ANT]
>    |    o VCC o RX o TX o GND        |
>    `---------------------------------'
>
> Flashing instructions
>
>   A) Serial console, U-Boot and TFTP
>
>     1. Connect to serial header J1 on the PCB
>     2. Power on device and enter U-Boot console
>     3. Set up TFTP server serving an OpenWrt initramfs build
>     4. Load initramfs build using the command tftpboot in the U-Boot cli
>     5. Boot the loaded image using the command bootm
>     6. Copy squashfs OpenWrt sysupgrade build to the booted device
>     7. Use mtd to write sysupgrade to partition "firmware"
>     8. Reboot and enjoy
>
>   B) Sysupgrade over SSH in airOS v6.1.7
>
>     1. Upgrade or downgrade airOS to v6.1.7
>     2. git clone https://github.com/true-systems/ubnt-bullet-m2hp-openwrt-flashing
>     3. cd ubnt-bullet-m2hp-openwrt-flashing
>     4. less README.md
>     5. make flash FW_UBNT=/path/to/your/openwrt-ath79-generic-ubnt_bullet-m2hp-squashfs-sysupgrade.bin
>
> 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  |  1 +
>   target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts | 66 ++++++++++++++++
>   target/linux/ath79/dts/ar9342_ubnt_xw.dtsi         | 88 ++++++++++++++++++++++
>   target/linux/ath79/image/generic-ubnt.mk           | 16 ++++
>   5 files changed, 172 insertions(+)
>   create mode 100644 target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts
>   create mode 100644 target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
>
> 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 f04eb7f..281686e 100755
> --- a/target/linux/ath79/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/base-files/etc/board.d/01_leds
> @@ -94,6 +94,7 @@ tplink,tl-wr841-v11)
>   	ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
>   	;;
>   ubnt,bullet-m|\
> +ubnt,bullet-m2hp|\
>   ubnt,nano-m|\
>   ubnt,rocket-m)
>   	ucidef_set_rssimon "wlan0" "200000" "1"
> 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 5f02c57..8556bd3 100755
> --- a/target/linux/ath79/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/base-files/etc/board.d/02_network
> @@ -22,6 +22,7 @@ ath79_setup_interfaces()
>   	tplink,tl-wa901nd-v2|\
>   	tplink,tl-wr703n|\
>   	ubnt,bullet-m|\
> +	ubnt,bullet-m2hp|\
I'd call it ubnt,bullet-m-xw, as this patch will very likely support 
Bullet-M5HP also.
>   	ubnt,lap-120|\
>   	ubnt,nanostation-ac-loco|\
>   	ubnt,rocket-m|\
> diff --git a/target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts b/target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts
> new file mode 100644
> index 0000000..2e978cf
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts
> @@ -0,0 +1,66 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/dts-v1/;
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +#include "ar9342_ubnt_xw.dtsi"
> +
> +/ {
> +	compatible = "ubnt,bullet-m2hp", "ubnt,xw";
> +	model = "Ubiquiti Bullet M2HP (XW)";
> +
> +	gpio-leds {
> +		compatible = "gpio-leds";
> +
> +		link1 {
> +			label = "ubnt:red:link1";
> +			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		link2 {
> +			label = "ubnt:orange:link2";
> +			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		link3 {
> +			label = "ubnt:green:link3";
> +			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
> +		};
> +
> +		link4 {
> +			label = "ubnt:green:link4";
> +			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
> +		};
> +	};
> +};

Shouldn't those LEDs be defined in ar9342_ubnt_xw.dtsi?
AFAIK all XW boards (Bullet, Nano, Rocket) use same LED configurations, 
like in XM target also.
Please take a look at ath79 device tree for XM boards and for board file 
for XW in ar71xx.

> +
> +&mdio0 {
> +	status = "okay";
> +
> +	phy-mask = <4>;
> +	phy4: ethernet-phy@4 {
> +		phy-mode = "rgmii";
> +		reg = <4>;
> +	};
> +};
> +
> +&eth0 {
> +	status = "okay";
> +
> +	pll-data = <0x06000000 0x00000101 0x00001313>;
> +	mtd-mac-address = <&eeprom 0x0>;
> +
> +	phy-mode = "rgmii";
> +	phy-handle = <&phy4>;
> +
> +	gmac-config {
> +		device = <&gmac>;
> +		rxd-delay = <3>;
> +		rxdv-delay = <3>;
> +	};
> +};
> +
> +&eth1 {
> +	status = "disabled";
> +};
> diff --git a/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi b/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
> new file mode 100644
> index 0000000..c5ae5df
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
> @@ -0,0 +1,88 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +#include "ar9344.dtsi"
> +
> +/ {
> +	compatible = "ubnt,xw", "qca,ar9342";
> +	model = "Ubiquiti Networks XW board";
> +
> +	keys {
> +		compatible = "gpio-keys";
> +
> +		reset {
> +			label = "Reset button";
> +			linux,code = <KEY_RESTART>;
> +			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
> +			debounce-interval = <60>;
> +		};
> +	};
> +};
> +
> +&ref {
> +	clock-frequency = <40000000>;
> +};
> +
> +&uart {
> +	status = "okay";
> +};
> +
> +&gpio {
> +	status = "okay";
> +};
> +
> +&spi {
> +	status = "okay";
> +	num-cs = <1>;
> +
> +	flash@0 {
> +		compatible = "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <25000000>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition@0 {
> +				label = "u-boot";
> +				reg = <0x000000 0x040000>;
> +				read-only;
> +			};
> +
> +			partition@40000 {
> +				label = "u-boot-env";
> +				reg = <0x040000 0x010000>;
> +				read-only;
> +			};
> +
> +			partition@50000 {
> +				label = "firmware";
> +				reg = <0x050000 0x760000>;
> +			};
> +
> +			partition@fb0000 {
> +				label = "cfg";
> +				reg = <0x7b0000 0x040000>;
> +				read-only;
> +			};
> +
> +			eeprom: partition@ff0000 {
> +				label = "EEPROM";
> +				reg = <0x7f0000 0x010000>;
> +				read-only;
> +			};
> +		};
> +	};
> +};
> +
> +&wmac {
> +	status = "okay";
> +
> +	qca,disable-5ghz;
Couldn't the upper be dropped to support M5HP also? On XM targets the 
radio band is autodetected based on calibration data.
Which not-so-long ago wasn't available at all, as calibration data had 
to be extracted in userspace on first boot.
> +	mtd-cal-data = <&eeprom 0x1000>;
> +	mtd-mac-address = <&eeprom 0x1002>;
> +};
> diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
> index bb86c8b..d12a32e 100644
> --- a/target/linux/ath79/image/generic-ubnt.mk
> +++ b/target/linux/ath79/image/generic-ubnt.mk
> @@ -63,6 +63,15 @@ define Device/ubnt-wa
>     ATH_SOC := ar9342
>   endef
>   
> +define Device/ubnt-xw
> +  $(Device/ubnt)
> +  UBNT_TYPE := XW
> +  UBNT_CHIP := ar934x
> +  UBNT_BOARD := XM
> +  UBNT_VERSION := 6.0.4
> +  ATH_SOC := ar9342
> +endef
> +
>   define Device/ubnt_bullet-m
>     $(Device/ubnt-xm)
>     DEVICE_TITLE := Ubiquiti Bullet-M
> @@ -70,6 +79,13 @@ define Device/ubnt_bullet-m
>   endef
>   TARGET_DEVICES += ubnt_bullet-m
>   
> +define Device/ubnt_bullet-m2hp
> +  $(Device/ubnt-xw)
> +  DEVICE_TITLE := Ubiquiti Bullet M2HP
> +  SUPPORTED_DEVICES += bullet-m2hp
> +endef
> +TARGET_DEVICES += ubnt_bullet-m2hp
> +
Same as before, I'd call it ubnt_bullet-m-xw, as this patchset should 
automatically support Bullet-M5HP also.
>   define Device/ubnt_rocket-m
>     $(Device/ubnt-xm)
>     DEVICE_TITLE := Ubiquiti Rocket-M

With kind regards,
Lech
Petr Štetiar Nov. 16, 2018, 3:13 p.m. UTC | #2
Lech Perczak <lech.perczak@gmail.com> [2018-11-15 19:30:00]:

Hi,

> Just a couple of remarks inline, based on my knowledge about XM series.

thanks for the review!

> > +	ubnt,bullet-m2hp|\
>
> I'd call it ubnt,bullet-m-xw, as this patch will very likely support
> Bullet-M5HP also.

Ok

> > +		link4 {
> > +			label = "ubnt:green:link4";
> > +			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
> > +		};
> > +	};
> > +};
> 
> Shouldn't those LEDs be defined in ar9342_ubnt_xw.dtsi?
> AFAIK all XW boards (Bullet, Nano, Rocket) use same LED configurations, like
> in XM target also.

It's hard for me to add support for something I don't have on the table and
can't test it at least quickly, so it's hard to guess what should be
common and share stuff and what's separate for each device.

> Please take a look at ath79 device tree for XM boards and for board file for
> XW in ar71xx.

I did, but wasn't smart from that anyway. I would need more experience with
those device to understand the differencies.

> > +  DEVICE_TITLE := Ubiquiti Bullet M2HP
>
> Same as before, I'd call it ubnt_bullet-m-xw, as this patchset should
> automatically support Bullet-M5HP also.

Ok so it might be safe to change it to `Ubiquiti Bullet M2 and M5 HP (XW)` ?

-- ynezz
Lech Perczak Nov. 16, 2018, 5:46 p.m. UTC | #3
Hi,

W dniu 2018-11-16 o 16:13, Petr Štetiar pisze:
> Lech Perczak <lech.perczak@gmail.com> [2018-11-15 19:30:00]:
>
> Hi,
>
>> Just a couple of remarks inline, based on my knowledge about XM series.
> thanks for the review!
>
>>> +	ubnt,bullet-m2hp|\
>> I'd call it ubnt,bullet-m-xw, as this patch will very likely support
>> Bullet-M5HP also.
> Ok
>
>>> +		link4 {
>>> +			label = "ubnt:green:link4";
>>> +			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
>>> +		};
>>> +	};
>>> +};
>> Shouldn't those LEDs be defined in ar9342_ubnt_xw.dtsi?
>> AFAIK all XW boards (Bullet, Nano, Rocket) use same LED configurations, like
>> in XM target also.
> It's hard for me to add support for something I don't have on the table and
> can't test it at least quickly, so it's hard to guess what should be
> common and share stuff and what's separate for each device.

This is the situation where we have to rely on knowledge of others :)
The whole range of Ubiquiti Airmax devices uses essentially those two 
boards, with functionally-equivalent variants based on XM and XW boards.

For example, Nanostation is basically a Bullet with extra ethernet port, 
and Rocket is a Bullet with added USB port.
As far as I understand ar71xx code, the same situation is present on XW 
boards. Same functionality, different SoCs.

Feel free to ask me any questions on this topic :)

>
>> Please take a look at ath79 device tree for XM boards and for board file for
>> XW in ar71xx.
> I did, but wasn't smart from that anyway. I would need more experience with
> those device to understand the differencies.
It'd be great if support for all of them could be included in 
ar9342_ubnt_xw.dtsi, and then secondary ethernet and USB only enabled in 
respective .dts files. It'd be even better if someone on the list had a 
Rocket M XW to test, as it is the fullest variant.

Unfortunately I only have access to XM-based devices :(

>
>>> +  DEVICE_TITLE := Ubiquiti Bullet M2HP
>> Same as before, I'd call it ubnt_bullet-m-xw, as this patchset should
>> automatically support Bullet-M5HP also.
> Ok so it might be safe to change it to `Ubiquiti Bullet M2 and M5 HP (XW)` ?
I'd go with just Ubiquiti Bullet-M (XW), as this target will directly 
support also Nanobridge and Powerbeam series, which also have frequency 
variants available for 900MHz and 3.4GHz bands (for licensed or amateur 
radio use).
>
> -- ynezz
>
Also, wouldn't you mind reviewing and/or testing my PR regarding RSSI 
indicator LEDs on your M2HP on ar71xx target?
It is located on Github: https://github.com/openwrt/openwrt/pull/1372
I only had a chance to test it against Nanobridge M5 (XM version).
Also please rebase it on top of current master if you do decide to test 
it :)

--
With kind regards,
Lech
Adrian Schmutzler Nov. 16, 2018, 6:15 p.m. UTC | #4
Hi,

if I haven't overlooked it, the patch does not provide a "factory" Image as in ar71xx, at least according to "Flashing instructions".

Is this specific to this patch or is there some reason why factory won't be available for XM on ath79 at all?

Best Adrian

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Lech Perczak
> Sent: Freitag, 16. November 2018 18:47
> To: Petr Štetiar <ynezz@true.cz>
> Cc: openwrt-devel@lists.openwrt.org
> Subject: Re: [OpenWrt-Devel] [PATCH] ath79: Add support for Ubiquity
> Bullet M2HP
> 
> Hi,
> 
> W dniu 2018-11-16 o 16:13, Petr Štetiar pisze:
> > Lech Perczak <lech.perczak@gmail.com> [2018-11-15 19:30:00]:
> >
> > Hi,
> >
> >> Just a couple of remarks inline, based on my knowledge about XM series.
> > thanks for the review!
> >
> >>> +	ubnt,bullet-m2hp|\
> >> I'd call it ubnt,bullet-m-xw, as this patch will very likely support
> >> Bullet-M5HP also.
> > Ok
> >
> >>> +		link4 {
> >>> +			label = "ubnt:green:link4";
> >>> +			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
> >>> +		};
> >>> +	};
> >>> +};
> >> Shouldn't those LEDs be defined in ar9342_ubnt_xw.dtsi?
> >> AFAIK all XW boards (Bullet, Nano, Rocket) use same LED
> >> configurations, like in XM target also.
> > It's hard for me to add support for something I don't have on the
> > table and can't test it at least quickly, so it's hard to guess what
> > should be common and share stuff and what's separate for each device.
> 
> This is the situation where we have to rely on knowledge of others :) The
> whole range of Ubiquiti Airmax devices uses essentially those two boards,
> with functionally-equivalent variants based on XM and XW boards.
> 
> For example, Nanostation is basically a Bullet with extra ethernet port, and
> Rocket is a Bullet with added USB port.
> As far as I understand ar71xx code, the same situation is present on XW
> boards. Same functionality, different SoCs.
> 
> Feel free to ask me any questions on this topic :)
> 
> >
> >> Please take a look at ath79 device tree for XM boards and for board
> >> file for XW in ar71xx.
> > I did, but wasn't smart from that anyway. I would need more experience
> > with those device to understand the differencies.
> It'd be great if support for all of them could be included in
> ar9342_ubnt_xw.dtsi, and then secondary ethernet and USB only enabled in
> respective .dts files. It'd be even better if someone on the list had a Rocket
> M XW to test, as it is the fullest variant.
> 
> Unfortunately I only have access to XM-based devices :(
> 
> >
> >>> +  DEVICE_TITLE := Ubiquiti Bullet M2HP
> >> Same as before, I'd call it ubnt_bullet-m-xw, as this patchset should
> >> automatically support Bullet-M5HP also.
> > Ok so it might be safe to change it to `Ubiquiti Bullet M2 and M5 HP (XW)` ?
> I'd go with just Ubiquiti Bullet-M (XW), as this target will directly support also
> Nanobridge and Powerbeam series, which also have frequency variants
> available for 900MHz and 3.4GHz bands (for licensed or amateur radio use).
> >
> > -- ynezz
> >
> Also, wouldn't you mind reviewing and/or testing my PR regarding RSSI
> indicator LEDs on your M2HP on ar71xx target?
> It is located on Github: https://github.com/openwrt/openwrt/pull/1372
> I only had a chance to test it against Nanobridge M5 (XM version).
> Also please rebase it on top of current master if you do decide to test it :)
> 
> --
> With kind regards,
> Lech
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Petr Štetiar Nov. 17, 2018, 6:33 a.m. UTC | #5
Lech Perczak <lech.perczak@gmail.com> [2018-11-16 18:46:40]:

Hi,

> For example, Nanostation is basically a Bullet with extra ethernet port, and
> Rocket is a Bullet with added USB port.

Ah, thanks for explanation.

> It'd be great if support for all of them could be included in
> ar9342_ubnt_xw.dtsi, and then secondary ethernet and USB only enabled in
> respective .dts files. It'd be even better if someone on the list had a
> Rocket M XW to test, as it is the fullest variant.

Hm, so maybe I should move definition of mdio and eth0 from
ar9342_ubnt_bullet-m-xw.dts to ar9342_ubnt_xw.dtsi as well?  But this could be
done later once someone with Nanostation XW shows up and can confirm, that it
actually works.

> Also, wouldn't you mind reviewing and/or testing my PR regarding RSSI
> indicator LEDs on your M2HP on ar71xx target?
> It is located on Github: https://github.com/openwrt/openwrt/pull/1372
> I only had a chance to test it against Nanobridge M5 (XM version).

Ok, but I don't have much experience with RSSI LEDs, so can you tell me how
would you like me to test it on my M2HP? Thanks.

-- ynezz
Petr Štetiar Nov. 17, 2018, 6:44 a.m. UTC | #6
mail@adrianschmutzler.de <mail@adrianschmutzler.de> [2018-11-16 19:15:41]:

Hi Adrian,

> if I haven't overlooked it, the patch does not provide a "factory" Image as
> in ar71xx, at least according to "Flashing instructions".

if I parse this correctly, then my answer is, that I simply didn't included
instructions for flashing of factory image as it wasn't possible at that time,
because `fwupdate.real` utility in airOS v6+ (I'm not 100% sure about this),
doesn't allow flashing of unsigned factory images, so you simply couldn't
flash other factory images then those from Ubiquity.

 XW.v6.1.7# fwupdate.real -m /tmp/openwrt-ath79-generic-ubnt_bullet-m2hp-squashfs-factory.bin  -d
 ...
 Current: XW.ar934x.v6.1.7.32555.180523.1754
 New ver: XW.ar934x.v6.0.4-OpenWrt-r8452+9-e95e9fc
 Versions: New(393220) 6.0.4, Required(393220) 6.0.4
 ...
 Bad Image Structure
 Signature check failed

But in the meantime it was possible to remove this RSA signature checking in
`fwupdate.real`, so in v2 of this patch, there are instructions for flashing
of factory images:

 B) Experimental factory image flashing over SSH from airOS v6.1.7

   1. You need to flash your UBNT M2HP with airOS v6.1.7 firmware
      no other airOS version is currently supported
   2. git clone https://github.com/true-systems/ubnt-bullet-m2hp-openwrt-flashing
   3. cd ubnt-bullet-m2hp-openwrt-flashing
   4. make flash-factory FW_OWRT=/path/to/your/openwrt-ath79-generic-ubnt_bullet-m-xw-squashfs-factory.bin

Please note, that so far it was tested only on two different Bullet M2HP (XW)
devices and it worked. If you've such device and are willing to risk testing
it, you're more then welcome. Any feedback is appreciated. Thanks!

-- ynezz
Lech Perczak Nov. 17, 2018, 9:25 a.m. UTC | #7
W dniu 2018-11-17 o 07:33, Petr Štetiar pisze:
> Lech Perczak <lech.perczak@gmail.com> [2018-11-16 18:46:40]:
>
> Hi,
>
>> For example, Nanostation is basically a Bullet with extra ethernet port, and
>> Rocket is a Bullet with added USB port.
> Ah, thanks for explanation.
You're welcome
>
>> It'd be great if support for all of them could be included in
>> ar9342_ubnt_xw.dtsi, and then secondary ethernet and USB only enabled in
>> respective .dts files. It'd be even better if someone on the list had a
>> Rocket M XW to test, as it is the fullest variant.
> Hm, so maybe I should move definition of mdio and eth0 from
> ar9342_ubnt_bullet-m-xw.dts to ar9342_ubnt_xw.dtsi as well?  But this could be
> done later once someone with Nanostation XW shows up and can confirm, that it
> actually works.
Yes please :)
>
>> Also, wouldn't you mind reviewing and/or testing my PR regarding RSSI
>> indicator LEDs on your M2HP on ar71xx target?
>> It is located on Github: https://github.com/openwrt/openwrt/pull/1372
>> I only had a chance to test it against Nanobridge M5 (XM version).
> Ok, but I don't have much experience with RSSI LEDs, so can you tell me how
> would you like me to test it on my M2HP? Thanks.
It's just a matter of flashing build including my patch, and then 
establishing a connection. Bullet may work either as AP or client, the 
link LEDS should just light up and show the signal strength after you 
connect :)
>
> -- ynezz
> .
>
Lech Perczak Nov. 17, 2018, 9:28 a.m. UTC | #8
Hi Petr, Adrian,

W dniu 2018-11-17 o 07:44, Petr Štetiar pisze:
> mail@adrianschmutzler.de <mail@adrianschmutzler.de> [2018-11-16 19:15:41]:
>
> Hi Adrian,
>
>> if I haven't overlooked it, the patch does not provide a "factory" Image as
>> in ar71xx, at least according to "Flashing instructions".
> if I parse this correctly, then my answer is, that I simply didn't included
> instructions for flashing of factory image as it wasn't possible at that time,
> because `fwupdate.real` utility in airOS v6+ (I'm not 100% sure about this),
> doesn't allow flashing of unsigned factory images, so you simply couldn't
> flash other factory images then those from Ubiquity.
>
>   XW.v6.1.7# fwupdate.real -m /tmp/openwrt-ath79-generic-ubnt_bullet-m2hp-squashfs-factory.bin  -d
>   ...
>   Current: XW.ar934x.v6.1.7.32555.180523.1754
>   New ver: XW.ar934x.v6.0.4-OpenWrt-r8452+9-e95e9fc
>   Versions: New(393220) 6.0.4, Required(393220) 6.0.4
>   ...
>   Bad Image Structure
>   Signature check failed
>
> But in the meantime it was possible to remove this RSA signature checking in
> `fwupdate.real`, so in v2 of this patch, there are instructions for flashing
> of factory images:
>
>   B) Experimental factory image flashing over SSH from airOS v6.1.7
>
>     1. You need to flash your UBNT M2HP with airOS v6.1.7 firmware
>        no other airOS version is currently supported
>     2. git clone https://github.com/true-systems/ubnt-bullet-m2hp-openwrt-flashing
>     3. cd ubnt-bullet-m2hp-openwrt-flashing
>     4. make flash-factory FW_OWRT=/path/to/your/openwrt-ath79-generic-ubnt_bullet-m-xw-squashfs-factory.bin
>
> Please note, that so far it was tested only on two different Bullet M2HP (XW)
> devices and it worked. If you've such device and are willing to risk testing
> it, you're more then welcome. Any feedback is appreciated. Thanks!

Wasn't this possible with downgrading to AirOS 5 first just as it is 
done for XM series?
Please take a look for instructions for them, on XM the procedure is 
quite easy.

>
> -- ynezz
>
Petr Štetiar Nov. 17, 2018, 12:15 p.m. UTC | #9
Lech Perczak <lech.perczak@gmail.com> [2018-11-17 10:28:20]:

> Wasn't this possible with downgrading to AirOS 5 first just as it is done
> for XM series?  Please take a look for instructions for them, on XM the
> procedure is quite easy.

I was using the same downgrade trick on other older UBNT devices as well, and
I hoped, that it would still work for this new device as well, but it didn't.
I simply couldn't find airOS v5 firmware image for XW, and flashing airOS v5
image for XM failed for me on XW:

 XW.v6.1.7# fwupdate.real -m /tmp/XM.v5.6.15.30572.170328.1107.bin -d
 ...
 Current: XW.ar934x.v6.1.7.32555.180523.1754
 New ver: XM.ar7240.v5.6.15.30572.170328.1107
 Versions: New(329231) 5.6.15, Required(393220) 6.0.4
 Invalid version 'XM.ar7240.v5.6.15.30572.170328.1107'

So for me it was clear, that it's different platform ar934x versus ar7240 and
that minimum version allowed for XW is 6.0.4. As of today, for XW you can
download just two firmware versions 6.1.7 and 6.1.8. My device came from
factory flashed with 6.1.5.

Wherever I looked it was all just about TFTP and initramfs methods, which
needs soldering and possibly can cause warranty problems.

-- ynezz
Petr Štetiar Nov. 17, 2018, 1:04 p.m. UTC | #10
Lech Perczak <lech.perczak@gmail.com> [2018-11-17 10:25:30]:

> > > ar9342_ubnt_xw.dtsi, and then secondary ethernet and USB only enabled in
> > > respective .dts files. It'd be even better if someone on the list had a
> > > Rocket M XW to test, as it is the fullest variant.
>
> > Hm, so maybe I should move definition of mdio and eth0 from
> > ar9342_ubnt_bullet-m-xw.dts to ar9342_ubnt_xw.dtsi as well?  But this could be
> > done later once someone with Nanostation XW shows up and can confirm, that it
> > actually works.
>
> Yes please :)

Yes to what? :-) 

 a) Send third version of the patch with mdio/eth0 in ar9342_ubnt_xw.dtsi
 b) Wait for someone with Nanostation XW to confirm, that it could work and
    don't assume anything

> > > Also, wouldn't you mind reviewing and/or testing my PR regarding RSSI
> > > indicator LEDs on your M2HP on ar71xx target?
> > > It is located on Github: https://github.com/openwrt/openwrt/pull/1372
> > > I only had a chance to test it against Nanobridge M5 (XM version).
>
> > Ok, but I don't have much experience with RSSI LEDs, so can you tell me how
> > would you like me to test it on my M2HP? Thanks.
>
> It's just a matter of flashing build including my patch, and then
> establishing a connection. Bullet may work either as AP or client, the link
> LEDS should just light up and show the signal strength after you connect :)

It seems, that as being on the latest master, all I had to do was adding the
module package:

 diff --git a/target/linux/ath79/image/generic-ubnt.mk
 b/target/linux/ath79/image/generic-ubnt.mk
 index 2d0b1ad..00f1159 100644
 --- a/target/linux/ath79/image/generic-ubnt.mk
 +++ b/target/linux/ath79/image/generic-ubnt.mk
 @@ -66,6 +66,7 @@ endef
  define Device/ubnt-xw
    $(Device/ubnt)
    UBNT_TYPE := XW
 +  DEVICE_PACKAGES += rssileds
    UBNT_CHIP := ar934x
    UBNT_BOARD := XM
    UBNT_VERSION := 6.0.4

and the light show has started, so it works, nice. Thanks!

 Tested-by: Petr Štetiar <ynezz@true.cz>

-- ynezz
Lech Perczak Nov. 18, 2018, 12:29 a.m. UTC | #11
Hello Petr,

W dniu 2018-11-17 o 14:04, Petr Štetiar pisze:
> Lech Perczak <lech.perczak@gmail.com> [2018-11-17 10:25:30]:
>
>>>> ar9342_ubnt_xw.dtsi, and then secondary ethernet and USB only enabled in
>>>> respective .dts files. It'd be even better if someone on the list had a
>>>> Rocket M XW to test, as it is the fullest variant.
>>> Hm, so maybe I should move definition of mdio and eth0 from
>>> ar9342_ubnt_bullet-m-xw.dts to ar9342_ubnt_xw.dtsi as well?  But this could be
>>> done later once someone with Nanostation XW shows up and can confirm, that it
>>> actually works.
>> Yes please :)
> Yes to what? :-)
>
>   a) Send third version of the patch with mdio/eth0 in ar9342_ubnt_xw.dtsi
>   b) Wait for someone with Nanostation XW to confirm, that it could work and
>      don't assume anything
I meant sending new patch, but after reading recent emails I believe it 
's in the works already :)
>
>>>> Also, wouldn't you mind reviewing and/or testing my PR regarding RSSI
>>>> indicator LEDs on your M2HP on ar71xx target?
>>>> It is located on Github: https://github.com/openwrt/openwrt/pull/1372
>>>> I only had a chance to test it against Nanobridge M5 (XM version).
>>> Ok, but I don't have much experience with RSSI LEDs, so can you tell me how
>>> would you like me to test it on my M2HP? Thanks.
>> It's just a matter of flashing build including my patch, and then
>> establishing a connection. Bullet may work either as AP or client, the link
>> LEDS should just light up and show the signal strength after you connect :)
> It seems, that as being on the latest master, all I had to do was adding the
> module package:
>
>   diff --git a/target/linux/ath79/image/generic-ubnt.mk
>   b/target/linux/ath79/image/generic-ubnt.mk
>   index 2d0b1ad..00f1159 100644
>   --- a/target/linux/ath79/image/generic-ubnt.mk
>   +++ b/target/linux/ath79/image/generic-ubnt.mk
>   @@ -66,6 +66,7 @@ endef
>    define Device/ubnt-xw
>      $(Device/ubnt)
>      UBNT_TYPE := XW
>   +  DEVICE_PACKAGES += rssileds
>      UBNT_CHIP := ar934x
>      UBNT_BOARD := XM
>      UBNT_VERSION := 6.0.4
>
> and the light show has started, so it works, nice. Thanks!
>
>   Tested-by: Petr Štetiar <ynezz@true.cz>

Actually, I meant building and testing on ar71xx target instead of 
ath79. But anyway, you might include this little change in your patch,
because when I added this support, XW wasn't ported to ath79 yet. 
Therefore the LED configuration didn't need any alterations, as on ath79 
it doesn't specify PWM support. My 1st patch drops it also from ar71xx, 
which seems likely to stay for 19.01 release.

If you'd like, I can build the ar71xx image for you, or you can just 
checkout my branch from github directly.  I'll rebase it against current 
master.

>
> -- ynezz
>
Petr Štetiar Nov. 18, 2018, 4:05 p.m. UTC | #12
Lech Perczak <lech.perczak@gmail.com> [2018-11-18 01:29:08]:

Hi,

> Actually, I meant building and testing on ar71xx target instead of ath79.
> But anyway, you might include this little change in your patch,
> because when I added this support, XW wasn't ported to ath79 yet. Therefore
> the LED configuration didn't need any alterations, as on ath79 it doesn't
> specify PWM support.

I've just pulled your changes into my testing branch so it looks like this now:

 07b41e3 Merge commit 'refs/pull/1372/head' of https://github.com/openwrt/openwrt into nanostation-m-xw
 a49e6d0 ar71xx: ubnt-(xm,xw): add rssileds package
 78c3af2 ar71xx: ubnt-(xm,xw): create RSSI monitor on wlan0
 bc95553 ath79: ubnt-xw: Add rssileds kernel package
 ffc74ff WIP: ath79: Add support for Ubiquiti Nanostation M (XW)
 67a8871 ath79: Add support for Ubiquity Bullet M (XW)
 dd02a19 ar71xx: fix TP-Link Archer C7 v5 switch LEDs
 251c350 mt76: update to the latest version

Then I've built ar71xx image for nano-m-xw, but it seems like this image
doesn't work out of the box on bullet-m-xw, the green/link4 is on after boot,
and RSSI LEDs doesn't work as on ath79. Setting timer tigger on the LEDs
manually works. Don't have time right now to find out what's the problem, any
idea where should I look at?

-- ynezz
Lech Perczak Nov. 18, 2018, 4:21 p.m. UTC | #13
Hi Petr,

Thanks for testing!

W dniu 2018-11-18 o 17:05, Petr Štetiar pisze:
> Lech Perczak <lech.perczak@gmail.com> [2018-11-18 01:29:08]:
>
> Hi,
>
>> Actually, I meant building and testing on ar71xx target instead of ath79.
>> But anyway, you might include this little change in your patch,
>> because when I added this support, XW wasn't ported to ath79 yet. Therefore
>> the LED configuration didn't need any alterations, as on ath79 it doesn't
>> specify PWM support.
> I've just pulled your changes into my testing branch so it looks like this now:
>
>   07b41e3 Merge commit 'refs/pull/1372/head' of https://github.com/openwrt/openwrt into nanostation-m-xw
>   a49e6d0 ar71xx: ubnt-(xm,xw): add rssileds package
>   78c3af2 ar71xx: ubnt-(xm,xw): create RSSI monitor on wlan0
>   bc95553 ath79: ubnt-xw: Add rssileds kernel package
>   ffc74ff WIP: ath79: Add support for Ubiquiti Nanostation M (XW)
>   67a8871 ath79: Add support for Ubiquity Bullet M (XW)
>   dd02a19 ar71xx: fix TP-Link Archer C7 v5 switch LEDs
>   251c350 mt76: update to the latest version
>
> Then I've built ar71xx image for nano-m-xw, but it seems like this image
> doesn't work out of the box on bullet-m-xw, the green/link4 is on after boot,
> and RSSI LEDs doesn't work as on ath79. Setting timer tigger on the LEDs
> manually works. Don't have time right now to find out what's the problem, any
> idea where should I look at?
>
> -- ynezz
>
A dump of /etc/config/system right after first  boot might be useful, as 
well as checking if rssileds package was indeed pulled in via "opkg list 
--installed | grep rssileds" . Maybe .config needs to be refreshed. At 
least on XM it worked for me :)
Petr Štetiar Nov. 18, 2018, 8:18 p.m. UTC | #14
Lech Perczak <lech.perczak@gmail.com> [2018-11-18 17:21:46]:

> well as checking if rssileds package was indeed pulled in via "opkg list

Somehow the rssileds package wasn't enabled even if I've selected building of
nano-xm-w via menu config. I've deleted the .config and created a new one,
then it was selected, weird. Anyway it works also on ar71xx/bullet-m-xw.

-- ynezz
Petr Štetiar Nov. 18, 2018, 8:24 p.m. UTC | #15
Lech Perczak <lech.perczak@gmail.com> [2018-11-18 21:34:53]:

> Can I add Tested-By tag to my patch? :)

Tested-by: Petr Štetiar <ynezz@true.cz> (tested on ar71xx/ath79 with bullet-m-xw)

-- ynezz
Lech Perczak Nov. 18, 2018, 8:34 p.m. UTC | #16
Hello Petr,

W dniu 2018-11-18 o 21:18, Petr Štetiar pisze:
> Lech Perczak <lech.perczak@gmail.com> [2018-11-18 17:21:46]:
>
>> well as checking if rssileds package was indeed pulled in via "opkg list
> Somehow the rssileds package wasn't enabled even if I've selected building of
> nano-xm-w via menu config. I've deleted the .config and created a new one,
> then it was selected, weird. Anyway it works also on ar71xx/bullet-m-xw.
>
> -- ynezz
>
Big thanks for testing!
Can I add Tested-By tag to my patch? :)
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 f04eb7f..281686e 100755
--- a/target/linux/ath79/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/base-files/etc/board.d/01_leds
@@ -94,6 +94,7 @@  tplink,tl-wr841-v11)
 	ucidef_set_led_switch "lan4" "LAN4" "tp-link:green:lan4" "switch0" "0x02"
 	;;
 ubnt,bullet-m|\
+ubnt,bullet-m2hp|\
 ubnt,nano-m|\
 ubnt,rocket-m)
 	ucidef_set_rssimon "wlan0" "200000" "1"
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 5f02c57..8556bd3 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -22,6 +22,7 @@  ath79_setup_interfaces()
 	tplink,tl-wa901nd-v2|\
 	tplink,tl-wr703n|\
 	ubnt,bullet-m|\
+	ubnt,bullet-m2hp|\
 	ubnt,lap-120|\
 	ubnt,nanostation-ac-loco|\
 	ubnt,rocket-m|\
diff --git a/target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts b/target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts
new file mode 100644
index 0000000..2e978cf
--- /dev/null
+++ b/target/linux/ath79/dts/ar9342_ubnt_bullet-m2hp.dts
@@ -0,0 +1,66 @@ 
+// SPDX-License-Identifier: GPL-2.0
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar9342_ubnt_xw.dtsi"
+
+/ {
+	compatible = "ubnt,bullet-m2hp", "ubnt,xw";
+	model = "Ubiquiti Bullet M2HP (XW)";
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		link1 {
+			label = "ubnt:red:link1";
+			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+		};
+
+		link2 {
+			label = "ubnt:orange:link2";
+			gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+		};
+
+		link3 {
+			label = "ubnt:green:link3";
+			gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+		};
+
+		link4 {
+			label = "ubnt:green:link4";
+			gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&mdio0 {
+	status = "okay";
+
+	phy-mask = <4>;
+	phy4: ethernet-phy@4 {
+		phy-mode = "rgmii";
+		reg = <4>;
+	};
+};
+
+&eth0 {
+	status = "okay";
+
+	pll-data = <0x06000000 0x00000101 0x00001313>;
+	mtd-mac-address = <&eeprom 0x0>;
+
+	phy-mode = "rgmii";
+	phy-handle = <&phy4>;
+
+	gmac-config {
+		device = <&gmac>;
+		rxd-delay = <3>;
+		rxdv-delay = <3>;
+	};
+};
+
+&eth1 {
+	status = "disabled";
+};
diff --git a/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi b/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
new file mode 100644
index 0000000..c5ae5df
--- /dev/null
+++ b/target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
@@ -0,0 +1,88 @@ 
+// SPDX-License-Identifier: GPL-2.0
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar9344.dtsi"
+
+/ {
+	compatible = "ubnt,xw", "qca,ar9342";
+	model = "Ubiquiti Networks XW board";
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "Reset button";
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+	};
+};
+
+&ref {
+	clock-frequency = <40000000>;
+};
+
+&uart {
+	status = "okay";
+};
+
+&gpio {
+	status = "okay";
+};
+
+&spi {
+	status = "okay";
+	num-cs = <1>;
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <25000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x000000 0x040000>;
+				read-only;
+			};
+
+			partition@40000 {
+				label = "u-boot-env";
+				reg = <0x040000 0x010000>;
+				read-only;
+			};
+
+			partition@50000 {
+				label = "firmware";
+				reg = <0x050000 0x760000>;
+			};
+
+			partition@fb0000 {
+				label = "cfg";
+				reg = <0x7b0000 0x040000>;
+				read-only;
+			};
+
+			eeprom: partition@ff0000 {
+				label = "EEPROM";
+				reg = <0x7f0000 0x010000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&wmac {
+	status = "okay";
+
+	qca,disable-5ghz;
+	mtd-cal-data = <&eeprom 0x1000>;
+	mtd-mac-address = <&eeprom 0x1002>;
+};
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index bb86c8b..d12a32e 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -63,6 +63,15 @@  define Device/ubnt-wa
   ATH_SOC := ar9342
 endef
 
+define Device/ubnt-xw
+  $(Device/ubnt)
+  UBNT_TYPE := XW
+  UBNT_CHIP := ar934x
+  UBNT_BOARD := XM
+  UBNT_VERSION := 6.0.4
+  ATH_SOC := ar9342
+endef
+
 define Device/ubnt_bullet-m
   $(Device/ubnt-xm)
   DEVICE_TITLE := Ubiquiti Bullet-M
@@ -70,6 +79,13 @@  define Device/ubnt_bullet-m
 endef
 TARGET_DEVICES += ubnt_bullet-m
 
+define Device/ubnt_bullet-m2hp
+  $(Device/ubnt-xw)
+  DEVICE_TITLE := Ubiquiti Bullet M2HP
+  SUPPORTED_DEVICES += bullet-m2hp
+endef
+TARGET_DEVICES += ubnt_bullet-m2hp
+
 define Device/ubnt_rocket-m
   $(Device/ubnt-xm)
   DEVICE_TITLE := Ubiquiti Rocket-M