[openwrt/openwrt] ipq40xx: add support for MikroTik SXTsq 5 ac

LEDE Commits lede-commits at lists.infradead.org
Mon May 3 14:02:38 BST 2021


zorun pushed a commit to openwrt/openwrt.git, branch openwrt-21.02:
https://git.openwrt.org/701d25b551144cacd5d7fd8024fd2e6c7c264b70

commit 701d25b551144cacd5d7fd8024fd2e6c7c264b70
Author: Roger Pueyo Centelles <roger.pueyo at guifi.net>
AuthorDate: Fri Oct 23 16:05:28 2020 +0200

    ipq40xx: add support for MikroTik SXTsq 5 ac
    
    This commit adds support for the MikroTik SXTsq 5 ac (RBSXTsqG-5acD),
    an outdoor 802.11ac wireless CPE with one 10/100/1000 Mbps Ethernet
    port.
    
    Specifications:
     - SoC: Qualcomm Atheros IPQ4018
     - RAM: 256 MB
     - Storage: 16 MB NOR
     - Wireless: IPQ4018 (SoC) 802.11a/n/ac 2x2:2, 16 dBi antennae
     - Ethernet: IPQ4018 (SoC) 1x 10/100/1000 port, 10-28 Vdc PoE in
     - 1x Ethernet LED (green)
     - 7x user-controllable LEDs
      · 1x power (blue)
      · 1x user (green)
      · 5x rssi (green)
    
    Note:
     Serial UART is probably available on the board, but it has not been
     tested.
    
    Flashing:
     Boot via TFTP the initramfs image. Then, upload a sysupgrade image
     via SSH and flash it normally. More info at the "Common procedures
     for MikroTik products" page https://openwrt.org/toh/mikrotik/common.
    
    Signed-off-by: Roger Pueyo Centelles <roger.pueyo at guifi.net>
    (cherry picked from commit d1f1e5269ed992e6fc30d575b43b0913c9e58ca2)
    [Compile and Run Tested]
    Signed-off-by: Nick Hainke <vincent at systemli.org>
---
 package/firmware/ipq-wifi/Makefile                 |   2 +
 .../ipq-wifi/board-mikrotik_sxtsq-5-ac.qca4019     | Bin 0 -> 12176 bytes
 .../linux/ipq40xx/base-files/etc/board.d/01_leds   |   8 +
 .../ipq40xx/base-files/etc/board.d/02_network      |   5 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata       |   3 +-
 .../ipq40xx/base-files/lib/upgrade/platform.sh     |   3 +-
 .../arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts  | 242 +++++++++++++++++++++
 target/linux/ipq40xx/image/mikrotik.mk             |   8 +
 .../patches-5.4/901-arm-boot-add-dts-files.patch   |   3 +-
 9 files changed, 271 insertions(+), 3 deletions(-)

diff --git a/package/firmware/ipq-wifi/Makefile b/package/firmware/ipq-wifi/Makefile
index 770360443a..e3b25bb556 100644
--- a/package/firmware/ipq-wifi/Makefile
+++ b/package/firmware/ipq-wifi/Makefile
@@ -44,6 +44,7 @@ ALLWIFIBOARDS:= \
 	linksys_mr8300-v0 \
 	luma_wrtq-329acn \
 	mikrotik_hap-ac2 \
+	mikrotik_sxtsq-5-ac \
 	mobipromo_cm520-79f \
 	nec_wg2600hp3 \
 	plasmacloud_pa1200 \
@@ -128,6 +129,7 @@ $(eval $(call generate-ipq-wifi-package,linksys_ea8300,Linksys EA8300))
 $(eval $(call generate-ipq-wifi-package,linksys_mr8300-v0,Linksys MR8300))
 $(eval $(call generate-ipq-wifi-package,luma_wrtq-329acn,Luma WRTQ-329ACN))
 $(eval $(call generate-ipq-wifi-package,mikrotik_hap-ac2,Mikrotik hAP ac2))
+$(eval $(call generate-ipq-wifi-package,mikrotik_sxtsq-5-ac,MikroTik SXTsq 5 ac))
 $(eval $(call generate-ipq-wifi-package,mobipromo_cm520-79f,MobiPromo CM520-79F))
 $(eval $(call generate-ipq-wifi-package,nec_wg2600hp3,NEC Platforms WG2600HP3))
 $(eval $(call generate-ipq-wifi-package,plasmacloud_pa1200,Plasma Cloud PA1200))
diff --git a/package/firmware/ipq-wifi/board-mikrotik_sxtsq-5-ac.qca4019 b/package/firmware/ipq-wifi/board-mikrotik_sxtsq-5-ac.qca4019
new file mode 100644
index 0000000000..97f982637a
Binary files /dev/null and b/package/firmware/ipq-wifi/board-mikrotik_sxtsq-5-ac.qca4019 differ
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
index 3e0f3ab258..ac11655904 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
@@ -46,6 +46,14 @@ engenius,ens620ext)
 	ucidef_set_led_netdev "lan1" "LAN1" "green:lan1" "eth0"
 	ucidef_set_led_netdev "lan2" "LAN2" "green:lan2" "eth1"
 	;;
