diff mbox series

ath79: Add support for Ubiquiti NanoBeam AC Gen2 XC

Message ID 12217190.O9o76ZdvQC@tool
State New
Headers show
Series ath79: Add support for Ubiquiti NanoBeam AC Gen2 XC | expand

Commit Message

Daniel González Cabanelas March 15, 2023, 3:08 p.m. UTC
The Ubiquiti NanoBeam AC Gen2 XC (NBE-5AC-Gen2) is an outdoor 802.11ac CPE
with a waterproof casing (ultrasonically welded) and bulb shaped.

It's the same board as Gen1 but with a small antenna routed out of the SoC
and calibration data for this management radio in the "art" partition.

Hardware:
   SoC:                Qualcomm Atheros QCA9558
   CPU:                MIPS 74Kc V5.0 720 MHz, 1 core  
   RAM:                128 MB DDR2
   Flash:              16 MB SPI-NOR, MX25L12805D
   Ethernet:           1x GbE
   WiFi 5 GHz:         Qualcomm Atheros QCA988X
   WiFi 2.4 GHz:       SoC (management radio)
   Internal antenna 1: 19 dBi planar (5 GHz)
   Internal antenna 2: 2 dBi PCB, connected via UFL (SoC)
   Buttons:            1x reset
   LEDs:               1x power, 1x Ethernet, 4x RSSI, all blue
   PSU:                24 Vdc passive PoE

Installation from stock airOS firmware:
 - Follow instructions for XC-type Ubiquiti devices on OpenWrt wiki at
   https://openwrt.org/toh/ubiquiti/common

Back to stock firmware:
 - Follow instructions for Ubiquiti recovery via TFTP at OpenWrt wiki.

Signed-off-by: Daniel González Cabanelas <dgcbueu@gmail.com>
---
 .../dts/qca9558_ubnt_nanobeam-ac-gen2-xc.dts  |  17 +++
 .../ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dts | 105 +----------------
 .../dts/qca9558_ubnt_nanobeam-ac-xc.dtsi      | 107 ++++++++++++++++++
 .../generic/base-files/etc/board.d/01_leds    |   1 +
 .../generic/base-files/etc/board.d/02_network |   2 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |   1 +
 target/linux/ath79/image/generic-ubnt.mk      |  10 ++
 7 files changed, 141 insertions(+), 102 deletions(-)
 create mode 100644 target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-gen2-xc.dts
 create mode 100644 target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dtsi
diff mbox series

Patch

diff --git a/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-gen2-xc.dts b/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-gen2-xc.dts
new file mode 100644
index 0000000000..629b5bfe0a
--- /dev/null
+++ b/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-gen2-xc.dts
@@ -0,0 +1,17 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/*
+ * Device Tree file for Ubiquiti Nanobeam NBE-5AC-Gen2 (XC)
+ */
+ 
+#include "qca9558_ubnt_nanobeam-ac-xc.dtsi"
+
+/ {
+	compatible = "ubnt,nanobeam-ac-gen2-xc", "ubnt,xc", "qca,qca9558";
+	model = "Ubiquiti NanoBeam AC Gen2 (XC)";
+};
+
+&wmac {
+	status = "okay";
+
+	mtd-cal-data = <&art 0x1000>;
+};
diff --git a/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dts b/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dts
index 91675ff615..898c249154 100644
--- a/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dts
+++ b/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dts
@@ -1,110 +1,11 @@ 
-// SPDX-License-Identifier: GPL-2.0-only
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 /*
  * Device Tree file for Ubiquiti Nanobeam NBE-5AC-19 (XC)
- *
- * Copyright (C) 2022 Daniel González Cabanelas <dgcbueu@gmail.com>
- * based on device tree from qca9558_ubnt_powerbeam-5ac-500.dts
  */
