ar71xx: complete support for RB wAP 2nD
authorRobert Marko <robimarko@gmail.com>
Sat, 28 Oct 2017 10:30:39 +0000 (12:30 +0200)
committerPiotr Dymacz <pepe2k@gmail.com>
Tue, 14 Nov 2017 21:36:46 +0000 (22:36 +0100)
This patch adds support for the MikroTik RouterBOARD wAP
https://mikrotik.com/product/RBwAP2nD

Specifications:

- SoC: Qualcomm QCA9533 (650 MHz)
- RAM: 64 MB
- Storage: 16 MB NOR SPI flash
- Wireless: built-in QCA9533, 2x2:2
- Ethernet: 1x100M (802.3af/at POE in)

This patch adds missing code to fully support wAP. Machfile already
contained configuration for wAP 2nD but device specific configuration
like LEDs etc. was missing.

Installation:

1. Login to the Mikrotik WebUI to backup your licence keys
2. Setup a DHCP/BOOTP server with:
   - DHCP-Option 66 (TFTP server name) pointing to a local TFTP
     server within the same subnet of the DHCP range
   - DHCP-Option 67 (Bootfile-Name) matching the initramfs filename
     of the to be booted image
3. Connect the port labeled internet to your local network
4. Keep the reset button pushed down and power on the board

The board should load and start the initramfs image from the TFTP
server. Login as root/without password to the started LEDE via SSH
listing on IPv4 address 192.168.1.1. Use sysupgrade to install LEDE.

Revert to RouterOS

Use the "rbcfg" package on in LEDE:
- rbcfg set boot_protocol bootp
- rbcfg set boot_device ethnand
- rbcfg apply

Open Netinstall and reboot routerboard. Now Netinstall sees RouterBOARD
and you can install RouterOS. If NetInstall gets stuck on Sending offer
just wait for it to timeout and then close and open Netinstall again.

Click on install again.

In order for RouterOS to function properly, you need to restore license
for the device. You can do that by including license in NetInstall.

Signed-off-by: Robert Marko <robimarko@gmail.com>
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/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/image/mikrotik.mk
target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
target/linux/ar71xx/patches-4.9/701-MIPS-ath79-add-routerboard-detection.patch

index e101d557bd96ba381fa2e6c8a180aff1d1457963..867fa9d38112c6476efbea9b66dd42b09d007e7b 100755 (executable)
@@ -325,6 +325,10 @@ rb-mapl-2nd)
        ucidef_set_led_netdev "lan" "LAN" "rb:green:eth" "eth0"
        ucidef_set_led_wlan "wlan" "WLAN" "rb:green:wlan" "phy0tpt"
        ;;
+rb-wap-2nd)
+       ucidef_set_led_timer "user" "USER" "rb:green:user" "1000" "1000"
+       ucidef_set_led_wlan "wlan" "WLAN" "rb:green:wlan" "phy0tpt"
+       ;;
 dap-2695-a1)
        ucidef_set_led_default "power" "POWER" "d-link:green:power" "1"
        ucidef_set_led_default "diag" "DIAG" "d-link:red:power" "0"
index f8060f401c3c79a4e087688ff6c7e52093991f36..5aef2058c2262006f7b54cbe4c9bb364b37c2132 100755 (executable)
@@ -101,6 +101,7 @@ ar71xx_setup_interfaces()
        rb-mapl-2nd|\
        rb-sxt2n|\
        rb-sxt5n|\
+       rb-wap-2nd|\
        re450|\
        rocket-m-xw|\
        sc300m |\
index 7c381c00f3e2ead2d486b0e6b98767acacf0995c..702ed215ca9e3b87ccd45d262f2d90e0b566ed6e 100755 (executable)
@@ -974,6 +974,9 @@ ar71xx_board_detect() {
        *"RouterBOARD SXT Lite5")
                name="rb-sxt5n"
                ;;
+       *"RouterBOARD wAP 2nD r2")
+               name="rb-wap-2nd"
+               ;;
        *"RouterStation")
                name="routerstation"
                ;;
index 210e4a29706419b55c053c21cefa0dc5bdc534e0..4639ae32cf921d5f3dc5c2c9382a09ee8bd05a29 100755 (executable)
@@ -666,7 +666,8 @@ platform_check_image() {
        rb-952ui-5ac2nd|\
        rb-962uigs-5hact2hnt|\
        rb-lhg-5nd|\
-       rb-mapl-2nd)
+       rb-mapl-2nd|\
+       rb-wap-2nd)
                return 0
                ;;
        esac
@@ -725,7 +726,8 @@ platform_pre_upgrade() {
        rb-952ui-5ac2nd|\
        rb-962uigs-5hact2hnt|\
        rb-lhg-5nd|\
-       rb-mapl-2nd)
+       rb-mapl-2nd|\
+       rb-wap-2nd)
                # erase firmware if booted from initramfs
                [ -z "$(rootfs_type)" ] && mtd erase firmware
                ;;
