ar71xx: add support for MikroTik hAP ac lite
authorRyan Mounce <ryan@mounce.com.au>
Wed, 8 Mar 2017 09:07:00 +0000 (19:37 +1030)
committerPiotr Dymacz <pepe2k@gmail.com>
Thu, 23 Mar 2017 08:35:14 +0000 (09:35 +0100)
This patch adds support for the MikroTik RouterBOARD hAP ac lite
(RB952Ui-5ac2nD).

The hAP ac lite is nearly identical to the hAP, with an added QCA9887
5GHz radio. The 2.4GHz radio ID is also changed in the hAP ac lite.

Signed-off-by: Ryan Mounce <ryan@mounce.com.au>
target/linux/ar71xx/base-files/etc/board.d/01_leds
target/linux/ar71xx/base-files/etc/board.d/02_network
target/linux/ar71xx/base-files/etc/board.d/03_gpio_switches
target/linux/ar71xx/base-files/etc/diag.sh
target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
target/linux/ar71xx/base-files/lib/ar71xx.sh
target/linux/ar71xx/base-files/lib/upgrade/platform.sh
target/linux/ar71xx/files/arch/mips/ath79/Kconfig.openwrt
target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c
target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
target/linux/ar71xx/image/mikrotik.mk

index 686ae31b750437e5975b1fca4102377cfcc6a210..a5b27306034ad0129be22711e8a41dde2ccde4a4 100755 (executable)
@@ -239,7 +239,8 @@ rb-750up-r2)
 rb-941-2nd)
        ucidef_set_led_timer "user" "USR/ACT" "rb:green:user" "1000" "1000"
        ;;
-rb-951ui-2nd)
+rb-951ui-2nd|\
+rb-952ui-5ac2nd)
        ucidef_set_led_timer "user" "USER" "rb:green:user" "1000" "1000"
        ucidef_set_led_netdev "port1" "port1" "rb:green:port1" "eth0"
        ucidef_set_led_switch "port2" "port2" "rb:green:port2" "switch0" "0x10"
index 20b34e89652da3f3ce2d5883942b95875e5a886f..3888cbe8978918b42b456df2354a2f8bcdc1980a 100755 (executable)
@@ -142,6 +142,7 @@ ar71xx_setup_interfaces()
        rb-750up-r2|\
        rb-951ui-2hnd|\
        rb-951ui-2nd|\
+       rb-952ui-5ac2nd|\
        routerstation|\
        tl-wr710n|\
        tl-wr720n-v3|\
index 4bb319c93746829f8391d0730418554cad8c3b6d..2b18741cd93679ff14b5e197c5537fae63049d40 100755 (executable)
@@ -28,7 +28,8 @@ rb-912uag-5hpnd)
        ucidef_add_gpio_switch "usb_power_switch" "USB Power Switch" "52" "1"
        ;;
 rb-750up-r2|\
-rb-951ui-2nd)
+rb-951ui-2nd|\
+rb-952ui-5ac2nd)
        ucidef_add_gpio_switch "usb_power_switch" "USB Power Switch" "45" "1"
        ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "14"
        ;;
index 0c4349ff2b66f4d227ab2bb43d3c8980107bd626..8b2cc0826966b7efb4cbade9db1a35b4c54848ac 100644 (file)
@@ -306,6 +306,7 @@ get_status_led() {
        rb-912uag-5hpnd|\
        rb-941-2nd|\
        rb-951ui-2nd|\
+       rb-952ui-5ac2nd|\
        rb-lhg-5nd|\
        rb-mapl-2nd)
                status_led="rb:green:user"
index 4938e2653ab5faf5e24336609181701b874d85ab..323aa40518b9127cdf65fe23259e76941975e72e 100644 (file)
@@ -106,6 +106,9 @@ case "$FIRMWARE" in
        unifiac-pro)
                ath10kcal_extract "EEPROM" 20480 2116
                ;;
+       rb-952ui-5ac2nd)
+               ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 20480 2116
+               ;;
        esac
        ;;
 "ath10k/cal-pci-0000:01:00.0.bin")
index 4951e5b6250d7789365c9ecc28a345af2f808586..63c09871d40695ef0f577dd1b90b639873f1c938 100755 (executable)
@@ -905,6 +905,9 @@ ar71xx_board_detect() {
        *"RouterBOARD 951Ui-2nD")
                name="rb-951ui-2nd"
                ;;
