ar71xx: add support for RB750UPr2
authorThibaut VARENE <hacks@slashdirt.org>
Thu, 9 Feb 2017 21:50:08 +0000 (22:50 +0100)
committerFelix Fietkau <nbd@nbd.name>
Wed, 15 Feb 2017 10:28:58 +0000 (11:28 +0100)
This patch adds support for the MikroTik RouterBOARD hEX PoE lite
https://routerboard.com/RB750UPr2

Specifications:
- SoC: Qualcomm QCA9531 (650MHz)
- RAM: 64MB
- Storage: 16MB NOR SPI flash
- Ethernet: 5x100M (1 PoE in, 1 PoE out)
- USB: Type A

This ethernet router is based on the same platform as the wireless router hAP.

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
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/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

index 403715c002a7898551438b535f3a79cacd9883e9..c2129ea5f6eef3816b8295ed334ac5a054e9e136 100755 (executable)
@@ -222,6 +222,14 @@ rb-750)
        ucidef_set_led_switch "port4" "port4" "rb750:green:port4" "switch0" "0x04"
        ucidef_set_led_switch "port5" "port5" "rb750:green:port5" "switch0" "0x02"
        ;;
+rb-750up-r2)
+       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"
+       ucidef_set_led_switch "port3" "port2" "rb:green:port3" "switch0" "0x08"
+       ucidef_set_led_switch "port4" "port3" "rb:green:port4" "switch0" "0x04"
+       ucidef_set_led_switch "port5" "port5" "rb:green:port5" "switch0" "0x02"
+       ;;
 rb-941-2nd)
        ucidef_set_led_timer "user" "USR/ACT" "rb:green:user" "1000" "1000"
        ;;
index 721c01c6a4b87af2e8eb8a43dc669b488727b2db..4f7ddacaca4a5084ce216688c1e4af251668d782 100755 (executable)
@@ -136,6 +136,7 @@ ar71xx_setup_interfaces()
        om2p-hsv4|\
        pb42|\
        pb44|\
+       rb-750up-r2|\
        rb-951ui-2hnd|\
        rb-951ui-2nd|\
        routerstation|\
index e76c9be68aefdc80f3fc53fda3126b375fc106b5..4bb319c93746829f8391d0730418554cad8c3b6d 100755 (executable)
@@ -27,6 +27,7 @@ rb-912uag-2hpnd|\
 rb-912uag-5hpnd)
        ucidef_add_gpio_switch "usb_power_switch" "USB Power Switch" "52" "1"
        ;;
+rb-750up-r2|\
 rb-951ui-2nd)
        ucidef_add_gpio_switch "usb_power_switch" "USB Power Switch" "45" "1"
        ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "14"
index 5f52389c8b66b5c06701e2f1600f049d368707e6..3a75e1080c8942c1fdbdc6c4e39ef0d51f69596d 100644 (file)
@@ -293,6 +293,7 @@ get_status_led() {
        rb-750)
                status_led="rb750:green:act"
                ;;
+       rb-750up-r2|\
        rb-911g-2hpnd|\
        rb-911g-5hpacd|\
        rb-911g-5hpnd|\
index a79839864cf5a2b9da638c3e5db4a69e4a01fb0a..f4e54415ae702b5a40bb7bd49200863095ca87be 100755 (executable)
@@ -838,6 +838,9 @@ ar71xx_board_detect() {
        *"RouterBOARD 750GL")
                name="rb-750gl"
                ;;
+       *"RouterBOARD 750UP r2")
+               name="rb-750up-r2"
+               ;;
        *"RouterBOARD 751")
                name="rb-751"
                ;;
index b18e87eec7088b8545a97da5b48ec69f4e43d652..110525448394cc58660352f16813fbef142be935 100755 (executable)
@@ -343,6 +343,7 @@ platform_check_image() {
        ls-sr71|\
        pb42|\
        pb44|\
+       rb-750up-r2|\
        rb-941-2nd|\
        rb-951ui-2nd|\
        rb-mapl-2nd|\
@@ -617,6 +618,7 @@ platform_pre_upgrade() {
        local board=$(ar71xx_board_name)
 
        case "$board" in
+       rb-750up-r2|\
        rb-941-2nd|\
        rb-951ui-2nd|\
        rb-mapl-2nd)
@@ -655,6 +657,7 @@ platform_do_upgrade() {
        local board=$(ar71xx_board_name)
 
        case "$board" in
+       rb-750up-r2|\
        rb-941-2nd|\
        rb-951ui-2nd|\
        rb-mapl-2nd)
index ef22aea3485ac85e6e8ed3397eb386f32543cdcc..3f4347106face7887c29df2abfff51a357d8953f 100644 (file)
@@ -929,6 +929,7 @@ config ATH79_MACH_RBSPI
          MikroTik RouterBOARD mAP lite
          MikroTik RouterBOARD hAP lite
          MikroTik RouterBOARD hAP
+         MikroTik RouterBOARD hEX PoE lite
 
 config ATH79_MACH_RBSXTLITE
        bool "MikroTik RouterBOARD SXT Lite"
index 8f8a4f5a11dad851ca5c757258f6edee61f1cd29..81659ef5035611c3ef6fd3384668ee632a0f440a 100644 (file)
@@ -4,6 +4,7 @@
  *  - MikroTik RouterBOARD mAP L-2nD
  *  - MikroTik RouterBOARD 941L-2nD
  *  - MikroTik RouterBOARD 951Ui-2nD
+ *  - MikroTik RouterBOARD 750UP r2
  *
  *  Copyright (C) 2017 Thibaut VARENE <varenet@parisc-linux.org>
  *
@@ -45,6 +46,7 @@
 #define RBSPI_HAS_WLAN         BIT(1)
 #define RBSPI_HAS_WAN4         BIT(2)  /* has WAN port on PHY4 */
 #define RBSPI_HAS_SSR          BIT(3)  /* has an SSR on SPI bus 0 */
+#define RBSPI_HAS_POE          BIT(4)
 
 #define RB_ROUTERBOOT_OFFSET    0x0000
 #define RB_BIOS_SIZE            0x1000
@@ -418,6 +420,37 @@ static void __init rbhapl_setup(void)
                                        rbspi_gpio_keys_reset16);
 }
 