-
-#include "qca955x_ubnt_xc.dtsi"
+ 
+#include "qca9558_ubnt_nanobeam-ac-xc.dtsi"
 
 / {
 	compatible = "ubnt,nanobeam-ac-xc", "ubnt,xc", "qca,qca9558";
 	model = "Ubiquiti NanoBeam AC Gen1 (XC)";
-
-	aliases {
-		led-boot = &led_power;
-		led-failsafe = &led_power;
-		led-running = &led_power;
-		led-upgrade = &led_power;
-	};
-
-	keys {
-		compatible = "gpio-keys";
-
-		reset {
-			label = "Reset button";
-			linux,code = <KEY_RESTART>;
-			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
-			debounce-interval = <60>;
-		};
-	};
-
-	led_spi {
-		compatible = "spi-gpio";
-		#address-cells = <1>;
-		#size-cells = <0>;
-
-		sck-gpios  = <&gpio 0 GPIO_ACTIVE_HIGH>;
-		mosi-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
-		cs-gpios   = <&gpio 3 GPIO_ACTIVE_HIGH>;
-		num-chipselects = <1>;
-
-		led_gpio: led_gpio@0 {
-			compatible = "fairchild,74hc595";
-			reg = <0>;
-			gpio-controller;
-			#gpio-cells = <2>;
-			registers-number = <1>;
-			spi-max-frequency = <10000000>;
-			enable-gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
-		};
-	};
-
-	leds {
-		compatible = "gpio-leds";
-
-		rssi0 {
-			label = "blue:rssi0";
-			gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
-		};
-		rssi1 {
-			label = "blue:rssi1";
-			gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
-		};
-		rssi2 {
-			label = "blue:rssi2";
-			gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
-		};
-		rssi3 {
-			label = "blue:rssi3";
-			gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
-		};
-		led_power: power {
-			label = "blue:power";
-			gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>;
-			default-state = "on";
-		};
-	};
-};
-
-&mdio0 {
-	status = "okay";
-
-	phy4: ethernet-phy@4 {
-		phy-mode = "sgmii";
-		reg = <4>;
-		at803x-override-sgmii-link-check;
-	};
-};
-
-&eth0 {
-	status = "okay";
-
-	pll-reg = <0 0x48 0>;
-	pll-data = <0x03000000 0x00000101 0x00001313>;
-	nvmem-cells = <&macaddr_art_0>;
-	nvmem-cell-names = "mac-address";
-	phy-mode = "sgmii";
-	phy-handle = <&phy4>;
-};
-
-&art {
-	compatible = "nvmem-cells";
-	#address-cells = <1>;
-	#size-cells = <1>;
-
-	macaddr_art_0: macaddr@0 {
-		reg = <0x0 0x6>;
-	};
 };
diff --git a/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dtsi b/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dtsi
new file mode 100644
index 0000000000..e68ceb7f5c
--- /dev/null
+++ b/target/linux/ath79/dts/qca9558_ubnt_nanobeam-ac-xc.dtsi
@@ -0,0 +1,107 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/*
+ * Device Tree file for Ubiquiti Nanobeam XC
+ *
+ * Copyright (C) 2022 Daniel González Cabanelas <dgcbueu@gmail.com>
+ * based on device tree from qca9558_ubnt_powerbeam-5ac-500.dts
+ */
+
+#include "qca955x_ubnt_xc.dtsi"
+
+/ {
+	aliases {
+		led-boot = &led_power;
+		led-failsafe = &led_power;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "Reset button";
+			linux,code = <KEY_RESTART>;
+			gpios = <&gpio 19 GPIO_ACTIVE_LOW>;
+			debounce-interval = <60>;
+		};
+	};
+
+	led_spi {
+		compatible = "spi-gpio";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		sck-gpios  = <&gpio 0 GPIO_ACTIVE_HIGH>;
+		mosi-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+		cs-gpios   = <&gpio 3 GPIO_ACTIVE_LOW>;
+		num-chipselects = <1>;
+
+		led_gpio: led_gpio@0 {
+			compatible = "fairchild,74hc595";
+			reg = <0>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			registers-number = <1>;
+			spi-max-frequency = <10000000>;
+			enable-gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		rssi0 {
+			label = "blue:rssi0";
+			gpios = <&led_gpio 0 GPIO_ACTIVE_LOW>;
+		};
+		rssi1 {
+			label = "blue:rssi1";
+			gpios = <&led_gpio 1 GPIO_ACTIVE_LOW>;
+		};
+		rssi2 {
+			label = "blue:rssi2";
+			gpios = <&led_gpio 2 GPIO_ACTIVE_LOW>;
+		};
+		rssi3 {
+			label = "blue:rssi3";
+			gpios = <&led_gpio 3 GPIO_ACTIVE_LOW>;
+		};
+		led_power: power {
+			label = "blue:power";
+			gpios = <&led_gpio 4 GPIO_ACTIVE_LOW>;
+			default-state = "on";
+		};
+	};
+};
+
+&mdio0 {
+	status = "okay";
+
+	phy4: ethernet-phy@4 {
+		phy-mode = "sgmii";
+		reg = <4>;
+		at803x-override-sgmii-link-check;
+	};
+};
+
+&eth0 {
+	status = "okay";
+
+	pll-reg = <0 0x48 0>;
+	pll-data = <0x03000000 0x00000101 0x00001313>;
+	nvmem-cells = <&macaddr_art_0>;
+	nvmem-cell-names = "mac-address";
+	phy-mode = "sgmii";
+	phy-handle = <&phy4>;
+};
+
+&art {
+	compatible = "nvmem-cells";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	macaddr_art_0: macaddr@0 {
+		reg = <0x0 0x6>;
+	};
+};
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 5855d2a928..a91e82f5e6 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -464,6 +464,7 @@  ubnt,bullet-ac|\
 ubnt,nanobeam-ac|\
 ubnt,nanobeam-ac-gen2|\
 ubnt,nanobeam-ac-xc|\
