diff mbox series

[OpenWrt-Devel,RFC] ath79: add support for the ar7240 version of the ubiquiti bullet

Message ID 87tv3dtzut.fsf@husum.klickitat.com
State Superseded
Headers show
Series [OpenWrt-Devel,RFC] ath79: add support for the ar7240 version of the ubiquiti bullet | expand

Commit Message

Russell Senior Feb. 26, 2020, 10:19 a.m. UTC
The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
ar7241. Both are supported by ar71xx, despite the different SoCs. The
ath79 target, however, currently supports only the ar7241. The ar7240
version apparently has a differently wired ethernet interface and the
ar7241-based image comes up on the ar7240-based versions without a
working ethernet interface.

This is an attempt to support both flavors of ubnt-bullet-m,
separately. Some of the choices I made may be considered dubious and/or
harmful.

Interested in feedback.

Tested on the AR7240 flavor.

Signed-off-by: Russell Senior <russell@personaltelco.net>
---
 target/linux/ath79/dts/ar7240_ubnt_xm.dtsi    | 99 +++++++++++++++++++
 .../ath79/dts/ar7240_ubnt_xm_outdoor.dtsi     | 35 +++++++
 .../ath79/dts/ar7241_ubnt_bullet-m-v0.dts     | 13 +++
 ...llet-m.dts => ar7241_ubnt_bullet-m-v1.dts} |  4 +-
 .../generic/base-files/etc/board.d/01_leds    |  3 +-
 .../generic/base-files/etc/board.d/02_network |  3 +-
 .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  3 +-
 target/linux/ath79/image/generic-ubnt.mk      | 16 ++-
 8 files changed, 167 insertions(+), 9 deletions(-)
 create mode 100644 target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
 create mode 100644 target/linux/ath79/dts/ar7240_ubnt_xm_outdoor.dtsi
 create mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m-v0.dts
 rename target/linux/ath79/dts/{ar7241_ubnt_bullet-m.dts => ar7241_ubnt_bullet-m-v1.dts} (63%)

Comments

Adrian Schmutzler Feb. 26, 2020, 1:19 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] On
> Behalf Of Russell Senior
> Sent: Mittwoch, 26. Februar 2020 11:20
> To: openwrt-devel@lists.openwrt.org
> Subject: [OpenWrt-Devel] [PATCH RFC] ath79: add support for the ar7240 version
> of the ubiquiti bullet
> 
> 
> The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
> ar7241. Both are supported by ar71xx, despite the different SoCs. The
> ath79 target, however, currently supports only the ar7241. The ar7240
> version apparently has a differently wired ethernet interface and the
> ar7241-based image comes up on the ar7240-based versions without a
> working ethernet interface.
> 
> This is an attempt to support both flavors of ubnt-bullet-m,
> separately. Some of the choices I made may be considered dubious and/or
> harmful.

Interesting. Do you have any indications whether this will also affect the Loco
M and Picostation XM devices?

What's the base for the v0/v1 distinction? Is that visible to the user somehow?
I fear that meaningful naming will be the biggest problem here...

Best

Adrian
Russell Senior Feb. 27, 2020, 8:35 a.m. UTC | #2
On Wed, Feb 26, 2020 at 5:19 AM Adrian Schmutzler <mail@adrianschmutzler.de>
wrote:

> Hi,
>
> > -----Original Message-----
> > From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] On
> > Behalf Of Russell Senior
> > Sent: Mittwoch, 26. Februar 2020 11:20
> > To: openwrt-devel@lists.openwrt.org
> > Subject: [OpenWrt-Devel] [PATCH RFC] ath79: add support for the ar7240
> version
> > of the ubiquiti bullet
> >
> >
> > The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
> > ar7241. Both are supported by ar71xx, despite the different SoCs. The
> > ath79 target, however, currently supports only the ar7241. The ar7240
> > version apparently has a differently wired ethernet interface and the
> > ar7241-based image comes up on the ar7240-based versions without a
> > working ethernet interface.
> >
> > This is an attempt to support both flavors of ubnt-bullet-m,
> > separately. Some of the choices I made may be considered dubious and/or
> > harmful.
>
> Interesting. Do you have any indications whether this will also affect the
> Loco
> M and Picostation XM devices?
>

I have some Loco's deployed (all of them are AR7241) but no picostations,
so I don't know about the latter.


>
> What's the base for the v0/v1 distinction? Is that visible to the user
> somehow?
> I fear that meaningful naming will be the biggest problem here...
>

v0 and v1 mostly come from the need to distinguish between them. You could
think of the digit as the least significant digit of the SoC. We could make
them -7240 and -7241 instead of -v0 and -v1 to be slightly clearer what the
names mean, but that seemed ugly. And, no, as far as I know, the SoC is not
indicated on the exterior of the device at all. The user will have to
figure out the right version to use somehow.


>
> Best
>
> Adrian
>
>
Adrian Schmutzler Feb. 27, 2020, 11:33 a.m. UTC | #3
> > What's the base for the v0/v1 distinction? Is that visible to the user somehow?
> > I fear that meaningful naming will be the biggest problem here...
> 
> v0 and v1 mostly come from the need to distinguish between them. You could think of the digit as the least significant digit of the SoC. We could make them -7240 and -7241 instead of -v0 and -v1 to be slightly clearer what the names mean, but that seemed ugly. And, no, as far as I know, the SoC is not indicated on the exterior of the device at all. The user will have to figure out the right version to use somehow.

That's what I feared. I do not like the -v0/-v1 very much because this is somewhat "reserved" by hardware revisions as TP-Link uses them, and will have everyone looking for a printed version on the device. So, I'd actually prefer -ar7240/-ar7241 suffixes (which will also clearly state what's the difference) unless we can find some identifier from Ubiquiti.

What happens if you flash the "wrong" image? Do you see any chance to have one of the images as "default" without suffix or would this make things worse? 

Best

Adrian
Russell Senior Feb. 27, 2020, 1:27 p.m. UTC | #4
Sorry for the accidental sidetrack to private mail. Returning the thread to
the mailing list.

On Thu, Feb 27, 2020 at 5:16 AM Adrian Schmutzler <mail@adrianschmutzler.de>
wrote:

> Hi,
> > What happens if you flash the "wrong" image? Do you see any chance to
> have one of the images as "default" without suffix or would this make
> things worse?
> >
> > Currently only the ar7241 is supported in ath79. If you flash an ar7241
> image on an ar7240 device, the wireless works but the ethernet does not. I
> have not tried the other way around, but I'd expect the same thing. I >
> don't actually have ready access to an ar7241-based ubnt-bullet-m to try an
> ar7240 image on to confirm that expectation.
>
> I have a Picostation M2HP (XM) where I could technically try an ar7240
> bullet-m image. However, I do not think we will learn much from that, as
> essentially the difference between ar7240.dtsi and ar7241.dtsi are a few
> compatibles and that mdio1 is used instead of mdio0, so I'd expect similar
> results to what you described for the opposite case.
> My main reason for the question was damage assessment, but with Wifi
> disabled by default and Ethernet broken one would still need TFTP for
> recovery as this sounds to me.
>
> I also briefly considered providing a mixed ar7240/ar7241 support as for
> ar71xx, but I quickly quit on that as it's hard to achieve and terribly
> ugly.
>
> So, I still do not have a better idea than the different names/variants at
> the moment.
>

Yeah. I am not seeing a particularly better path either, although I dislike
the duplication of the dtsi's.


>
> Best
>
> Adrian
>
>
Russell Senior Feb. 29, 2020, 11:35 a.m. UTC | #5
The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
ar7241. Both are supported by ar71xx, despite the different SoCs. The
ath79 target, however, currently supports only the ar7241. The ar7240
version apparently has a differently wired ethernet interface and the
ar7241-based image comes up on the ar7240-based versions without a
working ethernet interface.

This is an attempt to support both flavors of ubnt-bullet-m,
separately.

Changes since v1:

* renamed -v0 and -v1 to -ar7240 and -ar7241, respectively, as
  suggested.

* abstracted ar7241_ubnt_outdoor-xm.dtsi to ar724x_ubnt_outdoor-xm.dtsi,
  so that it could be shared between ar7240 and ar7241. Included the new
  ar724x file in the terminal dts files rather than chain them.


There is a further opportunity to share a
target/linux/ath79/dts/ar724x_ubnt_xm.dtsi file, as
target/linux/ath79/dts/ar7240_ubnt_xm.dtsi and
target/linux/ath79/dts/ar7241_ubnt_xm.dtsi differ in one line only.

Interested in feedback.

Tested on the AR7240 flavor.

Signed-off-by: Russell Senior <russell@personaltelco.net>


---
 .../ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts | 21 ++++
 target/linux/ath79/dts/ar7240_ubnt_xm.dtsi    | 99 +++++++++++++++++++
 ...-m.dts => ar7241_ubnt_bullet-m-ar7241.dts} |  1 +
 ...tdoor.dtsi => ar724x_ubnt_xm_outdoor.dtsi} |  2 -
 .../generic/base-files/etc/board.d/01_leds    |  3 +-
 .../generic/base-files/etc/board.d/02_network |  3 +-
 .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  3 +-
 target/linux/ath79/image/generic-ubnt.mk      | 17 +++-
 8 files changed, 140 insertions(+), 9 deletions(-)
 create mode 100644 target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
 create mode 100644 target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
 rename target/linux/ath79/dts/{ar7241_ubnt_bullet-m.dts => ar7241_ubnt_bullet-m-ar7241.dts} (88%)
 rename target/linux/ath79/dts/{ar7241_ubnt_xm_outdoor.dtsi => ar724x_ubnt_xm_outdoor.dtsi} (94%)