+/*
+ * The hAP, hEX lite and hEX PoE lite share the same platform
+ */
+static void __init rbspi_952_750r2_setup(u32 flags)
+{
+       if (flags & RBSPI_HAS_SSR)
+               rbspi_spi_cs_gpios[1] = RB952_GPIO_SSR_CS;
+
+       rbspi_peripherals_setup(flags);
+
+       /* GMAC1 is HW MAC + 1, WLAN MAC IS HW MAC + 5 */
+       rbspi_network_setup(flags, 1, 5);
+
+       if (flags & RBSPI_HAS_USB)
+               gpio_request_one(RB952_GPIO_USB_POWER,
+                               GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                               "USB power");
+
+       if (flags & RBSPI_HAS_POE)
+               gpio_request_one(RB952_GPIO_POE_POWER,
+                               GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
+                               "POE power");
+
+       ath79_register_leds_gpio(-1, ARRAY_SIZE(rb952_leds), rb952_leds);
+
+       /* These devices have 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);
+}
+
 /*
  * Init the hAP hardware.
  * The 951Ui-2nD (hAP) has 5 ethernet ports, with ports 2-5 being assigned
@@ -430,34 +463,31 @@ static void __init rbhapl_setup(void)
 static void __init rb952_setup(void)
 {
        u32 flags = RBSPI_HAS_WLAN | RBSPI_HAS_WAN4 | RBSPI_HAS_USB |
-                       RBSPI_HAS_SSR;
+                       RBSPI_HAS_SSR | RBSPI_HAS_POE;
 
        if (rbspi_platform_setup())
                return;
 
-       rbspi_spi_cs_gpios[1] = RB952_GPIO_SSR_CS;
-
-       rbspi_peripherals_setup(flags);
-
-       /* GMAC1 is HW MAC + 1, WLAN MAC IS HW MAC + 5 */
-       rbspi_network_setup(flags, 1, 5);
-
-       gpio_request_one(RB952_GPIO_USB_POWER,
-                       GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
-                       "USB power");
+       rbspi_952_750r2_setup(flags);
+}
 
-       gpio_request_one(RB952_GPIO_POE_POWER,
-                       GPIOF_OUT_INIT_HIGH | GPIOF_EXPORT_DIR_FIXED,
-                       "POE power");
+/*
+ * Init the hEX PoE lite hardware.
+ * The 750UP r2 (hEX PoE lite) is nearly identical to the hAP, only without
+ * WLAN.
+ */
+static void __init rb750upr2_setup(void)
+{
+       u32 flags = RBSPI_HAS_WAN4 | RBSPI_HAS_USB |
+                       RBSPI_HAS_SSR | RBSPI_HAS_POE;
 
-       ath79_register_leds_gpio(-1, ARRAY_SIZE(rb952_leds), rb952_leds);
+       if (rbspi_platform_setup())
+               return;
 
-       /* hAP 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);
+       rbspi_952_750r2_setup(flags);
 }
 
 MIPS_MACHINE_NONAME(ATH79_MACH_RB_MAPL, "map-hb", rbmapl_setup);
 MIPS_MACHINE_NONAME(ATH79_MACH_RB_941, "H951L", rbhapl_setup);
 MIPS_MACHINE_NONAME(ATH79_MACH_RB_952, "952-hb", rb952_setup);
+MIPS_MACHINE_NONAME(ATH79_MACH_RB_750UPR2, "750-hb", rb750upr2_setup);
index 2df4eda5cacd84d8e2759b5a321950318c9686f7..a8fc07a1c3effc7b686af0e6fd5d1d4dd134e042 100644 (file)
@@ -167,6 +167,7 @@ enum ath79_mach_type {
        ATH79_MACH_RB_711GR100,                 /* Mikrotik RouterBOARD 911/912 boards */
        ATH79_MACH_RB_750,                      /* MikroTik RouterBOARD 750 */
        ATH79_MACH_RB_750G_R3,                  /* MikroTik RouterBOARD 750GL */
+       ATH79_MACH_RB_750UPR2,                  /* MikroTik RouterBOARD 750UP r2 */
        ATH79_MACH_RB_751,                      /* MikroTik RouterBOARD 751 */
        ATH79_MACH_RB_751G,                     /* Mikrotik RouterBOARD 751G */
        ATH79_MACH_RB_922GS,                    /* Mikrotik RouterBOARD 911/922GS boards */