+       *"RouterBOARD 952Ui-5ac2nD")
+               name="rb-952ui-5ac2nd"
+               ;;
        *"RouterBOARD LHG 5nD")
                name="rb-lhg-5nd"
                ;;
index 364a32f76c7832db9f1d6dd2fd1bd58103ee6d92..f5f37f044d8a7b8846f68d3354991dee8425b073 100755 (executable)
@@ -638,6 +638,7 @@ platform_check_image() {
        rb-750up-r2|\
        rb-941-2nd|\
        rb-951ui-2nd|\
+       rb-952ui-5ac2nd|\
        rb-lhg-5nd|\
        rb-mapl-2nd)
                return 0
@@ -690,6 +691,7 @@ platform_pre_upgrade() {
        rb-750up-r2|\
        rb-941-2nd|\
        rb-951ui-2nd|\
+       rb-952ui-5ac2nd|\
        rb-lhg-5nd|\
        rb-mapl-2nd)
                # erase firmware if booted from initramfs
index 1bf00bd850aa282e031123fbd84f7b6b268fd088..5ee033f57bdeeafa3867657944b83c824965f362 100644 (file)
@@ -942,6 +942,7 @@ config ATH79_MACH_RBSPI
          MikroTik RouterBOARD mAP lite
          MikroTik RouterBOARD hAP lite
          MikroTik RouterBOARD hAP
+         MikroTik RouterBOARD hAP ac lite
          MikroTik RouterBOARD hEX PoE lite
          MikroTik RouterBOARD hEX lite
          MikroTik RouterBOARD LHG 5
index 3f68b94bcdf0f7bdd7ada6071ae1faa76a74172e..d281bf1a6a5429de0496b39c41978cea4905ea06 100644 (file)
@@ -4,6 +4,7 @@
  *  - MikroTik RouterBOARD mAP L-2nD
  *  - MikroTik RouterBOARD 941L-2nD
  *  - MikroTik RouterBOARD 951Ui-2nD
+ *  - MikroTik RouterBOARD 952Ui-5ac2nD
  *  - MikroTik RouterBOARD 750UP r2
  *  - MikroTik RouterBOARD 750 r2
  *  - MikroTik RouterBOARD LHG 5nD
@@ -23,6 +24,7 @@
  *  by the Free Software Foundation.
  */
 
+#include <linux/pci.h>
 #include <linux/platform_device.h>
 #include <linux/phy.h>
 #include <linux/routerboot.h>
@@ -47,6 +49,7 @@
 #include "dev-usb.h"
 #include "dev-wmac.h"
 #include "machtypes.h"
+#include "pci.h"
 #include "routerboot.h"
 
 #define RBSPI_KEYS_POLL_INTERVAL 20 /* msecs */
@@ -59,6 +62,7 @@
 #define RBSPI_HAS_SSR          BIT(4)  /* has an SSR on SPI bus 0 */
 #define RBSPI_HAS_POE          BIT(5)
 #define RBSPI_HAS_MDIO1                BIT(6)
+#define RBSPI_HAS_PCI          BIT(7)
 
 #define RB_ROUTERBOOT_OFFSET    0x0000
 #define RB_BIOS_SIZE            0x1000
@@ -490,6 +494,9 @@ static void __init rbspi_peripherals_setup(u32 flags)
 
        if (flags & RBSPI_HAS_USB)
                ath79_register_usb();