diff --git a/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
new file mode 100644
index 0000000000..5fb24b36c8
--- /dev/null
+++ b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7240_ubnt_xm.dtsi"
+#include "ar724x_ubnt_xm_outdoor.dtsi"
+
+/ {
+	compatible = "ubnt,bullet-m-ar7240", "ubnt,xm", "qca,ar7240";
+	model = "Ubiquiti Bullet M AR7240";
+};
+
+&eth0 {
+	fixed-link {
+		speed = <100>;
+		full-duplex;
+	};
+};
+
+&eth1 {
+	compatible = "syscon", "simple-mfd";
+};
diff --git a/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi b/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
new file mode 100644
index 0000000000..7165ce5668
--- /dev/null
+++ b/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
@@ -0,0 +1,99 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar7240.dtsi"
+
+/ {
+	compatible = "ubnt,xm", "qca,ar7240";
+	model = "Ubiquiti Networks XM (rev 1.0) board";
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+	};
+};
+
+&uart {
+	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>;
+			};
+
+			partition@50000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x050000 0x750000>;
+			};
+
+			partition@7a0000 {
+				label = "board_config";
+				reg = <0x7a0000 0x010000>;
+				read-only;
+			};
+
+			partition@7b0000 {
+				label = "cfg";
+				reg = <0x7b0000 0x040000>;
+				read-only;
+			};
+
+			art: partition@7f0000 {
+				label = "art";
+				reg = <0x7f0000 0x010000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+
+	wifi: wifi@0,0 {
+		reg = <0x0000 0 0 0 0>;
+		qca,no-eeprom;
+	};
+};
+
+&eth0 {
+	status = "okay";
+
+	mtd-mac-address = <&art 0x0>;
+};
+
+&eth1 {
+	status = "okay";
+
+	mtd-mac-address = <&art 0x6>;
+};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
similarity index 88%
rename from target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
rename to target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
index e16b5fa0be..dec97ab6d8 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
+#include "ar7241_ubnt_xm.dtsi"
 #include "ar7241_ubnt_xm_outdoor.dtsi"
 
 / {
diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
similarity index 94%
rename from target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
rename to target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
index 75116edc51..a28f8fbcd4 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
+++ b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-#include "ar7241_ubnt_xm.dtsi"
-
 / {
 	aliases {
 		led-boot = &led_link4;
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 6668e15a74..857d607668 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -242,7 +242,8 @@ tplink,tl-wr842n-v2)
 trendnet,tew-823dru)
 	ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
 	;;
-ubnt,bullet-m|\
+ubnt,bullet-m-ar7240|\
+ubnt,bullet-m-ar7241|\
 ubnt,bullet-m-xw|\
 ubnt,nanostation-loco-m|\
 ubnt,nanostation-loco-m-xw|\
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index ef58d9e124..3a1f3d733b 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -41,7 +41,8 @@ ath79_setup_interfaces()
 	tplink,re450-v1|\
 	tplink,re450-v2|\
 	tplink,tl-wr902ac-v1|\
-	ubnt,bullet-m|\
+	ubnt,bullet-m-ar7240|\
+	ubnt,bullet-m-ar7241|\
 	ubnt,bullet-m-xw|\
 	ubnt,lap-120|\
 	ubnt,litebeam-ac-gen2|\
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 96f9d5c0d2..d90abe2981 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -89,7 +89,8 @@ case "$FIRMWARE" in
 	tplink,tl-wr2543-v1|\
 	tplink,tl-wr842n-v1|\
 	ubnt,airrouter|\
-	ubnt,bullet-m|\
+	ubnt,bullet-m-ar7240|\
+	ubnt,bullet-m-ar7241|\
 	ubnt,nanostation-loco-m|\
 	ubnt,nanostation-m|\
 	ubnt,picostation-m|\
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index a4aff09fec..44ce4d9b06 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -113,13 +113,22 @@ define Device/ubnt_airrouter
 endef
 TARGET_DEVICES += ubnt_airrouter
 
-define Device/ubnt_bullet-m
+define Device/ubnt_bullet-m-ar7240
   $(Device/ubnt-xm)
-  DEVICE_MODEL := Bullet-M
+  SOC := ar7240
+  DEVICE_MODEL := Bullet-M AR7240
   DEVICE_PACKAGES += rssileds
-  SUPPORTED_DEVICES += bullet-m
+  SUPPORTED_DEVICES += bullet-m-ar7240
+endef
+TARGET_DEVICES += ubnt_bullet-m-ar7240
+
+define Device/ubnt_bullet-m-ar7241
+  $(Device/ubnt-xm)
+  DEVICE_MODEL := Bullet-M AR7241
+  DEVICE_PACKAGES += rssileds
+  SUPPORTED_DEVICES += bullet-m-ar7241
 endef
-TARGET_DEVICES += ubnt_bullet-m
+TARGET_DEVICES += ubnt_bullet-m-ar7241
 
 define Device/ubnt_bullet-m-xw
   $(Device/ubnt-xw)
Russell Senior Feb. 29, 2020, 12:10 p.m. UTC | #6
This is actually broken in a few minor ways. I'll be following up with a
fixed up v3 shortly.

On Sat, Feb 29, 2020 at 3:36 AM Russell Senior <russell@personaltelco.net>
wrote:

>
> The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
> ar7241. Both are supported by ar71xx, despite the different SoCs. The
> ath79 target, however, currently supports only the ar7241. The ar7240
> version apparently has a differently wired ethernet interface and the
> ar7241-based image comes up on the ar7240-based versions without a
> working ethernet interface.
>
> This is an attempt to support both flavors of ubnt-bullet-m,
> separately.
>
> Changes since v1:
>
> * renamed -v0 and -v1 to -ar7240 and -ar7241, respectively, as
>   suggested.
>
> * abstracted ar7241_ubnt_outdoor-xm.dtsi to ar724x_ubnt_outdoor-xm.dtsi,
>   so that it could be shared between ar7240 and ar7241. Included the new
>   ar724x file in the terminal dts files rather than chain them.
>
>
> There is a further opportunity to share a
> target/linux/ath79/dts/ar724x_ubnt_xm.dtsi file, as
> target/linux/ath79/dts/ar7240_ubnt_xm.dtsi and
> target/linux/ath79/dts/ar7241_ubnt_xm.dtsi differ in one line only.
>
> Interested in feedback.
>
> Tested on the AR7240 flavor.
>
> Signed-off-by: Russell Senior <russell@personaltelco.net>
>
>
> ---
>  .../ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts | 21 ++++
>  target/linux/ath79/dts/ar7240_ubnt_xm.dtsi    | 99 +++++++++++++++++++
>  ...-m.dts => ar7241_ubnt_bullet-m-ar7241.dts} |  1 +
>  ...tdoor.dtsi => ar724x_ubnt_xm_outdoor.dtsi} |  2 -
>  .../generic/base-files/etc/board.d/01_leds    |  3 +-
>  .../generic/base-files/etc/board.d/02_network |  3 +-
>  .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  3 +-
>  target/linux/ath79/image/generic-ubnt.mk      | 17 +++-
>  8 files changed, 140 insertions(+), 9 deletions(-)
>  create mode 100644 target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
>  create mode 100644 target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
>  rename target/linux/ath79/dts/{ar7241_ubnt_bullet-m.dts =>
> ar7241_ubnt_bullet-m-ar7241.dts} (88%)
>  rename target/linux/ath79/dts/{ar7241_ubnt_xm_outdoor.dtsi =>
> ar724x_ubnt_xm_outdoor.dtsi} (94%)
>
> diff --git a/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> new file mode 100644
> index 0000000000..5fb24b36c8
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> @@ -0,0 +1,21 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar7240_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> +
> +/ {
> +       compatible = "ubnt,bullet-m-ar7240", "ubnt,xm", "qca,ar7240";
> +       model = "Ubiquiti Bullet M AR7240";
> +};
> +
> +&eth0 {
> +       fixed-link {
> +               speed = <100>;
> +               full-duplex;
> +       };
> +};
> +
> +&eth1 {
> +       compatible = "syscon", "simple-mfd";
> +};
> diff --git a/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
> b/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
> new file mode 100644
> index 0000000000..7165ce5668
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
> @@ -0,0 +1,99 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +#include "ar7240.dtsi"
> +
> +/ {
> +       compatible = "ubnt,xm", "qca,ar7240";
> +       model = "Ubiquiti Networks XM (rev 1.0) board";
> +
> +       keys {
> +               compatible = "gpio-keys";
> +
> +               reset {
> +                       linux,code = <KEY_RESTART>;
> +                       gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
> +                       debounce-interval = <60>;
> +               };
> +       };
> +};
> +
> +&uart {
> +       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>;
> +                       };
> +
> +                       partition@50000 {
> +                               compatible = "denx,uimage";
> +                               label = "firmware";
> +                               reg = <0x050000 0x750000>;
> +                       };
> +
> +                       partition@7a0000 {
> +                               label = "board_config";
> +                               reg = <0x7a0000 0x010000>;
> +                               read-only;
> +                       };
> +
> +                       partition@7b0000 {
> +                               label = "cfg";
> +                               reg = <0x7b0000 0x040000>;
> +                               read-only;
> +                       };
> +
> +                       art: partition@7f0000 {
> +                               label = "art";
> +                               reg = <0x7f0000 0x010000>;
> +                               read-only;
> +                       };
> +               };
> +       };
> +};
> +
> +&pcie {
> +       status = "okay";
> +
> +       wifi: wifi@0,0 {
> +               reg = <0x0000 0 0 0 0>;
> +               qca,no-eeprom;
> +       };
> +};
> +
> +&eth0 {
> +       status = "okay";
> +
> +       mtd-mac-address = <&art 0x0>;
> +};
> +
> +&eth1 {
> +       status = "okay";
> +
> +       mtd-mac-address = <&art 0x6>;
> +};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> similarity index 88%
> rename from target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> rename to target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> index e16b5fa0be..dec97ab6d8 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> @@ -1,6 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
>
> +#include "ar7241_ubnt_xm.dtsi"
>  #include "ar7241_ubnt_xm_outdoor.dtsi"
>
>  / {
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> similarity index 94%
> rename from target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> rename to target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> index 75116edc51..a28f8fbcd4 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> +++ b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> @@ -1,7 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>
> -#include "ar7241_ubnt_xm.dtsi"
> -
>  / {
>         aliases {
>                 led-boot = &led_link4;
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> index 6668e15a74..857d607668 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> @@ -242,7 +242,8 @@ tplink,tl-wr842n-v2)
>  trendnet,tew-823dru)
>         ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
>         ;;
> -ubnt,bullet-m|\
> +ubnt,bullet-m-ar7240|\
> +ubnt,bullet-m-ar7241|\
>  ubnt,bullet-m-xw|\
>  ubnt,nanostation-loco-m|\
>  ubnt,nanostation-loco-m-xw|\
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> index ef58d9e124..3a1f3d733b 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> @@ -41,7 +41,8 @@ ath79_setup_interfaces()
>         tplink,re450-v1|\
>         tplink,re450-v2|\
>         tplink,tl-wr902ac-v1|\
> -       ubnt,bullet-m|\
> +       ubnt,bullet-m-ar7240|\
> +       ubnt,bullet-m-ar7241|\
>         ubnt,bullet-m-xw|\
>         ubnt,lap-120|\
>         ubnt,litebeam-ac-gen2|\
> diff --git
> a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> index 96f9d5c0d2..d90abe2981 100644
> ---
> a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> +++
> b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> @@ -89,7 +89,8 @@ case "$FIRMWARE" in
>         tplink,tl-wr2543-v1|\
>         tplink,tl-wr842n-v1|\
>         ubnt,airrouter|\
> -       ubnt,bullet-m|\
> +       ubnt,bullet-m-ar7240|\
> +       ubnt,bullet-m-ar7241|\
>         ubnt,nanostation-loco-m|\
>         ubnt,nanostation-m|\
>         ubnt,picostation-m|\
> diff --git a/target/linux/ath79/image/generic-ubnt.mk
> b/target/linux/ath79/image/generic-ubnt.mk
> index a4aff09fec..44ce4d9b06 100644
> --- a/target/linux/ath79/image/generic-ubnt.mk
> +++ b/target/linux/ath79/image/generic-ubnt.mk
> @@ -113,13 +113,22 @@ define Device/ubnt_airrouter
>  endef
>  TARGET_DEVICES += ubnt_airrouter
>
> -define Device/ubnt_bullet-m
> +define Device/ubnt_bullet-m-ar7240
>    $(Device/ubnt-xm)
> -  DEVICE_MODEL := Bullet-M
> +  SOC := ar7240
> +  DEVICE_MODEL := Bullet-M AR7240
>    DEVICE_PACKAGES += rssileds
> -  SUPPORTED_DEVICES += bullet-m
> +  SUPPORTED_DEVICES += bullet-m-ar7240
> +endef
> +TARGET_DEVICES += ubnt_bullet-m-ar7240
> +
> +define Device/ubnt_bullet-m-ar7241
> +  $(Device/ubnt-xm)
> +  DEVICE_MODEL := Bullet-M AR7241
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m-ar7241
>  endef
> -TARGET_DEVICES += ubnt_bullet-m
> +TARGET_DEVICES += ubnt_bullet-m-ar7241
>
>  define Device/ubnt_bullet-m-xw
>    $(Device/ubnt-xw)
> --
> 2.25.1
>
>
> --
> Russell Senior, President
> russell@personaltelco.net
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
Russell Senior Feb. 29, 2020, 1:09 p.m. UTC | #7
The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
ar7241. Both are supported by ar71xx, despite the different SoCs. The
ath79 target, however, currently supports only the ar7241. The ar7240
version apparently has a differently wired ethernet interface and the
ar7241-based image comes up on the ar7240-based versions without a
working ethernet interface.

This is an attempt to support both flavors of ubnt-bullet-m,
separately.

Changes since v2:

* generified ar7241_ubnt_xm.dtsi into ar724x_ubnt_xm.dtsi and converted
  the ubnt_xm family of devicetree's to stack #includes rather than chain
  them in order to avoid massive duplication between ar7240 and ar7241.

* fixed a broken reference to ar7241_ubnt_outdoor-xm.dtsi

Changes since v1:

* renamed -v0 and -v1 to -ar7240 and -ar7241, respectively, as
  suggested.

* abstracted ar7241_ubnt_outdoor-xm.dtsi to ar724x_ubnt_outdoor-xm.dtsi,
  so that it could be shared between ar7240 and ar7241. Included the new
    ar724x file in the terminal dts files rather than chain them.

Interested in feedback.

Tested on the AR7240 flavor.

Signed-off-by: Russell Senior <russell@personaltelco.net>
---
 .../ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts | 22 +++++++++++++++++++
 .../linux/ath79/dts/ar7241_ubnt_airrouter.dts |  3 ++-
 .../ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts | 15 +++++++++++++
 .../linux/ath79/dts/ar7241_ubnt_bullet-m.dts  | 13 -----------
 .../dts/ar7241_ubnt_nanostation-loco-m.dts    |  4 +++-
 .../ath79/dts/ar7241_ubnt_nanostation-m.dts   |  4 +++-
 .../ath79/dts/ar7241_ubnt_picostation-m.dts   |  4 +++-
 .../linux/ath79/dts/ar7241_ubnt_rocket-m.dts  |  4 +++-
 ...r7241_ubnt_xm.dtsi => ar724x_ubnt_xm.dtsi} |  5 -----
 ...tdoor.dtsi => ar724x_ubnt_xm_outdoor.dtsi} |  2 --
 .../generic/base-files/etc/board.d/01_leds    |  3 ++-
 .../generic/base-files/etc/board.d/02_network |  3 ++-
 .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  3 ++-
 target/linux/ath79/image/generic-ubnt.mk      | 17 ++++++++++----
 14 files changed, 70 insertions(+), 32 deletions(-)
 create mode 100644 target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
 create mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
 delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
 rename target/linux/ath79/dts/{ar7241_ubnt_xm.dtsi => ar724x_ubnt_xm.dtsi} (92%)
 rename target/linux/ath79/dts/{ar7241_ubnt_xm_outdoor.dtsi => ar724x_ubnt_xm_outdoor.dtsi} (94%)