+mikrotik,sxtsq-5-ac)
+	ucidef_set_rssimon "wlan0" "200000" "1"
+	ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100"
+	ucidef_set_led_rssi "rssimediumlow" "rssimediumlow" "green:rssimediumlow" "wlan0" "21" "100"
+	ucidef_set_led_rssi "rssimedium" "rssimedium" "green:rssimedium" "wlan0" "41" "100"
+	ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "61" "100"
+	ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "81" "100"
+	;;
 mobipromo,cm520-79f)
 	ucidef_set_led_netdev "wan" "WAN" "blue:wan" "eth1"
 	ucidef_set_led_switch "lan1" "LAN1" "blue:lan1" "switch0" "0x10"
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 515fa115d9..1d4c78833a 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -29,6 +29,7 @@ ipq40xx_setup_interfaces()
 	engenius,eap1300|\
 	engenius,emd1|\
 	meraki,mr33|\
+	mikrotik,sxtsq-5-ac|\
 	netgear,ex6100v2|\
 	netgear,ex6150v2|\
 	zyxel,wre6606)
@@ -176,6 +177,10 @@ ipq40xx_setup_macs()
 		lan_mac=$(macaddr_add $wan_mac 1)
 		label_mac="$wan_mac"
 		;;
+	mikrotik,sxtsq-5-ac)
+		lan_mac=$(cat /sys/firmware/mikrotik/hard_config/mac_base)
+		label_mac="$lan_mac"
+		;;
 	esac
 
 	[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 0e027dd0a5..b12c9af9a7 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -249,7 +249,8 @@ case "$FIRMWARE" in
 		caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20
 		ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3)
 		;;