+ubnt,nanobeam-ac-gen2-xc|\
 ubnt,nanostation-ac|\
 ubnt,powerbeam-5ac-gen2)
 	ucidef_set_rssimon "wlan0" "200000" "1"
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 b20a3c13f8..f5137385c2 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -101,6 +101,7 @@  ath79_setup_interfaces()
 	ubnt,litebeam-ac-gen2|\
 	ubnt,nanobeam-ac|\
 	ubnt,nanobeam-ac-xc|\
+	ubnt,nanobeam-ac-gen2-xc|\
 	ubnt,nanostation-ac-loco|\
 	ubnt,nanostation-loco-m-xw|\
 	ubnt,powerbeam-5ac-500|\
@@ -774,6 +775,7 @@  ath79_setup_macs()
 	ubnt,litebeam-ac-gen2|\
 	ubnt,nanobeam-ac-gen2|\
 	ubnt,nanobeam-ac-xc|\
+	ubnt,nanobeam-ac-gen2-xc|\
 	ubnt,powerbeam-5ac-500|\
 	ubnt,powerbeam-5ac-gen2)
 		label_mac=$(mtd_get_mac_binary art 0x5006)
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 4db311fde0..a79781237b 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -45,6 +45,7 @@  case "$FIRMWARE" in
 	ubnt,nanobeam-ac|\
 	ubnt,nanobeam-ac-gen2|\
 	ubnt,nanobeam-ac-xc|\
+	ubnt,nanobeam-ac-gen2-xc|\
 	ubnt,nanostation-ac|\
 	ubnt,nanostation-ac-loco|\
 	ubnt,powerbeam-5ac-500|\
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index 0f70649d03..a78ccaef82 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -87,6 +87,16 @@  define Device/ubnt_nanobeam-ac-xc
 endef
 TARGET_DEVICES += ubnt_nanobeam-ac-xc
 
+define Device/ubnt_nanobeam-ac-gen2-xc
+  $(Device/ubnt-xc)
+  SOC := qca9558
+  DEVICE_MODEL := NanoBeam AC
+  DEVICE_VARIANT := Gen2 (XC)
+  SUPPORTED_DEVICES += ubnt,nanobeam-ac-xc
+  DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct rssileds
+endef
+TARGET_DEVICES += ubnt_nanobeam-ac-gen2-xc
+
 define Device/ubnt_nanobeam-m5-xw
   $(Device/ubnt-xw)
   DEVICE_MODEL := NanoBeam M5