ipq40xx: add support for MikroTik SXTsq 5 ac
authorRoger Pueyo Centelles <roger.pueyo@guifi.net>
Fri, 23 Oct 2020 14:05:28 +0000 (16:05 +0200)
committerPaul Spooren <mail@aparcar.org>
Thu, 29 Apr 2021 08:55:07 +0000 (10:55 +0200)
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@guifi.net>
package/firmware/ipq-wifi/Makefile
package/firmware/ipq-wifi/board-mikrotik_sxtsq-5-ac.qca4019 [new file with mode: 0644]
target/linux/ipq40xx/base-files/etc/board.d/01_leds
target/linux/ipq40xx/base-files/etc/board.d/02_network
target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ipq40xx/base-files/lib/upgrade/platform.sh
target/linux/ipq40xx/files/arch/arm/boot/dts/qcom-ipq4018-sxtsq-5-ac.dts [new file with mode: 0644]
target/linux/ipq40xx/image/mikrotik.mk
target/linux/ipq40xx/patches-5.4/901-arm-boot-add-dts-files.patch

index 770360443a28f27d1d485fd2214889213e9931b4..e3b25bb556658ef9399b6e6399f9f218870be996 100644 (file)
@@ -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 (file)
index 0000000..97f9826
Binary files /dev/null and b/package/firmware/ipq-wifi/board-mikrotik_sxtsq-5-ac.qca4019 differ
index 75418a37c75e9323acb7a6d03b57c327ae00fd0f..b2545f41e179e3e0cd80d8a2eb32b4bee430fa38 100644 (file)
@@ -45,6 +45,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"
index 3f0209d82dd834bdac0c962e2abc8099bdc353e0..6a94fe3ff4055fa8d808646e5468d2a94933c1ac 100644 (file)
@@ -28,6 +28,7 @@ ipq40xx_setup_interfaces()
        engenius,eap1300|\
        engenius,emd1|\
        meraki,mr33|\
+       mikrotik,sxtsq-5-ac|\
        netgear,ex6100v2|\
        netgear,ex6150v2|\
        zyxel,wre6606)
@@ -175,6 +176,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
index 0e027dd0a5066013205e1cff8f1e9a891a570939..b12c9af9a7ffd631b4beb48494ce16fdbc535d53 100644 (file)
@@ -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 )
index c94b4d8f9e0874ac75c4ad10c322faa50cf727aa..54683977cd40b414009285467b4c8ab6d4d31aee 100644 (file)
@@ -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 (file)
index 0000000..fd11229
--- /dev/null
@@ -0,0 +1,242 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/* Copyright (c) 2020, Robert Marko <robimarko@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@22000 {
+                       status = "okay";
+               };
+
+               mdio@90000 {
+                       status = "okay";
+               };
+
+               counter@4a1000 {
+                       compatible = "qcom,qca-gcnt";
+                       reg = <0x4a1000 0x4>;
+               };
+
+               tcsr@1949000 {
+                       compatible = "qcom,tcsr";
+                       reg = <0x1949000 0x100>;
+                       qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
+               };
+
+               ess_tcsr@1953000 {
+                       compatible = "qcom,tcsr";
+                       reg = <0x1953000 0x1000>;
+                       qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
+               };
+
+               tcsr@1957000 {
+                       compatible = "qcom,tcsr";
+                       reg = <0x1957000 0x100>;
+                       qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
+               };
+
+               crypto@8e3a000 {
+                       status = "okay";
+               };
+
+               watchdog@b017000 {
+                       status = "okay";
+               };
+
+               ess-psgmii@98000 {
+                       status = "okay";
+               };
+
+               edma@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@0 {
+               reg = <0>;
+               compatible = "jedec,spi-nor";
+               spi-max-frequency = <40000000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "Qualcomm";
+                               reg = <0x0 0x80000>;
+                               read-only;
+                       };
+
+                       partition@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@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";
+};
index 9509ef8577391fb05c6785641caf7aaee09274b2..7c2fa52738f77ec39cf542a2f89010ea0dfccadf 100644 (file)
@@ -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
index 6a421b90079b12f904f534c53fd2ff0b8da8eb28..6b7c68bf6360cc5e7d7abda1a883b26b11e03789 100644 (file)
@@ -10,7 +10,7 @@ Signed-off-by: John Crispin <john@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@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 \