-	mikrotik,hap-ac2)
+	mikrotik,hap-ac2|\
+	mikrotik,sxtsq-5-ac)
 		wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data"
 		( [ -f "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data" 0x8000 0x2f20 ) || \
 		( [ -d "$wlan_data" ] && caldata_sysfsload_from_file "$wlan_data/data_2" 0x0 0x2f20 )
diff --git a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
index c94b4d8f9e..54683977cd 100644
--- a/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
@@ -111,7 +111,8 @@ platform_do_upgrade() {
 		CI_KERNPART="part.safe"
 		nand_do_upgrade "$1"
 		;;
-	mikrotik,hap-ac2)
+	mikrotik,hap-ac2|\
+	mikrotik,sxtsq-5-ac)
 		[ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware
 		default_do_upgrade "$1"
 		;;
diff --git a/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts
new file mode 100644
index 0000000000..fd11229dbb
--- /dev/null
+++ b/target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts
@@ -0,0 +1,242 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/* Copyright (c) 2020, Robert Marko <robimarko at gmail.com> */
+
+#include "qcom-ipq4019.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/soc/qcom,tcsr.h>
+
+/ {
+	model = "MikroTik SXTsq 5 ac (RBSXTsqG-5acD)";
+	compatible = "mikrotik,sxtsq-5-ac";
+
+	memory {
+		device_type = "memory";
+		reg = <0x80000000 0x10000000>;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	aliases {
+		led-boot = &led_user;
+		led-failsafe = &led_user;
+		led-running = &led_user;
+		led-upgrade = &led_user;
+	};
+
+	soc {
+		rng at 22000 {
+			status = "okay";
+		};
+
+		mdio at 90000 {
+			status = "okay";
+		};
+
+		counter at 4a1000 {
+			compatible = "qcom,qca-gcnt";
+			reg = <0x4a1000 0x4>;
+		};
+
+		tcsr at 1949000 {
+			compatible = "qcom,tcsr";
+			reg = <0x1949000 0x100>;
+			qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
+		};
+
+		ess_tcsr at 1953000 {
+			compatible = "qcom,tcsr";
+			reg = <0x1953000 0x1000>;
+			qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
+		};
+
+		tcsr at 1957000 {
+			compatible = "qcom,tcsr";
+			reg = <0x1957000 0x100>;
+			qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
+		};
+
+		crypto at 8e3a000 {
+			status = "okay";
+		};
+
+		watchdog at b017000 {
+			status = "okay";
+		};
+
+		ess-psgmii at 98000 {
+			status = "okay";
+		};
+
+		edma at c080000 {
+			status = "okay";
+			phy-mode = "rgmii";
+			qcom,num_gmac = <1>;
+			qcom,single-phy;
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&tlmm 63 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		power {
+			label = "blue:power";
+			gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
+			default-state = "keep";
+			panic-indicator;
+		};
+
+		led_user: user {
+			label = "green:user";
+			gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+		};
+
+		rssilow {
+			label = "green:rssilow";
+			gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>;
+		};
+
+		rssimediumlow {
+			label = "green:rssimediumlow";
+			gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>;
+		};
+
+		rssimedium {
+			label = "green:rssimedium";
+			gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>;
+		};
+
+		rssimediumhigh {
+			label = "green:rssimediumhigh";
+			gpios = <&tlmm 4 GPIO_ACTIVE_HIGH>;
+		};
+
+		rssihigh {
+			label = "green:rssihigh";
+			gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&tlmm {
+	serial_pins: serial_pinmux {
+		mux {
+			pins = "gpio60", "gpio61";
+			function = "blsp_uart0";
+			bias-disable;
+		};
+	};
+
+	spi_0_pins: spi_0_pinmux {
+		pin {
+			function = "blsp_spi0";
+			pins = "gpio55", "gpio56", "gpio57";
+			drive-strength = <2>;
+			bias-disable;
+		};
+		pin_cs {
+			function = "gpio";
+			pins = "gpio54";
+			drive-strength = <2>;
+			bias-disable;
+			output-high;
+		};
+	};
+};
+
+&blsp_dma {
+	status = "okay";
+};
+
+&blsp1_spi1 {
+	status = "okay";
+
+	pinctrl-0 = <&spi_0_pins>;
+	pinctrl-names = "default";
+	cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>;
+
+	flash at 0 {
+		reg = <0>;
+		compatible = "jedec,spi-nor";
+		spi-max-frequency = <40000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "Qualcomm";
+				reg = <0x0 0x80000>;
+				read-only;
+			};
+
+			partition at 80000 {
+				compatible = "mikrotik,routerboot-partitions";
+				#address-cells = <1>;
+				#size-cells = <1>;
+				label = "RouterBoot";
+				reg = <0x80000 0x80000>;
+				read-only;
+
+				hard_config {
+					read-only;
+				};
+
+				dtb_config {
+					read-only;
+				};
+
+				soft_config {
+				};
+			};
+
+			partition at 100000 {
+				compatible = "mikrotik,minor";
+				label = "firmware";
+				reg = <0x100000 0xf00000>;
+			};
+		};
+	};
+};
+
+&blsp1_uart1 {
+	status = "okay";
+
+	pinctrl-0 = <&serial_pins>;
+	pinctrl-names = "default";
+};
+
+&cryptobam {
+	status = "okay";
+};
+
+&wifi1 {
+	status = "okay";
+
+	qcom,ath10k-calibration-variant = "MikroTik-SXTsq-5-ac";
+};
+
+&gmac0 {
+	qcom,phy_mdio_addr = <4>;
+	qcom,poll_required = <1>;
+	qcom,forced_speed = <1000>;
+	qcom,forced_duplex = <1>;
+	vlan_tag = <1 0x20>;
+};
+
+&mdio {
+	status = "okay";
+};
diff --git a/target/linux/ipq40xx/image/mikrotik.mk b/target/linux/ipq40xx/image/mikrotik.mk
index 9509ef8577..7c2fa52738 100644
--- a/target/linux/ipq40xx/image/mikrotik.mk
+++ b/target/linux/ipq40xx/image/mikrotik.mk
@@ -18,3 +18,11 @@ define Device/mikrotik_hap-ac2
 		kmod-ath10k-ct-smallbuffers
 endef
 TARGET_DEVICES += mikrotik_hap-ac2
+
+define Device/mikrotik_sxtsq-5-ac
+	$(call Device/mikrotik_nor)
+	DEVICE_MODEL := SXTsq 5 ac (RBSXTsqG-5acD)
+	SOC := qcom-ipq4018
+	DEVICE_PACKAGES := ipq-wifi-mikrotik_sxtsq-5-ac rssileds
+endef
+TARGET_DEVICES += mikrotik_sxtsq-5-ac
diff --git a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch
index 6a421b9007..6b7c68bf63 100644
--- a/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch
+++ b/target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch
@@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -837,11 +837,59 @@ dtb-$(CONFIG_ARCH_QCOM) += \
+@@ -837,11 +837,60 @@ dtb-$(CONFIG_ARCH_QCOM) += \
  	qcom-apq8074-dragonboard.dtb \
  	qcom-apq8084-ifc6540.dtb \
  	qcom-apq8084-mtp.dtb \
@@ -32,6 +32,7 @@ Signed-off-by: John Crispin <john at phrozen.org>
 +	qcom-ipq4018-jalapeno.dtb \
 +	qcom-ipq4018-meshpoint-one.dtb \
 +	qcom-ipq4018-hap-ac2.dtb \
++	qcom-ipq4018-sxtsq-5-ac.dtb \
 +	qcom-ipq4018-nbg6617.dtb \
 +	qcom-ipq4019-oap100.dtb \
 +	qcom-ipq4018-pa1200.dtb \



More information about the lede-commits mailing list