index 0380b09c71fe1eb7313aac6238d940a3dd4b2b15..77e523bcc43a7a417d764c34e2b86ae52ea013cc 100644 (file)
@@ -1035,7 +1035,7 @@ config ATH79_MACH_RBSPI
          MikroTik RouterBOARD LHG 5
          MikroTik RouterBOARD cAP (EXPERIMENTAL)
          MikroTik RouterBOARD mAP (EXPERIMENTAL)
-         MikroTik RouterBOARD wAP (EXPERIMENTAL)
+         MikroTik RouterBOARD wAP
 
 config ATH79_MACH_RBSXTLITE
        bool "MikroTik RouterBOARD SXT Lite"
index 1045dfc6e7d3fe9d59407d07c8bc143ab8b6d9df..2e1ecd0f5296eaa561e460a65a17e55baf44ce32 100644 (file)
@@ -10,9 +10,9 @@
  *  - MikroTik RouterBOARD 750P-PBr2
  *  - MikroTik RouterBOARD 750 r2
  *  - MikroTik RouterBOARD LHG 5nD
+ *  - MikroTik RouterBOARD wAP2nD
  *
  *  Preliminary support for the following hardware
- *  - MikroTik RouterBOARD wAP2nD
  *  - MikroTik RouterBOARD cAP2nD
  *  - MikroTik RouterBOARD mAP2nD
  *  Furthermore, the cAP lite (cAPL2nD) appears to feature the exact same
@@ -873,7 +873,7 @@ static void __init rblhg_setup(void)
 }
 
 /*
- * Init the wAP hardware (EXPERIMENTAL).
+ * Init the wAP hardware.
  * The wAP 2nD has a single ethernet port.
  */
 static void __init rbwap_setup(void)
@@ -889,6 +889,11 @@ static void __init rbwap_setup(void)
        rbspi_network_setup(flags, 0, 1, 0);
 
        ath79_register_leds_gpio(-1, ARRAY_SIZE(rbwap_leds), rbwap_leds);
+
+       /* wAP has a single reset button as GPIO 16 */
+       ath79_register_gpio_keys_polled(-1, RBSPI_KEYS_POLL_INTERVAL,
+                                       ARRAY_SIZE(rbspi_gpio_keys_reset16),
+                                       rbspi_gpio_keys_reset16);
 }
 
 /*
index 8f7d7cce988964d8bea7a632f9cc4f27f6d02f81..5ee3eee65ea9657d6556392bb44c9c5ec0c386a0 100644 (file)
@@ -30,7 +30,7 @@ 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-750p-pbr2 rb-941-2nd rb-951ui-2nd rb-952ui-5ac2nd rb-962uigs-5hact2hnt rb-lhg-5nd rb-mapl-2nd
+  SUPPORTED_DEVICES := rb-750-r2 rb-750up-r2 rb-750p-pbr2 rb-941-2nd rb-951ui-2nd rb-952ui-5ac2nd rb-962uigs-5hact2hnt rb-lhg-5nd rb-mapl-2nd rb-wap-2nd
   IMAGE/sysupgrade.bin := append-kernel | kernel2minor -s 1024 -e | pad-to $$$$(BLOCKSIZE) | \
        append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
 endef
index cd91ac3c02e11e13e210874460934ee198180af8..fc3091ec65e91d1d87e212fe885fa2f72ab39661 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/prom.c
 +++ b/arch/mips/ath79/prom.c
-@@ -136,6 +136,27 @@ void __init prom_init(void)
+@@ -136,6 +136,28 @@ void __init prom_init(void)
                initrd_end = initrd_start + fw_getenvl("initrd_size");
        }
  #endif
@@ -20,6 +20,7 @@
 +          strstr(arcs_cmdline, "board=962") ||
 +          strstr(arcs_cmdline, "board=lhg") ||
 +          strstr(arcs_cmdline, "board=map-hb") ||
++          strstr(arcs_cmdline, "board=wap-hb") ||
 +          strstr(arcs_cmdline, "board=2011L") ||
 +          strstr(arcs_cmdline, "board=2011r") ||
 +          strstr(arcs_cmdline, "board=711Gr100") ||
index cd91ac3c02e11e13e210874460934ee198180af8..fc3091ec65e91d1d87e212fe885fa2f72ab39661 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/mips/ath79/prom.c
 +++ b/arch/mips/ath79/prom.c
-@@ -136,6 +136,27 @@ void __init prom_init(void)
+@@ -136,6 +136,28 @@ void __init prom_init(void)
                initrd_end = initrd_start + fw_getenvl("initrd_size");
        }
  #endif
@@ -20,6 +20,7 @@
 +          strstr(arcs_cmdline, "board=962") ||
 +          strstr(arcs_cmdline, "board=lhg") ||
 +          strstr(arcs_cmdline, "board=map-hb") ||
++          strstr(arcs_cmdline, "board=wap-hb") ||
 +          strstr(arcs_cmdline, "board=2011L") ||
 +          strstr(arcs_cmdline, "board=2011r") ||
 +          strstr(arcs_cmdline, "board=711Gr100") ||