ath79: generic: rework ar9342_ubnt_xw dtsi, and add support for Ubiquiti LiteBeam...
authorSamuele Longhi <agave@dracaena.it>
Wed, 20 Dec 2023 18:27:15 +0000 (19:27 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 20 Jan 2024 18:57:57 +0000 (19:57 +0100)
Add support for Ubiquiti LiteBeam M5 (XW).
The device was previously supported in ar71xx.
See commit: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=d0988235dd277b9a832bbc4b2a100ac6e821f577

Add ALTX_MODEL for Ubiquiti AirGrid M5 HP (XW), Ubiquiti PowerBeam M5 300 (XW) in generic-ubnt.mk
This models are identical (firmware-wise) to the already supported Ubiquiti Nanostation Loco M (XW)

Add also Ubiquiti NanoBeam M5 to ALTX_MODEL of Ubiquiti Nanostation Loco M (XW) since it's another clone.

Tested on:
- Ubiquiti LiteBeam M5 (XW)
- Ubiquiti PowerBeam M5 (XW)

This also modify target/ath79/dts/ar9342_ubnt_xw.dtsi to use nvmem for calibration data
Checked that the caldata size in the eeprom partition are actually 0x440 on:
- Ubiquiti PowerBeam M5 (XW)
- Ubiquiti Nanostation M5 (XW)
- Ubiquiti LiteBeam M5 (XW)
- Ubiquiti AirGrid M5 HP (XW)

Signed-off-by: Samuele Longhi <agave@dracaena.it>
12 files changed:
target/linux/ath79/dts/ar9342_ubnt_bullet-m-xw.dts
target/linux/ath79/dts/ar9342_ubnt_litebeam-m5-xw.dts [new file with mode: 0644]
target/linux/ath79/dts/ar9342_ubnt_nanobeam-m5-xw.dts [deleted file]
target/linux/ath79/dts/ar9342_ubnt_nanostation-loco-m-xw.dts
target/linux/ath79/dts/ar9342_ubnt_nanostation-m-xw.dts
target/linux/ath79/dts/ar9342_ubnt_powerbeam-m2-xw.dts
target/linux/ath79/dts/ar9342_ubnt_powerbeam-m5-xw.dts
target/linux/ath79/dts/ar9342_ubnt_xw.dtsi
target/linux/ath79/dts/ar9342_ubnt_xw_rssileds.dtsi [new file with mode: 0644]
target/linux/ath79/generic/base-files/etc/board.d/01_leds
target/linux/ath79/generic/base-files/etc/board.d/02_network
target/linux/ath79/image/generic-ubnt.mk

index c448ac4e6199653ea5171218b39760ec2464d0f6..8c7d1dc9186ef4c8648424b3d56eedbb911e876e 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-#include "ar9342_ubnt_xw.dtsi"
+#include "ar9342_ubnt_xw_rssileds.dtsi"
 
 / {
        compatible = "ubnt,bullet-m-xw", "ubnt,xw", "qca,ar9342";
diff --git a/target/linux/ath79/dts/ar9342_ubnt_litebeam-m5-xw.dts b/target/linux/ath79/dts/ar9342_ubnt_litebeam-m5-xw.dts
new file mode 100644 (file)
index 0000000..bc01bdf
--- /dev/null
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar9342_ubnt_xw.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+/ {
+       compatible = "ubnt,litebeam-m5-xw", "qca,ar9342";
+       model = "Ubiquiti LiteBeam M5 (XW)";
+
+       aliases {
+               led-boot = &led_status;
+               led-running = &led_status;
+               led-upgrade = &led_status;
+               led-failsafe = &led_status;
+               label-mac-device = &wmac;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led-lan {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_LAN;
+                       gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+               };
+
+               led-wlan {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_WLAN;
+                       linux,default-trigger = "phy0tpt";
+                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+               };
+
+               led_status: led-power {
+                       color = <LED_COLOR_ID_GREEN>;
+                       function = LED_FUNCTION_POWER;
+                       gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
+
+&mdio0 {
+       status = "okay";
+
+       phy1: ethernet-phy@1 {
+               reg = <1>;
+               phy-mode = "mii";
+               reset-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       phy-handle = <&phy1>;
+};
diff --git a/target/linux/ath79/dts/ar9342_ubnt_nanobeam-m5-xw.dts b/target/linux/ath79/dts/ar9342_ubnt_nanobeam-m5-xw.dts
deleted file mode 100644 (file)
index 9b9b217..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
-
-#include "ar9342_ubnt_xw.dtsi"
-
-/ {
-       compatible = "ubnt,nanobeam-m5-xw", "ubnt,xw", "qca,ar9342";
-       model = "Ubiquiti NanoBeam M5 (XW)";
-};
-
-&mdio0 {
-       status = "okay";
-
-       phy1: ethernet-phy@1 {
-               reg = <1>;
-               phy-mode = "mii";
-               reset-gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
-       };
-};
-
-&eth0 {
-       status = "okay";
-
-       phy-handle = <&phy1>;
-};
index c71cf11dd22dc7073d9480d4b146f73342b67ecd..ba3ad5a8d06bd6b379168ad744098588c7ce98f6 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-#include "ar9342_ubnt_xw.dtsi"
+#include "ar9342_ubnt_xw_rssileds.dtsi"
 
 / {
        compatible = "ubnt,nanostation-loco-m-xw", "ubnt,xw", "qca,ar9342";
index e3592976614dc3b1bcb2a62e2128e179eeddd0b2..fb02bb188a22d1b65f7559dda920e8edd655c889 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-#include "ar9342_ubnt_xw.dtsi"
+#include "ar9342_ubnt_xw_rssileds.dtsi"
 
 / {
        compatible = "ubnt,nanostation-m-xw", "ubnt,xw", "qca,ar9342";
index 762a17b1778b811ff27aaa06746d6e7cd8312709..11bd71ca3d173dfff6a716a182370732f4704d6c 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-#include "ar9342_ubnt_xw.dtsi"
+#include "ar9342_ubnt_xw_rssileds.dtsi"
 
 / {
        compatible = "ubnt,powerbeam-m2-xw", "ubnt,xw", "qca,ar9342";
index 978a05fed65e0acba91291f1dca0b130cd04a90d..7199d184e9cb6770aa5747ef9d8fa1279a4666c0 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-#include "ar9342_ubnt_xw.dtsi"
+#include "ar9342_ubnt_xw_rssileds.dtsi"
 
 / {
        compatible = "ubnt,powerbeam-m5-xw", "ubnt,xw", "qca,ar9342";
index 899f1677488336b2df223405ad2a1a64c4be13cb..cd39410be592bd65022f1ca7160a97f6f29972d8 100644 (file)
@@ -9,38 +9,6 @@
        compatible = "ubnt,xw", "qca,ar9342";
        model = "Ubiquiti Networks XW board";
 
-       aliases {
-               led-boot = &led_link4;
-               led-running = &led_link4;
-               led-upgrade = &led_link4;
-               led-failsafe = &led_link4;
-               label-mac-device = &wmac;
-       };
-
-       leds {
-               compatible = "gpio-leds";
-
-               link1 {
-                       label = "red:link1";
-                       gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
-               };
-
-               link2 {
-                       label = "orange:link2";
-                       gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
-               };
-
-               link3 {
-                       label = "green:link3";
-                       gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
-               };
-
-               led_link4: link4 {
-                       label = "green:link4";
-                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
-               };
-       };
-
        keys {
                compatible = "gpio-keys";
 
                                        macaddr_art_0: macaddr@0 {
                                                reg = <0x0 0x6>;
                                        };
+
+                                       calibration_art_1000: calibration@1000 {
+                                               reg = <0x1000 0x440>;
+                                       };
                                };
                        };
                };
 &wmac {
        status = "okay";
 
-       mtd-cal-data = <&art 0x1000>;
+       nvmem-cells = <&calibration_art_1000>;
+       nvmem-cell-names = "calibration";
 };
 
 &eth0 {
diff --git a/target/linux/ath79/dts/ar9342_ubnt_xw_rssileds.dtsi b/target/linux/ath79/dts/ar9342_ubnt_xw_rssileds.dtsi
new file mode 100644 (file)
index 0000000..d54dbeb
--- /dev/null
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar9342_ubnt_xw.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       compatible = "ubnt,xw", "qca,ar9342";
+       model = "Ubiquiti Networks XW board";
+
+       aliases {
+               led-boot = &led_link4;
+               led-running = &led_link4;
+               led-upgrade = &led_link4;
+               led-failsafe = &led_link4;
+               label-mac-device = &wmac;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               link1 {
+                       label = "red:link1";
+                       gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
+               };
+
+               link2 {
+                       label = "orange:link2";
+                       gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
+               };
+
+               link3 {
+                       label = "green:link3";
+                       gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+               };
+
+               led_link4: link4 {
+                       label = "green:link4";
+                       gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+               };
+       };
+};
index ae6e3c4d3071513cb821fbdd8f520c08819fd292..525224bec91a942a94b4482fd3709fe5c7859de8 100644 (file)
@@ -27,7 +27,8 @@ pcs,cap324|\
 tplink,cpe605-v1|\
 tplink,cpe610-v1|\
 tplink,cpe610-v2|\
-tplink,tl-wa1201-v2)
+tplink,tl-wa1201-v2|\
+ubnt,litebeam-m5-xw)
        ucidef_set_led_netdev "lan" "LAN" "green:lan" "eth0"
        ;;
 tplink,tl-wdr6500-v2)
index 70bfd95f9ec4fcab6207642b9c06fb5971943563..01747acae00a48ff6b74f4fc4364f67ea39178ee 100644 (file)
@@ -105,6 +105,7 @@ ath79_setup_interfaces()
        ubnt,bullet-m-xw|\
        ubnt,lap-120|\
        ubnt,litebeam-ac-gen2|\
+       ubnt,litebeam-m5-xw|\
        ubnt,nanobeam-ac|\
        ubnt,nanobeam-ac-xc|\
        ubnt,nanostation-ac-loco|\
index 68cef7d14b13a0e5d15764561a50c463cafda94e..179de961be8ba324ac6c19800fc3d09f48271e5d 100644 (file)
@@ -62,6 +62,14 @@ define Device/ubnt_litebeam-ac-gen2
 endef
 TARGET_DEVICES += ubnt_litebeam-ac-gen2
 
+define Device/ubnt_litebeam-m5-xw
+  $(Device/ubnt-xw)
+  DEVICE_MODEL := LiteBeam M5
+  SUPPORTED_DEVICES += lbe-m5
+  DEVICE_PACKAGES := -kmod-usb2
+endef
+TARGET_DEVICES += ubnt_litebeam-m5-xw
+
 define Device/ubnt_nanobeam-ac
   $(Device/ubnt-wa)
   DEVICE_MODEL := NanoBeam AC
@@ -87,14 +95,6 @@ define Device/ubnt_nanobeam-ac-xc
 endef
 TARGET_DEVICES += ubnt_nanobeam-ac-xc
 
-define Device/ubnt_nanobeam-m5-xw
-  $(Device/ubnt-xw)
-  DEVICE_MODEL := NanoBeam M5
-  DEVICE_PACKAGES += rssileds
-  SUPPORTED_DEVICES += loco-m-xw
-endef
-TARGET_DEVICES += ubnt_nanobeam-m5-xw
-
 define Device/ubnt_nanostation-ac
   $(Device/ubnt-wa)
   DEVICE_MODEL := Nanostation AC
@@ -112,8 +112,17 @@ TARGET_DEVICES += ubnt_nanostation-ac-loco
 define Device/ubnt_nanostation-loco-m-xw
   $(Device/ubnt-xw)
   DEVICE_MODEL := Nanostation Loco M
-  DEVICE_PACKAGES += rssileds
-  SUPPORTED_DEVICES += loco-m-xw
+  DEVICE_PACKAGES += rssileds -kmod-usb2
+  DEVICE_ALT0_VENDOR := Ubiquiti
+  DEVICE_ALT0_MODEL := AirGrid M5 HP
+  DEVICE_ALT0_VARIANT := XW
+  DEVICE_ALT1_VENDOR := Ubiquiti
+  DEVICE_ALT1_MODEL := PowerBeam M5 300
+  DEVICE_ALT1_VARIANT := XW
+  DEVICE_ALT2_VENDOR := Ubiquiti
+  DEVICE_ALT2_MODEL := NanoBeam M5
+  DEVICE_ALT2_VARIANT := XW
+  SUPPORTED_DEVICES += loco-m-xw nanostation-m-xw ubnt,nanobeam-m5-xw
 endef
 TARGET_DEVICES += ubnt_nanostation-loco-m-xw