ath79: add support for RouterBOARD mAP
authorThibaut VARÈNE <hacks@slashdirt.org>
Sun, 12 Jun 2022 19:48:40 +0000 (21:48 +0200)
committerKoen Vandeputte <koen.vandeputte@ncentric.com>
Wed, 29 Jun 2022 10:36:04 +0000 (12:36 +0200)
The MikroTik mAP-2nd (sold as mAP) is an indoor 2.4Ghz AP with
802.3af/at PoE input and passive PoE passthrough.

See https://mikrotik.com/product/RBmAP2nD for more details.

Specifications:
 - SoC: QCA9533
 - RAM: 64MB
 - Storage: 16MB NOR
 - Wireless: QCA9533 802.11b/g/n 2x2
 - Ethernet: 2x 10/100 ports,
    802.3af/at PoE in port 1, 500 mA passive PoE out on port 2
 - 7 user-controllable LEDs

Note: the device is a tiny AP and does not distinguish between both
ethernet ports roles, so they are both assigned to lan.
With the current setup, ETH1 is connected to eth1 and ETH2 is connected
to eth0 via the embedded switch port 2.

Flashing:
 TFTP boot initramfs image and then perform sysupgrade. The "ETH1" port
 must be used to upload the TFTP image. Follow common MikroTik procedure
 as in https://openwrt.org/toh/mikrotik/common.

Tested-By: Andrew Powers-Holmes <aholmes@omnom.net>
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts [new file with mode: 0644]
target/linux/ath79/image/mikrotik.mk
target/linux/ath79/mikrotik/base-files/etc/board.d/01_leds
target/linux/ath79/mikrotik/base-files/etc/board.d/02_network
target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom

diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-map-2nd.dts
new file mode 100644 (file)
index 0000000..25971e6
--- /dev/null
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca9533_mikrotik_routerboard-16m.dtsi"
+
+/ {
+       compatible = "mikrotik,routerboard-map-2nd", "qca,qca9533";
+       model = "MikroTik RouterBOARD mAP-2nD (mAP)";
+
+       aliases {
+               led-boot = &led_user;
+               led-failsafe = &led_user;
+               led-running = &led_user;
+               led-upgrade = &led_user;
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               power {
+                       label = "green:power";
+                       gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+                       default-state = "on";
+               };
+
+               eth_1 {
+                       label = "green:eth_1";
+                       gpios = <&gpio_ext 0 GPIO_ACTIVE_LOW>;
+               };
+
+               eth_2 {
+                       label = "green:eth_2";
+                       gpios = <&gpio_ext 1 GPIO_ACTIVE_LOW>;
+               };
+
+               poe_out {
+                       label = "red:poe_out";
+                       gpios = <&gpio_ext 2 GPIO_ACTIVE_LOW>;
+               };
+
+               led_user: user {
+                       label = "green:user";
+                       gpios = <&gpio_ext 3 GPIO_ACTIVE_LOW>;
+               };
+
+               wlan {
+                       label = "green:wlan";
+                       gpios = <&gpio_ext 4 GPIO_ACTIVE_LOW>;
+                       linux,default-trigger = "phy0tpt";
+               };
+
+               ap_cap {
+                       label = "green:ap_cap";
+                       gpios = <&gpio_ext 6 GPIO_ACTIVE_LOW>;
+               };
+
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+
+               usb_power {
+                       gpio-export,name = "usb-power";
+                       gpio-export,output = <1>;
+                       gpios = <&gpio_ext 5 GPIO_ACTIVE_LOW>;
+               };
+
+               enable_poe_port5 {
+                       gpio-export,name = "enable-poe";
+                       gpio-export,output = <0>;
+                       gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&spi {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pin_spi_cs1>;
+
+       gpio_ext: gpio_ext@1 {
+               compatible = "fairchild,74hc595";
+               reg = <1>;
+               gpio-controller;
+               #gpio-cells = <2>;
+               registers-number = <1>;
+               spi-max-frequency = <25000000>;
+       };
+};
+
+
+&pinmux {
+       pin_spi_cs1: pinmux_spi_cs1 {
+               pinctrl-single,bits = <0x8 0x0a000000 0xff000000>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       phy-handle = <&swphy0>;
+
+       gmac-config {
+               device = <&gmac>;
+               switch-phy-swap = <1>;
+       };
+};
+
+&usb0 {
+       status = "okay";
+};
+
+&usb_phy {
+       status = "okay";
+};
index d8ae726e874eec82bb1e1061bce19584beea3ff0..c90579fbb58d65129cdb3c368f1efbb8b029fcfc 100644 (file)
@@ -85,6 +85,15 @@ define Device/mikrotik_routerboard-lhg-5nd
 endef
 TARGET_DEVICES += mikrotik_routerboard-lhg-5nd
 
+define Device/mikrotik_routerboard-map-2nd
+  $(Device/mikrotik_nor)
+  SOC := qca9533
+  DEVICE_MODEL := RouterBOARD mAP-2nD (mAP)
+  DEVICE_PACKAGES += kmod-usb2 kmod-ledtrig-gpio
+  IMAGE_SIZE := 16256k
+endef
+TARGET_DEVICES += mikrotik_routerboard-map-2nd
+
 define Device/mikrotik_routerboard-mapl-2nd
   $(Device/mikrotik_nor)
   SOC := qca9533
index edb83b9baa6bca58bab4fc3bb91dda6014793757..76b91a54a5f28eb3bdb036aa49ef1bc4266db89c 100644 (file)
@@ -28,6 +28,11 @@ mikrotik,routerboard-lhg-5nd)
        ucidef_set_led_rssi "rssimediumhigh" "rssimediumhigh" "green:rssimediumhigh" "wlan0" "60" "100"
        ucidef_set_led_rssi "rssihigh" "rssihigh" "green:rssihigh" "wlan0" "80" "100"
        ;;
+mikrotik,routerboard-map-2nd)
+       ucidef_set_led_netdev "eth_1" "eth_1" "green:eth_1" "eth1"
+       ucidef_set_led_switch "eth_2" "eth_2" "green:eth_2" "switch0" "0x4"
+       ucidef_set_led_gpio "poe" "poe" "red:poe_out" "14" "0"
+       ;;
 mikrotik,routerboard-wapr-2nd)
        ucidef_set_rssimon "wlan0" "200000" "1"
        ucidef_set_led_rssi "rssilow" "rssilow" "green:rssilow" "wlan0" "1" "100"
index b05a41ec36bf40e97bcfa677ac9d1c4603323fee..5646d8cf68a7f9f81c305ea58253f416e637f9e3 100644 (file)
@@ -30,6 +30,9 @@ ath79_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1"
                ;;
+       mikrotik,routerboard-map-2nd)
+               ucidef_set_interface_lan "eth0 eth1"
+               ;;
        mikrotik,routerboard-962uigs-5hact2hnt)
                ucidef_add_switch "switch0" \
                        "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan"
@@ -52,6 +55,7 @@ ath79_setup_macs()
        mikrotik,routerboard-912uag-2hpnd|\
        mikrotik,routerboard-lhg-2nd|\
        mikrotik,routerboard-lhg-5nd|\
+       mikrotik,routerboard-map-2nd|\
        mikrotik,routerboard-mapl-2nd|\
        mikrotik,routerboard-sxt-5nd-r2|\
        mikrotik,routerboard-wap-2nd|\
index 0baed0665c842dd22cbb521bc695fa5d4671ef27..aa5354bfdb37de95fd7ece2076b2f6de0b6147fb 100644 (file)
@@ -31,6 +31,9 @@ case "$FIRMWARE" in
        mikrotik,routerboard-wapr-2nd)
                caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 1)
                ;;
+       mikrotik,routerboard-map-2nd)
+               caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 3)
+               ;;
        mikrotik,routerboard-mapl-2nd|\
        mikrotik,routerboard-wap-g-5hact2hnd)
                caldata_mikrotik_ath9k 0x1000 0x440 $(macaddr_add "$mac_base" 2)