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

2020-02-29 Thread Russell Senior
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 
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 
>
>
> ---
>  .../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 00..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";
> +};
> +
> +ð0 {
> +   fixed-link {
> +   speed = <100>;
> +   full-duplex;
> +   };
> +};
> +
> +ð1 {
> +   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 00..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 
> +#include 
> +
> +#include "ar7240.dtsi"
> +
> +/ {
> +   compatible = "ubnt,xm", "qca,ar7240";
> +   model = "Ubiquiti Networks XM (rev 1.0) board";
> +
> +   keys {
> +   compatible = "gpio-keys";
> +
> +   reset {
> +   linux,code = ;
> +   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 = <2500>;
> +
> +   partitions {
> +   compatible = "fixed-partitions";
> +   #address-cells = <1>;
> +   #size-cells = <1>;
> +
> +   partition@0 {
> +   label = "u-boot";
> +   reg = <0x00 0x04>;
> +   read-only;
> +   };
> +
> +   partition@4 {
> +   label = "u-boot-env";
> +   reg = <0x04 0x01>;
> +   };
> +
> +   partition@5 {
> +   compatible = "denx,uimage";
> +   label = "firmware";
> +   reg = <0x05 0x75>;
> +   };
> +
> +   partition@7a {
> +   label = "board_config";
> +   reg = <0x7a 0x01>;
> +   read-on

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

2020-02-29 Thread Russell Senior


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 


---
 .../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 00..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";
+};
+
+ð0 {
+   fixed-link {
+   speed = <100>;
+   full-duplex;
+   };
+};
+
+ð1 {
+   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 00..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 
+#include 
+
+#include "ar7240.dtsi"
+
+/ {
+   compatible = "ubnt,xm", "qca,ar7240";
+   model = "Ubiquiti Networks XM (rev 1.0) board";
+
+   keys {
+   compatible = "gpio-keys";
+
+   reset {
+   linux,code = ;
+   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 = <2500>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x00 0x04>;
+   read-only;
+   };
+
+   partition@4 {
+   label = "u-boot-env";
+   reg = <0x04 0x01>;
+   };
+
+   partition@5 {
+   compatible = "denx,uimage";
+   label = "firmware";
+   reg = <0x05 0x75>;
+   };
+
+   partition@7a {
+   label = "board_config";
+   reg = <0x7a 0x01>;
+   read-only;
+   };
+
+   partition@7b {
+   label = "cfg";
+   reg = <0x7b 0x04>;
+   read-only;
+   };
+
+   art: partition@7f {
+   label = "art";
+   reg = <0x7f 0x01>;
+