diff --git a/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
new file mode 100644
index 0000000000..99bf971eec
--- /dev/null
+++ b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7240.dtsi"
+#include "ar724x_ubnt_xm.dtsi"
+#include "ar724x_ubnt_xm_outdoor.dtsi"
+
+/ {
+	compatible = "ubnt,bullet-m-ar7240", "ubnt,xm", "qca,ar7240";
+	model = "Ubiquiti Bullet M AR7240";
+};
+
+&eth0 {
+	fixed-link {
+		speed = <100>;
+		full-duplex;
+	};
+};
+
+&eth1 {
+	compatible = "syscon", "simple-mfd";
+};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
index ad2762e20c..dd2421da8e 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
@@ -1,7 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
-#include "ar7241_ubnt_xm.dtsi"
+#include "ar7241.dtsi"
+#include "ar724x_ubnt_xm.dtsi"
 
 / {
 	compatible = "ubnt,airrouter", "ubnt,xm", "qca,ar7241";
diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
new file mode 100644
index 0000000000..bb0f19c9eb
--- /dev/null
+++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7241.dtsi"
+#include "ar724x_ubnt_xm.dtsi"
+#include "ar724x_ubnt_xm_outdoor.dtsi"
+
+/ {
+	compatible = "ubnt,bullet-m-ar7241", "ubnt,xm", "qca,ar7241";
+	model = "Ubiquiti Bullet M AR7241";
+};
+
+&eth1 {
+	compatible = "syscon", "simple-mfd";
+};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts b/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
deleted file mode 100644
index e16b5fa0be..0000000000
--- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
-/dts-v1/;
-
-#include "ar7241_ubnt_xm_outdoor.dtsi"
-
-/ {
-	compatible = "ubnt,bullet-m", "ubnt,xm", "qca,ar7241";
-	model = "Ubiquiti Bullet M";
-};
-
-&eth1 {
-	compatible = "syscon", "simple-mfd";
-};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
index 386b7c7073..60d5a21a22 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
@@ -1,7 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
-#include "ar7241_ubnt_xm_outdoor.dtsi"
+#include "ar7241.dtsi"
+#include "ar724x_ubnt_xm.dtsi"
+#include "ar724x_ubnt_xm_outdoor.dtsi"
 
 / {
 	compatible = "ubnt,nanostation-loco-m", "ubnt,xm", "qca,ar7241";
diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
index eebe65e53f..82344bb5ea 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
@@ -1,7 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
-#include "ar7241_ubnt_xm_outdoor.dtsi"
+#include "ar7241.dtsi"
+#include "ar724x_ubnt_xm.dtsi"
+#include "ar724x_ubnt_xm_outdoor.dtsi"
 
 / {
 	compatible = "ubnt,nanostation-m", "ubnt,xm", "qca,ar7241";
diff --git a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
index e2376a1b92..d05aca3e67 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
@@ -1,7 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
-#include "ar7241_ubnt_xm_outdoor.dtsi"
+#include "ar7241.dtsi"
+#include "ar724x_ubnt_xm.dtsi"
+#include "ar724x_ubnt_xm_outdoor.dtsi"
 
 / {
 	compatible = "ubnt,picostation-m", "ubnt,xm", "qca,ar7241";
diff --git a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
index 35f5205b41..9e342177e2 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
@@ -1,7 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /dts-v1/;
 
-#include "ar7241_ubnt_xm_outdoor.dtsi"
+#include "ar7241.dtsi"
+#include "ar724x_ubnt_xm.dtsi"
+#include "ar724x_ubnt_xm_outdoor.dtsi"
 
 / {
 	compatible = "ubnt,rocket-m", "ubnt,xm", "qca,ar7241";
diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
similarity index 92%
rename from target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
rename to target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
index e2b653b3a7..b36b0d4fe2 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
+++ b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
@@ -3,12 +3,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 
-#include "ar7241.dtsi"
-
 / {
-	compatible = "ubnt,xm", "qca,ar7241";
-	model = "Ubiquiti Networks XM (rev 1.0) board";
-
 	keys {
 		compatible = "gpio-keys";
 
diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
similarity index 94%
rename from target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
rename to target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
index 75116edc51..a28f8fbcd4 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
+++ b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
@@ -1,7 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-#include "ar7241_ubnt_xm.dtsi"
-
 / {
 	aliases {
 		led-boot = &led_link4;
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 6668e15a74..857d607668 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -242,7 +242,8 @@ tplink,tl-wr842n-v2)
 trendnet,tew-823dru)
 	ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
 	;;
-ubnt,bullet-m|\
+ubnt,bullet-m-ar7240|\
+ubnt,bullet-m-ar7241|\
 ubnt,bullet-m-xw|\
 ubnt,nanostation-loco-m|\
 ubnt,nanostation-loco-m-xw|\
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index ef58d9e124..3a1f3d733b 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -41,7 +41,8 @@ ath79_setup_interfaces()
 	tplink,re450-v1|\
 	tplink,re450-v2|\
 	tplink,tl-wr902ac-v1|\
-	ubnt,bullet-m|\
+	ubnt,bullet-m-ar7240|\
+	ubnt,bullet-m-ar7241|\
 	ubnt,bullet-m-xw|\
 	ubnt,lap-120|\
 	ubnt,litebeam-ac-gen2|\
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 96f9d5c0d2..d90abe2981 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -89,7 +89,8 @@ case "$FIRMWARE" in
 	tplink,tl-wr2543-v1|\
 	tplink,tl-wr842n-v1|\
 	ubnt,airrouter|\
-	ubnt,bullet-m|\
+	ubnt,bullet-m-ar7240|\
+	ubnt,bullet-m-ar7241|\
 	ubnt,nanostation-loco-m|\
 	ubnt,nanostation-m|\
 	ubnt,picostation-m|\
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index a4aff09fec..44ce4d9b06 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -113,13 +113,22 @@ define Device/ubnt_airrouter
 endef
 TARGET_DEVICES += ubnt_airrouter
 
-define Device/ubnt_bullet-m
+define Device/ubnt_bullet-m-ar7240
   $(Device/ubnt-xm)
-  DEVICE_MODEL := Bullet-M
+  SOC := ar7240
+  DEVICE_MODEL := Bullet-M AR7240
   DEVICE_PACKAGES += rssileds
-  SUPPORTED_DEVICES += bullet-m
+  SUPPORTED_DEVICES += bullet-m-ar7240
+endef
+TARGET_DEVICES += ubnt_bullet-m-ar7240
+
+define Device/ubnt_bullet-m-ar7241
+  $(Device/ubnt-xm)
+  DEVICE_MODEL := Bullet-M AR7241
+  DEVICE_PACKAGES += rssileds
+  SUPPORTED_DEVICES += bullet-m-ar7241
 endef
-TARGET_DEVICES += ubnt_bullet-m
+TARGET_DEVICES += ubnt_bullet-m-ar7241
 
 define Device/ubnt_bullet-m-xw
   $(Device/ubnt-xw)
Russell Senior March 6, 2020, 6:53 a.m. UTC | #8
Does this look reasonable? Any other comments?

On Sat, Feb 29, 2020 at 5:09 AM Russell Senior <russell@personaltelco.net>
wrote:

>
> The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
> ar7241. Both are supported by ar71xx, despite the different SoCs. The
> ath79 target, however, currently supports only the ar7241. The ar7240
> version apparently has a differently wired ethernet interface and the
> ar7241-based image comes up on the ar7240-based versions without a
> working ethernet interface.
>
> This is an attempt to support both flavors of ubnt-bullet-m,
> separately.
>
> Changes since v2:
>
> * generified ar7241_ubnt_xm.dtsi into ar724x_ubnt_xm.dtsi and converted
>   the ubnt_xm family of devicetree's to stack #includes rather than chain
>   them in order to avoid massive duplication between ar7240 and ar7241.
>
> * fixed a broken reference to ar7241_ubnt_outdoor-xm.dtsi
>
> Changes since v1:
>
> * renamed -v0 and -v1 to -ar7240 and -ar7241, respectively, as
>   suggested.
>
> * abstracted ar7241_ubnt_outdoor-xm.dtsi to ar724x_ubnt_outdoor-xm.dtsi,
>   so that it could be shared between ar7240 and ar7241. Included the new
>     ar724x file in the terminal dts files rather than chain them.
>
> Interested in feedback.
>
> Tested on the AR7240 flavor.
>
> Signed-off-by: Russell Senior <russell@personaltelco.net>
> ---
>  .../ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts | 22 +++++++++++++++++++
>  .../linux/ath79/dts/ar7241_ubnt_airrouter.dts |  3 ++-
>  .../ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts | 15 +++++++++++++
>  .../linux/ath79/dts/ar7241_ubnt_bullet-m.dts  | 13 -----------
>  .../dts/ar7241_ubnt_nanostation-loco-m.dts    |  4 +++-
>  .../ath79/dts/ar7241_ubnt_nanostation-m.dts   |  4 +++-
>  .../ath79/dts/ar7241_ubnt_picostation-m.dts   |  4 +++-
>  .../linux/ath79/dts/ar7241_ubnt_rocket-m.dts  |  4 +++-
>  ...r7241_ubnt_xm.dtsi => ar724x_ubnt_xm.dtsi} |  5 -----
>  ...tdoor.dtsi => ar724x_ubnt_xm_outdoor.dtsi} |  2 --
>  .../generic/base-files/etc/board.d/01_leds    |  3 ++-
>  .../generic/base-files/etc/board.d/02_network |  3 ++-
>  .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  3 ++-
>  target/linux/ath79/image/generic-ubnt.mk      | 17 ++++++++++----
>  14 files changed, 70 insertions(+), 32 deletions(-)
>  create mode 100644 target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
>  create mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
>  delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
>  rename target/linux/ath79/dts/{ar7241_ubnt_xm.dtsi =>
> ar724x_ubnt_xm.dtsi} (92%)
>  rename target/linux/ath79/dts/{ar7241_ubnt_xm_outdoor.dtsi =>
> ar724x_ubnt_xm_outdoor.dtsi} (94%)
>
> diff --git a/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> new file mode 100644
> index 0000000000..99bf971eec
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar7240.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> +
> +/ {
> +       compatible = "ubnt,bullet-m-ar7240", "ubnt,xm", "qca,ar7240";
> +       model = "Ubiquiti Bullet M AR7240";
> +};
> +
> +&eth0 {
> +       fixed-link {
> +               speed = <100>;
> +               full-duplex;
> +       };
> +};
> +
> +&eth1 {
> +       compatible = "syscon", "simple-mfd";
> +};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> index ad2762e20c..dd2421da8e 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> @@ -1,7 +1,8 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
>
> -#include "ar7241_ubnt_xm.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
>
>  / {
>         compatible = "ubnt,airrouter", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> new file mode 100644
> index 0000000000..bb0f19c9eb
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> @@ -0,0 +1,15 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> +
> +/ {
> +       compatible = "ubnt,bullet-m-ar7241", "ubnt,xm", "qca,ar7241";
> +       model = "Ubiquiti Bullet M AR7241";
> +};
> +
> +&eth1 {
> +       compatible = "syscon", "simple-mfd";
> +};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> deleted file mode 100644
> index e16b5fa0be..0000000000
> --- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> -/dts-v1/;
> -
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> -
> -/ {
> -       compatible = "ubnt,bullet-m", "ubnt,xm", "qca,ar7241";
> -       model = "Ubiquiti Bullet M";
> -};
> -
> -&eth1 {
> -       compatible = "syscon", "simple-mfd";
> -};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> index 386b7c7073..60d5a21a22 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
>
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
>
>  / {
>         compatible = "ubnt,nanostation-loco-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> index eebe65e53f..82344bb5ea 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
>
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
>
>  / {
>         compatible = "ubnt,nanostation-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> index e2376a1b92..d05aca3e67 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
>
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
>
>  / {
>         compatible = "ubnt,picostation-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> index 35f5205b41..9e342177e2 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
>
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
>
>  / {
>         compatible = "ubnt,rocket-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> similarity index 92%
> rename from target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> rename to target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> index e2b653b3a7..b36b0d4fe2 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> +++ b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> @@ -3,12 +3,7 @@
>  #include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/input/input.h>
>
> -#include "ar7241.dtsi"
> -
>  / {
> -       compatible = "ubnt,xm", "qca,ar7241";
> -       model = "Ubiquiti Networks XM (rev 1.0) board";
> -
>         keys {
>                 compatible = "gpio-keys";
>
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> similarity index 94%
> rename from target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> rename to target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> index 75116edc51..a28f8fbcd4 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> +++ b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> @@ -1,7 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>
> -#include "ar7241_ubnt_xm.dtsi"
> -
>  / {
>         aliases {
>                 led-boot = &led_link4;
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> index 6668e15a74..857d607668 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> @@ -242,7 +242,8 @@ tplink,tl-wr842n-v2)
>  trendnet,tew-823dru)
>         ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
>         ;;
> -ubnt,bullet-m|\
> +ubnt,bullet-m-ar7240|\
> +ubnt,bullet-m-ar7241|\
>  ubnt,bullet-m-xw|\
>  ubnt,nanostation-loco-m|\
>  ubnt,nanostation-loco-m-xw|\
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> index ef58d9e124..3a1f3d733b 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> @@ -41,7 +41,8 @@ ath79_setup_interfaces()
>         tplink,re450-v1|\
>         tplink,re450-v2|\
>         tplink,tl-wr902ac-v1|\
> -       ubnt,bullet-m|\
> +       ubnt,bullet-m-ar7240|\
> +       ubnt,bullet-m-ar7241|\
>         ubnt,bullet-m-xw|\
>         ubnt,lap-120|\
>         ubnt,litebeam-ac-gen2|\
> diff --git
> a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> index 96f9d5c0d2..d90abe2981 100644
> ---
> a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> +++
> b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
> @@ -89,7 +89,8 @@ case "$FIRMWARE" in
>         tplink,tl-wr2543-v1|\
>         tplink,tl-wr842n-v1|\
>         ubnt,airrouter|\
> -       ubnt,bullet-m|\
> +       ubnt,bullet-m-ar7240|\
> +       ubnt,bullet-m-ar7241|\
>         ubnt,nanostation-loco-m|\
>         ubnt,nanostation-m|\
>         ubnt,picostation-m|\
> diff --git a/target/linux/ath79/image/generic-ubnt.mk
> b/target/linux/ath79/image/generic-ubnt.mk
> index a4aff09fec..44ce4d9b06 100644
> --- a/target/linux/ath79/image/generic-ubnt.mk
> +++ b/target/linux/ath79/image/generic-ubnt.mk
> @@ -113,13 +113,22 @@ define Device/ubnt_airrouter
>  endef
>  TARGET_DEVICES += ubnt_airrouter
>
> -define Device/ubnt_bullet-m
> +define Device/ubnt_bullet-m-ar7240
>    $(Device/ubnt-xm)
> -  DEVICE_MODEL := Bullet-M
> +  SOC := ar7240
> +  DEVICE_MODEL := Bullet-M AR7240
>    DEVICE_PACKAGES += rssileds
> -  SUPPORTED_DEVICES += bullet-m
> +  SUPPORTED_DEVICES += bullet-m-ar7240
> +endef
> +TARGET_DEVICES += ubnt_bullet-m-ar7240
> +
> +define Device/ubnt_bullet-m-ar7241
> +  $(Device/ubnt-xm)
> +  DEVICE_MODEL := Bullet-M AR7241
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m-ar7241
>  endef
> -TARGET_DEVICES += ubnt_bullet-m
> +TARGET_DEVICES += ubnt_bullet-m-ar7241
>
>  define Device/ubnt_bullet-m-xw
>    $(Device/ubnt-xw)
> --
> 2.25.1
>
>
> --
> Russell Senior, President
> russell@personaltelco.net
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
Adrian Schmutzler March 9, 2020, 1:10 p.m. UTC | #9
Hi,

> -----Original Message-----
> From: Russell Senior [mailto:russell@personaltelco.net]
> Sent: Samstag, 29. Februar 2020 14:10
> To: openwrt-devel@lists.openwrt.org
> Cc: Adrian Schmutzler <mail@adrianschmutzler.de>
> Subject: Re: [OpenWrt-Devel] [PATCH RFC v3] ath79: add support for the ar7240
> version of the ubiquiti bullet
> 
> 
> The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
> ar7241. Both are supported by ar71xx, despite the different SoCs. The
> ath79 target, however, currently supports only the ar7241. The ar7240
> version apparently has a differently wired ethernet interface and the
> ar7241-based image comes up on the ar7240-based versions without a
> working ethernet interface.
> 
> This is an attempt to support both flavors of ubnt-bullet-m,
> separately.
> 
> Changes since v2:
> 
> * generified ar7241_ubnt_xm.dtsi into ar724x_ubnt_xm.dtsi and converted
>   the ubnt_xm family of devicetree's to stack #includes rather than chain
>   them in order to avoid massive duplication between ar7240 and ar7241.
> 
> * fixed a broken reference to ar7241_ubnt_outdoor-xm.dtsi
> 
> Changes since v1:
> 
> * renamed -v0 and -v1 to -ar7240 and -ar7241, respectively, as
>   suggested.
> 
> * abstracted ar7241_ubnt_outdoor-xm.dtsi to ar724x_ubnt_outdoor-xm.dtsi,
>   so that it could be shared between ar7240 and ar7241. Included the new
>     ar724x file in the terminal dts files rather than chain them.
> 
> Interested in feedback.
> 
> Tested on the AR7240 flavor.

In principle this seems fine to me, but I'm still hoping to find a better
solution for the device names.

Since this is quite hard to review, I'd prefer to have this split into two
commits:

1. Just do the reorganization (dtsi logic change)

2. Add the new device and rename bullet-m devices.

See some minor comments below.

> 
> Signed-off-by: Russell Senior <russell@personaltelco.net>
> ---
>  .../ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts | 22 +++++++++++++++++++
>  .../linux/ath79/dts/ar7241_ubnt_airrouter.dts |  3 ++-
>  .../ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts | 15 +++++++++++++
>  .../linux/ath79/dts/ar7241_ubnt_bullet-m.dts  | 13 -----------
>  .../dts/ar7241_ubnt_nanostation-loco-m.dts    |  4 +++-
>  .../ath79/dts/ar7241_ubnt_nanostation-m.dts   |  4 +++-
>  .../ath79/dts/ar7241_ubnt_picostation-m.dts   |  4 +++-
>  .../linux/ath79/dts/ar7241_ubnt_rocket-m.dts  |  4 +++-
>  ...r7241_ubnt_xm.dtsi => ar724x_ubnt_xm.dtsi} |  5 -----
>  ...tdoor.dtsi => ar724x_ubnt_xm_outdoor.dtsi} |  2 --
>  .../generic/base-files/etc/board.d/01_leds    |  3 ++-
>  .../generic/base-files/etc/board.d/02_network |  3 ++-
>  .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  3 ++-
>  target/linux/ath79/image/generic-ubnt.mk      | 17 ++++++++++----
>  14 files changed, 70 insertions(+), 32 deletions(-)
>  create mode 100644 target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
>  create mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
>  delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
>  rename target/linux/ath79/dts/{ar7241_ubnt_xm.dtsi =>
> ar724x_ubnt_xm.dtsi} (92%)
>  rename target/linux/ath79/dts/{ar7241_ubnt_xm_outdoor.dtsi =>
> ar724x_ubnt_xm_outdoor.dtsi} (94%)
> 
> diff --git a/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> new file mode 100644
> index 0000000000..99bf971eec
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar7240.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> +
> +/ {
> +	compatible = "ubnt,bullet-m-ar7240", "ubnt,xm", "qca,ar7240";
> +	model = "Ubiquiti Bullet M AR7240";

I'd consider putting the AR7240 in brackets here.

> +};
> +
> +&eth0 {
> +	fixed-link {
> +		speed = <100>;
> +		full-duplex;
> +	};
> +};
> +
> +&eth1 {
> +	compatible = "syscon", "simple-mfd";
> +};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> index ad2762e20c..dd2421da8e 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> @@ -1,7 +1,8 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> 
>  / {
>  	compatible = "ubnt,airrouter", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> new file mode 100644
> index 0000000000..bb0f19c9eb
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> @@ -0,0 +1,15 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> +
> +/ {
> +	compatible = "ubnt,bullet-m-ar7241", "ubnt,xm", "qca,ar7241";
> +	model = "Ubiquiti Bullet M AR7241";
> +};
> +
> +&eth1 {
> +	compatible = "syscon", "simple-mfd";
> +};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> deleted file mode 100644
> index e16b5fa0be..0000000000
> --- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> -/dts-v1/;
> -
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> -
> -/ {
> -	compatible = "ubnt,bullet-m", "ubnt,xm", "qca,ar7241";
> -	model = "Ubiquiti Bullet M";
> -};
> -
> -&eth1 {
> -	compatible = "syscon", "simple-mfd";
> -};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> index 386b7c7073..60d5a21a22 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> 
>  / {
>  	compatible = "ubnt,nanostation-loco-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> index eebe65e53f..82344bb5ea 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> 
>  / {
>  	compatible = "ubnt,nanostation-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> index e2376a1b92..d05aca3e67 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> 
>  / {
>  	compatible = "ubnt,picostation-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> index 35f5205b41..9e342177e2 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> 
>  / {
>  	compatible = "ubnt,rocket-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> similarity index 92%
> rename from target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> rename to target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> index e2b653b3a7..b36b0d4fe2 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> +++ b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> @@ -3,12 +3,7 @@
>  #include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/input/input.h>
> 
> -#include "ar7241.dtsi"
> -
>  / {
> -	compatible = "ubnt,xm", "qca,ar7241";
> -	model = "Ubiquiti Networks XM (rev 1.0) board";
> -
>  	keys {
>  		compatible = "gpio-keys";
> 
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> similarity index 94%
> rename from target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> rename to target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> index 75116edc51..a28f8fbcd4 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> +++ b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> @@ -1,7 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> 
> -#include "ar7241_ubnt_xm.dtsi"
> -
>  / {
>  	aliases {
>  		led-boot = &led_link4;
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> index 6668e15a74..857d607668 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> @@ -242,7 +242,8 @@ tplink,tl-wr842n-v2)
>  trendnet,tew-823dru)
>  	ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
>  	;;
> -ubnt,bullet-m|\
> +ubnt,bullet-m-ar7240|\
> +ubnt,bullet-m-ar7241|\
>  ubnt,bullet-m-xw|\
>  ubnt,nanostation-loco-m|\
>  ubnt,nanostation-loco-m-xw|\
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> index ef58d9e124..3a1f3d733b 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> @@ -41,7 +41,8 @@ ath79_setup_interfaces()
>  	tplink,re450-v1|\
>  	tplink,re450-v2|\
>  	tplink,tl-wr902ac-v1|\
> -	ubnt,bullet-m|\
> +	ubnt,bullet-m-ar7240|\
> +	ubnt,bullet-m-ar7241|\
>  	ubnt,bullet-m-xw|\
>  	ubnt,lap-120|\
>  	ubnt,litebeam-ac-gen2|\
> diff --git
> a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-ee
> prom
> b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-ee
> prom
> index 96f9d5c0d2..d90abe2981 100644
> ---
> a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-ee
> prom
> +++
> b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-ee
> prom
> @@ -89,7 +89,8 @@ case "$FIRMWARE" in
>  	tplink,tl-wr2543-v1|\
>  	tplink,tl-wr842n-v1|\
>  	ubnt,airrouter|\
> -	ubnt,bullet-m|\
> +	ubnt,bullet-m-ar7240|\
> +	ubnt,bullet-m-ar7241|\
>  	ubnt,nanostation-loco-m|\
>  	ubnt,nanostation-m|\
>  	ubnt,picostation-m|\
> diff --git a/target/linux/ath79/image/generic-ubnt.mk
> b/target/linux/ath79/image/generic-ubnt.mk
> index a4aff09fec..44ce4d9b06 100644
> --- a/target/linux/ath79/image/generic-ubnt.mk
> +++ b/target/linux/ath79/image/generic-ubnt.mk
> @@ -113,13 +113,22 @@ define Device/ubnt_airrouter
>  endef
>  TARGET_DEVICES += ubnt_airrouter
> 
> -define Device/ubnt_bullet-m
> +define Device/ubnt_bullet-m-ar7240
>    $(Device/ubnt-xm)
> -  DEVICE_MODEL := Bullet-M
> +  SOC := ar7240

If we need this, I'd prefer to have the SOC variable moved from ubnt-xm to the
device definitions for all devices (as overwriting those variables may always be
a bit misleading). This could be done in the first commit together with the DTSI
logic changes.

> +  DEVICE_MODEL := Bullet-M AR7240

AR7240 should go into DEVICE_VARIANT, so we get something like
DEVICE_VARIANT := XM (AR7240)

Same for AR7241 variant.

Thanks and best

Adrian

>    DEVICE_PACKAGES += rssileds
> -  SUPPORTED_DEVICES += bullet-m
> +  SUPPORTED_DEVICES += bullet-m-ar7240
> +endef
> +TARGET_DEVICES += ubnt_bullet-m-ar7240
> +
> +define Device/ubnt_bullet-m-ar7241
> +  $(Device/ubnt-xm)
> +  DEVICE_MODEL := Bullet-M AR7241
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m-ar7241
>  endef
> -TARGET_DEVICES += ubnt_bullet-m
> +TARGET_DEVICES += ubnt_bullet-m-ar7241
> 
>  define Device/ubnt_bullet-m-xw
>    $(Device/ubnt-xw)
> --
> 2.25.1
> 
> 
> --
> Russell Senior, President
> russell@personaltelco.net
Adrian Schmutzler March 9, 2020, 1:11 p.m. UTC | #10
Ah, and please use git format-patch, your v2/v3 didn't even make it into
patchwork.

> -----Original Message-----
> From: Russell Senior [mailto:russell@personaltelco.net]
> Sent: Samstag, 29. Februar 2020 14:10
> To: openwrt-devel@lists.openwrt.org
> Cc: Adrian Schmutzler <mail@adrianschmutzler.de>
> Subject: Re: [OpenWrt-Devel] [PATCH RFC v3] ath79: add support for the ar7240
> version of the ubiquiti bullet
> 
> 
> The Ubiquiti Bullet M2HP come in two flavors, based on ar7240 and
> ar7241. Both are supported by ar71xx, despite the different SoCs. The
> ath79 target, however, currently supports only the ar7241. The ar7240
> version apparently has a differently wired ethernet interface and the
> ar7241-based image comes up on the ar7240-based versions without a
> working ethernet interface.
> 
> This is an attempt to support both flavors of ubnt-bullet-m,
> separately.
> 
> Changes since v2:
> 
> * generified ar7241_ubnt_xm.dtsi into ar724x_ubnt_xm.dtsi and converted
>   the ubnt_xm family of devicetree's to stack #includes rather than chain
>   them in order to avoid massive duplication between ar7240 and ar7241.
> 
> * fixed a broken reference to ar7241_ubnt_outdoor-xm.dtsi
> 
> Changes since v1:
> 
> * renamed -v0 and -v1 to -ar7240 and -ar7241, respectively, as
>   suggested.
> 
> * abstracted ar7241_ubnt_outdoor-xm.dtsi to ar724x_ubnt_outdoor-xm.dtsi,
>   so that it could be shared between ar7240 and ar7241. Included the new
>     ar724x file in the terminal dts files rather than chain them.
> 
> Interested in feedback.
> 
> Tested on the AR7240 flavor.
> 
> Signed-off-by: Russell Senior <russell@personaltelco.net>
> ---
>  .../ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts | 22 +++++++++++++++++++
>  .../linux/ath79/dts/ar7241_ubnt_airrouter.dts |  3 ++-
>  .../ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts | 15 +++++++++++++
>  .../linux/ath79/dts/ar7241_ubnt_bullet-m.dts  | 13 -----------
>  .../dts/ar7241_ubnt_nanostation-loco-m.dts    |  4 +++-
>  .../ath79/dts/ar7241_ubnt_nanostation-m.dts   |  4 +++-
>  .../ath79/dts/ar7241_ubnt_picostation-m.dts   |  4 +++-
>  .../linux/ath79/dts/ar7241_ubnt_rocket-m.dts  |  4 +++-
>  ...r7241_ubnt_xm.dtsi => ar724x_ubnt_xm.dtsi} |  5 -----
>  ...tdoor.dtsi => ar724x_ubnt_xm_outdoor.dtsi} |  2 --
>  .../generic/base-files/etc/board.d/01_leds    |  3 ++-
>  .../generic/base-files/etc/board.d/02_network |  3 ++-
>  .../etc/hotplug.d/firmware/10-ath9k-eeprom    |  3 ++-
>  target/linux/ath79/image/generic-ubnt.mk      | 17 ++++++++++----
>  14 files changed, 70 insertions(+), 32 deletions(-)
>  create mode 100644 target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
>  create mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
>  delete mode 100644 target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
>  rename target/linux/ath79/dts/{ar7241_ubnt_xm.dtsi =>
> ar724x_ubnt_xm.dtsi} (92%)
>  rename target/linux/ath79/dts/{ar7241_ubnt_xm_outdoor.dtsi =>
> ar724x_ubnt_xm_outdoor.dtsi} (94%)
> 
> diff --git a/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> new file mode 100644
> index 0000000000..99bf971eec
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7240_ubnt_bullet-m-ar7240.dts
> @@ -0,0 +1,22 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar7240.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> +
> +/ {
> +	compatible = "ubnt,bullet-m-ar7240", "ubnt,xm", "qca,ar7240";
> +	model = "Ubiquiti Bullet M AR7240";
> +};
> +
> +&eth0 {
> +	fixed-link {
> +		speed = <100>;
> +		full-duplex;
> +	};
> +};
> +
> +&eth1 {
> +	compatible = "syscon", "simple-mfd";
> +};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> index ad2762e20c..dd2421da8e 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_airrouter.dts
> @@ -1,7 +1,8 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> 
>  / {
>  	compatible = "ubnt,airrouter", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> new file mode 100644
> index 0000000000..bb0f19c9eb
> --- /dev/null
> +++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-ar7241.dts
> @@ -0,0 +1,15 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +/dts-v1/;
> +
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> +
> +/ {
> +	compatible = "ubnt,bullet-m-ar7241", "ubnt,xm", "qca,ar7241";
> +	model = "Ubiquiti Bullet M AR7241";
> +};
> +
> +&eth1 {
> +	compatible = "syscon", "simple-mfd";
> +};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> deleted file mode 100644
> index e16b5fa0be..0000000000
> --- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
> +++ /dev/null
> @@ -1,13 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> -/dts-v1/;
> -
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> -
> -/ {
> -	compatible = "ubnt,bullet-m", "ubnt,xm", "qca,ar7241";
> -	model = "Ubiquiti Bullet M";
> -};
> -
> -&eth1 {
> -	compatible = "syscon", "simple-mfd";
> -};
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> index 386b7c7073..60d5a21a22 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-loco-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> 
>  / {
>  	compatible = "ubnt,nanostation-loco-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> index eebe65e53f..82344bb5ea 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_nanostation-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> 
>  / {
>  	compatible = "ubnt,nanostation-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> index e2376a1b92..d05aca3e67 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_picostation-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> 
>  / {
>  	compatible = "ubnt,picostation-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> index 35f5205b41..9e342177e2 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> +++ b/target/linux/ath79/dts/ar7241_ubnt_rocket-m.dts
> @@ -1,7 +1,9 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
>  /dts-v1/;
> 
> -#include "ar7241_ubnt_xm_outdoor.dtsi"
> +#include "ar7241.dtsi"
> +#include "ar724x_ubnt_xm.dtsi"
> +#include "ar724x_ubnt_xm_outdoor.dtsi"
> 
>  / {
>  	compatible = "ubnt,rocket-m", "ubnt,xm", "qca,ar7241";
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> similarity index 92%
> rename from target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> rename to target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> index e2b653b3a7..b36b0d4fe2 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_xm.dtsi
> +++ b/target/linux/ath79/dts/ar724x_ubnt_xm.dtsi
> @@ -3,12 +3,7 @@
>  #include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/input/input.h>
> 
> -#include "ar7241.dtsi"
> -
>  / {
> -	compatible = "ubnt,xm", "qca,ar7241";
> -	model = "Ubiquiti Networks XM (rev 1.0) board";
> -
>  	keys {
>  		compatible = "gpio-keys";
> 
> diff --git a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> similarity index 94%
> rename from target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> rename to target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> index 75116edc51..a28f8fbcd4 100644
> --- a/target/linux/ath79/dts/ar7241_ubnt_xm_outdoor.dtsi
> +++ b/target/linux/ath79/dts/ar724x_ubnt_xm_outdoor.dtsi
> @@ -1,7 +1,5 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> 
> -#include "ar7241_ubnt_xm.dtsi"
> -
>  / {
>  	aliases {
>  		led-boot = &led_link4;
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> index 6668e15a74..857d607668 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
> @@ -242,7 +242,8 @@ tplink,tl-wr842n-v2)
>  trendnet,tew-823dru)
>  	ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
>  	;;
> -ubnt,bullet-m|\
> +ubnt,bullet-m-ar7240|\
> +ubnt,bullet-m-ar7241|\
>  ubnt,bullet-m-xw|\
>  ubnt,nanostation-loco-m|\
>  ubnt,nanostation-loco-m-xw|\
> diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> index ef58d9e124..3a1f3d733b 100755
> --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
> +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
> @@ -41,7 +41,8 @@ ath79_setup_interfaces()
>  	tplink,re450-v1|\
>  	tplink,re450-v2|\
>  	tplink,tl-wr902ac-v1|\
> -	ubnt,bullet-m|\
> +	ubnt,bullet-m-ar7240|\
> +	ubnt,bullet-m-ar7241|\
>  	ubnt,bullet-m-xw|\
>  	ubnt,lap-120|\
>  	ubnt,litebeam-ac-gen2|\
> diff --git
> a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-ee
> prom
> b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-ee
> prom
> index 96f9d5c0d2..d90abe2981 100644
> ---
> a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-ee
> prom
> +++
> b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-ee
> prom
> @@ -89,7 +89,8 @@ case "$FIRMWARE" in
>  	tplink,tl-wr2543-v1|\
>  	tplink,tl-wr842n-v1|\
>  	ubnt,airrouter|\
> -	ubnt,bullet-m|\
> +	ubnt,bullet-m-ar7240|\
> +	ubnt,bullet-m-ar7241|\
>  	ubnt,nanostation-loco-m|\
>  	ubnt,nanostation-m|\
>  	ubnt,picostation-m|\
> diff --git a/target/linux/ath79/image/generic-ubnt.mk
> b/target/linux/ath79/image/generic-ubnt.mk
> index a4aff09fec..44ce4d9b06 100644
> --- a/target/linux/ath79/image/generic-ubnt.mk
> +++ b/target/linux/ath79/image/generic-ubnt.mk
> @@ -113,13 +113,22 @@ define Device/ubnt_airrouter
>  endef
>  TARGET_DEVICES += ubnt_airrouter
> 
> -define Device/ubnt_bullet-m
> +define Device/ubnt_bullet-m-ar7240
>    $(Device/ubnt-xm)
> -  DEVICE_MODEL := Bullet-M
> +  SOC := ar7240
> +  DEVICE_MODEL := Bullet-M AR7240
>    DEVICE_PACKAGES += rssileds
> -  SUPPORTED_DEVICES += bullet-m
> +  SUPPORTED_DEVICES += bullet-m-ar7240
> +endef
> +TARGET_DEVICES += ubnt_bullet-m-ar7240
> +
> +define Device/ubnt_bullet-m-ar7241
> +  $(Device/ubnt-xm)
> +  DEVICE_MODEL := Bullet-M AR7241
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m-ar7241
>  endef
> -TARGET_DEVICES += ubnt_bullet-m
> +TARGET_DEVICES += ubnt_bullet-m-ar7241
> 
>  define Device/ubnt_bullet-m-xw
>    $(Device/ubnt-xw)
> --
> 2.25.1
> 
> 
> --
> Russell Senior, President
> russell@personaltelco.net
Russell Senior March 10, 2020, 11:09 a.m. UTC | #11
>>>>> "Adrian" == Adrian Schmutzler <mail@adrianschmutzler.de> writes:

Adrian> Ah, and please use git format-patch, your v2/v3 didn't even make
Adrian> it into patchwork.

Fwiw. I did use git format-patch. I have no idea how patchwork functions to
extract and link patches. Perhaps you can provide guidance on that?
Adrian Schmutzler March 10, 2020, 11:32 a.m. UTC | #12
> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org] On
> Behalf Of Russell Senior
> Sent: Dienstag, 10. März 2020 12:10
> To: Adrian Schmutzler <mail@adrianschmutzler.de>
> Cc: openwrt-devel@lists.openwrt.org
> Subject: Re: [OpenWrt-Devel] [PATCH RFC v3] ath79: add support for the ar7240
> version of the ubiquiti bullet
> 
> >>>>> "Adrian" == Adrian Schmutzler <mail@adrianschmutzler.de> writes:
> 
> Adrian> Ah, and please use git format-patch, your v2/v3 didn't even make
> Adrian> it into patchwork.
> 
> Fwiw. I did use git format-patch. I have no idea how patchwork functions to
> extract and link patches. Perhaps you can provide guidance on that?

Err, I meant git send-email to send patches to the list.

> 
> 
> --
> Russell Senior, President
> russell@personaltelco.net
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi b/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
new file mode 100644
index 0000000000..7165ce5668
--- /dev/null
+++ b/target/linux/ath79/dts/ar7240_ubnt_xm.dtsi
@@ -0,0 +1,99 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "ar7240.dtsi"
+
+/ {
+	compatible = "ubnt,xm", "qca,ar7240";
+	model = "Ubiquiti Networks XM (rev 1.0) board";
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+	};
+};
+
+&uart {
+	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>;
+			};
+
+			partition@50000 {
+				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x050000 0x750000>;
+			};
+
+			partition@7a0000 {
+				label = "board_config";
+				reg = <0x7a0000 0x010000>;
+				read-only;
+			};
+
+			partition@7b0000 {
+				label = "cfg";
+				reg = <0x7b0000 0x040000>;
+				read-only;
+			};
+
+			art: partition@7f0000 {
+				label = "art";
+				reg = <0x7f0000 0x010000>;
+				read-only;
+			};
+		};
+	};
+};
+
+&pcie {
+	status = "okay";
+
+	wifi: wifi@0,0 {
+		reg = <0x0000 0 0 0 0>;
+		qca,no-eeprom;
+	};
+};
+
+&eth0 {
+	status = "okay";
+
+	mtd-mac-address = <&art 0x0>;
+};
+
+&eth1 {
+	status = "okay";
+
+	mtd-mac-address = <&art 0x6>;
+};
diff --git a/target/linux/ath79/dts/ar7240_ubnt_xm_outdoor.dtsi b/target/linux/ath79/dts/ar7240_ubnt_xm_outdoor.dtsi
new file mode 100644
index 0000000000..c9178d8762
--- /dev/null
+++ b/target/linux/ath79/dts/ar7240_ubnt_xm_outdoor.dtsi
@@ -0,0 +1,35 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar7240_ubnt_xm.dtsi"
+
+/ {
+	aliases {
+		led-boot = &led_link4;
+		led-failsafe = &led_link4;
+		label-mac-device = &wifi;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		link1 {
+			label = "ubnt:red:link1";
+			gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+		};
+
+		link2 {
+			label = "ubnt:orange:link2";
+			gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+		};
+
+		link3 {
+			label = "ubnt:green:link3";
+			gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
+		};
+
+		led_link4: link4 {
+			label = "ubnt:green:link4";
+			gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m-v0.dts b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-v0.dts
new file mode 100644
index 0000000000..f258436def
--- /dev/null
+++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-v0.dts
@@ -0,0 +1,13 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include "ar7240_ubnt_xm_outdoor.dtsi"
+
+/ {
+	compatible = "ubnt,bullet-m-v0", "ubnt,xm", "qca,ar7240";
+	model = "Ubiquiti Bullet M v0";
+};
+
+&eth1 {
+	compatible = "syscon", "simple-mfd";
+};
diff --git a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-v1.dts
similarity index 63%
rename from target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
rename to target/linux/ath79/dts/ar7241_ubnt_bullet-m-v1.dts
index e16b5fa0be..c5b3b61ab0 100644
--- a/target/linux/ath79/dts/ar7241_ubnt_bullet-m.dts
+++ b/target/linux/ath79/dts/ar7241_ubnt_bullet-m-v1.dts
@@ -4,8 +4,8 @@ 
 #include "ar7241_ubnt_xm_outdoor.dtsi"
 
 / {
-	compatible = "ubnt,bullet-m", "ubnt,xm", "qca,ar7241";
-	model = "Ubiquiti Bullet M";
+	compatible = "ubnt,bullet-m-v1", "ubnt,xm", "qca,ar7241";
+	model = "Ubiquiti Bullet M v1";
 };
 
 &eth1 {
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index 6668e15a74..d3ad1a3571 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -242,7 +242,8 @@  tplink,tl-wr842n-v2)
 trendnet,tew-823dru)
 	ucidef_set_led_netdev "wan" "WAN" "trendnet:green:planet" "eth0"
 	;;
-ubnt,bullet-m|\
+ubnt,bullet-m-v0|\
+ubnt,bullet-m-v1|\
 ubnt,bullet-m-xw|\
 ubnt,nanostation-loco-m|\
 ubnt,nanostation-loco-m-xw|\
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index ef58d9e124..641678bd8c 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -41,7 +41,8 @@  ath79_setup_interfaces()
 	tplink,re450-v1|\
 	tplink,re450-v2|\
 	tplink,tl-wr902ac-v1|\
-	ubnt,bullet-m|\
+	ubnt,bullet-m-v0|\
+	ubnt,bullet-m-v1|\
 	ubnt,bullet-m-xw|\
 	ubnt,lap-120|\
 	ubnt,litebeam-ac-gen2|\
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 96f9d5c0d2..4b08ac5a54 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -89,7 +89,8 @@  case "$FIRMWARE" in
 	tplink,tl-wr2543-v1|\
 	tplink,tl-wr842n-v1|\
 	ubnt,airrouter|\
-	ubnt,bullet-m|\
+	ubnt,bullet-m-v0|\
+	ubnt,bullet-m-v1|\
 	ubnt,nanostation-loco-m|\
 	ubnt,nanostation-m|\
 	ubnt,picostation-m|\
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index a4aff09fec..448a0e197b 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -113,13 +113,21 @@  define Device/ubnt_airrouter
 endef
 TARGET_DEVICES += ubnt_airrouter
 
-define Device/ubnt_bullet-m
+define Device/ubnt_bullet-m-v0
   $(Device/ubnt-xm)
-  DEVICE_MODEL := Bullet-M
+  DEVICE_MODEL := Bullet-M v0
   DEVICE_PACKAGES += rssileds
-  SUPPORTED_DEVICES += bullet-m
+  SUPPORTED_DEVICES += bullet-m-v0
+endef
+TARGET_DEVICES += ubnt_bullet-m-v0
+
+define Device/ubnt_bullet-m-v1
+  $(Device/ubnt-xm)
+  DEVICE_MODEL := Bullet-M v1
+  DEVICE_PACKAGES += rssileds
+  SUPPORTED_DEVICES += bullet-m-v1
 endef
-TARGET_DEVICES += ubnt_bullet-m
+TARGET_DEVICES += ubnt_bullet-m-v1
 
 define Device/ubnt_bullet-m-xw
   $(Device/ubnt-xw)