+
+       if (flags & RBSPI_HAS_PCI)
+               ath79_register_pci();
 }
 
 /*
@@ -597,7 +604,7 @@ static void __init rbhapl_setup(void)
 }
 
 /*
- * The hAP, hEX lite and hEX PoE lite share the same platform
+ * The hAP, hAP ac lite, hEX lite and hEX PoE lite share the same platform
  */
 static void __init rbspi_952_750r2_setup(u32 flags)
 {
@@ -606,8 +613,11 @@ static void __init rbspi_952_750r2_setup(u32 flags)
 
        rbspi_peripherals_setup(flags);
 
-       /* GMAC1 is HW MAC + 1, WLAN0 MAC IS HW MAC + 5 */
-       rbspi_network_setup(flags, 1, 5, 0);
+       /*
+        * GMAC1 is HW MAC + 1, WLAN0 MAC IS HW MAC + 5 (hAP),
+        * WLAN1 MAC IS HW MAC + 6 (hAP ac lite)
+        */
+       rbspi_network_setup(flags, 1, 5, 6);
 
        if (flags & RBSPI_HAS_USB)
                gpio_request_one(RB952_GPIO_USB_POWER,
@@ -628,22 +638,30 @@ static void __init rbspi_952_750r2_setup(u32 flags)
 }
 
 /*
- * Init the hAP hardware (QCA953x).
+ * Init the hAP (ac lite) hardware (QCA953x).
  * The 951Ui-2nD (hAP) has 5 ethernet ports, with ports 2-5 being assigned
  * to LAN on the casing, and port 1 being assigned to "internet" (WAN).
  * Port 1 is connected to PHY4 (the ports are labelled in reverse physical
  * number), so the SoC can be set to connect GMAC0 to PHY4 and GMAC1 to the
  * internal switch for the LAN ports.
  * The device also has USB, PoE output and an SSR used for LED multiplexing.
+ * The 952Ui-5ac2nD (hAP ac lite) is nearly identical to the hAP, it adds a
+ * QCA9887 5GHz radio via PCI and moves 2.4GHz from WLAN0 to WLAN1.
  */
 static void __init rb952_setup(void)
 {
-       u32 flags = RBSPI_HAS_WLAN0 | RBSPI_HAS_WAN4 | RBSPI_HAS_USB |
+       u32 flags = RBSPI_HAS_WAN4 | RBSPI_HAS_USB |
                        RBSPI_HAS_SSR | RBSPI_HAS_POE;
 
        if (rbspi_platform_setup())
                return;
 
+       /* differentiate the hAP from the hAP ac lite */
+       if (strstr(mips_get_machine_name(), "952Ui-5ac2nD"))
+               flags |= RBSPI_HAS_WLAN1 | RBSPI_HAS_PCI;
+       else
+               flags |= RBSPI_HAS_WLAN0;
+
        rbspi_952_750r2_setup(flags);
 }
 
index 478a1a9c6f7a893410119dd02b186d92a99e9767..184d3a71a79d0642bd889e2d224d0a2f2b7bdfad 100644 (file)
@@ -176,7 +176,7 @@ enum ath79_mach_type {
        ATH79_MACH_RB_941,                      /* MikroTik RouterBOARD 941-2nD */
        ATH79_MACH_RB_951G,                     /* Mikrotik RouterBOARD 951G */
        ATH79_MACH_RB_951U,                     /* Mikrotik RouterBOARD 951Ui-2HnD */
-       ATH79_MACH_RB_952,                      /* MikroTik RouterBOARD 951Ui-2nD */
+       ATH79_MACH_RB_952,                      /* MikroTik RouterBOARD 951Ui-2nD / 952Ui-5ac2nD */
        ATH79_MACH_RB_CAP,                      /* Mikrotik RouterBOARD cAP2nD */
        ATH79_MACH_RB_LHG5,                     /* Mikrotik RouterBOARD LHG5 */
        ATH79_MACH_RB_MAP,                      /* Mikrotik RouterBOARD mAP2nD */
index f41fd34c8ce3f1efc963e2ab2569af4fa50631f3..9b33885e9c15cc94bf88266941f155b7fa99751a 100644 (file)
@@ -31,9 +31,15 @@ define Device/rb-nor-flash-16M
   LOADER_TYPE := elf
   KERNEL_INSTALL := 1
   KERNEL := kernel-bin | lzma | loader-kernel
-  SUPPORTED_DEVICES := rb-750-r2 rb-750up-r2 rb-941-2nd rb-951ui-2nd rb-lhg-5nd rb-mapl-2nd
+  SUPPORTED_DEVICES := rb-750-r2 rb-750up-r2 rb-941-2nd rb-951ui-2nd rb-952ui-5ac2nd rb-lhg-5nd rb-mapl-2nd
   IMAGE/sysupgrade.bin = append-kernel | kernel2minor -s 1024 -e | pad-to $$$$(BLOCKSIZE) | \
        append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
 endef
 
-TARGET_DEVICES += rb-nor-flash-16M
+define Device/rb-nor-flash-16M-ac
+  $(Device/rb-nor-flash-16M)
+  DEVICE_TITLE := MikroTik RouterBoard with 16 MB SPI NOR flash and ac
+  DEVICE_PACKAGES += kmod-ath10k ath10k-firmware-qca988x ath10k-firmware-qca9887
+endef
+
+TARGET_DEVICES += rb-nor-flash-16M rb-nor-flash-16M-ac