ath79: support for MikroTik RouterBOARD 911G-(2,5)HPnD
authorLech Perczak <lech.perczak@gmail.com>
Sat, 18 Nov 2023 15:53:45 +0000 (16:53 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 7 Jan 2024 00:19:54 +0000 (01:19 +0100)
This is a stripped-down version of RB912UAG-(2,5)HPnD, without USB,
miniPCIe and SIM sockets.
This board has been supported in the ar71xx.

Add support based on RB912UAG board, by splitting out the common part to
.dtsi, and creating separate device tree for the stripped-down version.

Links:
* https://mikrotik.com/product/RB911G-2HPnD
* https://mikrotik.com/product/RB911G-5HPnD
* https://openwrt.org/toh/hwdata/mikrotik/mikrotik_rb911g-5hpnd

Hardware:
* SoC: Atheros AR9342,
* RAM: DDR 64MB,
* SPI NOR: 64KB,
* NAND: 128MB,
* Ethernet: x1 10/100/1000 port with passive POE in,
* Wi-Fi: 802.11 a/b/g/n (depending on band variant)
* LEDs: 5 general purpose LEDs (led1..led5), power LED, user LED,
  Ethernet phy LED,
* Button,
* Beeper.

Flashing:
* Use the RouterBOARD Reset button to enable TFTP netboot,
boot kernel and initramfs and then perform sysupgrade.
* From ar71xx OpenWrt firmware run:
  $ sysupgrade -F /tmp/<sysupgrade.bin>
For more info see: https://openwrt.org/toh/mikrotik/common.

Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts [new file with mode: 0644]
target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi [new file with mode: 0644]
target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-2hpnd.dts
target/linux/ath79/image/mikrotik.mk
target/linux/ath79/mikrotik/base-files/etc/board.d/02_network
target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh

diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g-xhpnd.dts
new file mode 100644 (file)
index 0000000..5fa44b4
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "ar9342_mikrotik_routerboard-911g.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       compatible = "mikrotik,routerboard-911g-xhpnd", "qca,ar9342";
+       model = "MikroTik RouterBOARD 911G-(2,5)HPnD";
+};
diff --git a/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-911g.dtsi
new file mode 100644 (file)
index 0000000..86b4bc3
--- /dev/null
@@ -0,0 +1,224 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "ar9344.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+       aliases {
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+       };
+
+       gpio_key: gpio_key {
+               compatible = "mikrotik,gpio-rb91x-key";
+               gpio-controller;
+               #gpio-cells = <2>;
+               gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
+       };
+
+       gpio_latch: gpio_latch {
+               compatible = "gpio-latch";
+               gpio-controller;
+               #gpio-cells = <2>;
+               gpios = <&gpio 0 GPIO_ACTIVE_HIGH>,
+                       <&gpio 1 GPIO_ACTIVE_HIGH>,
+                       <&gpio 2 GPIO_ACTIVE_HIGH>,
+                       <&gpio 3 GPIO_ACTIVE_HIGH>,
+                       <0>, /* Not connected */
+                       <&gpio 13 GPIO_ACTIVE_HIGH>,
+                       <&gpio 14 GPIO_ACTIVE_HIGH>,
+                       <&gpio_key 0 GPIO_ACTIVE_HIGH>,
+                       <&gpio 11 GPIO_ACTIVE_LOW>; /* Latch Enable */
+       };
+
+       nand_gpio {
+               compatible = "mikrotik,rb91x-nand";
+
+               gpios = <&gpio_latch 3 GPIO_ACTIVE_HIGH>, /* Read */
+                       <&gpio 4 GPIO_ACTIVE_HIGH>,       /* Ready (RDY) */
+                       <&gpio_latch 5 GPIO_ACTIVE_LOW>,  /* Chip Enable (nCE) */
+                       <&gpio_latch 6 GPIO_ACTIVE_HIGH>, /* Command Latch Enable (CLE) */
+                       <&gpio_latch 7 GPIO_ACTIVE_HIGH>, /* Address Latch Enable (ALE) */
+                       <&gpio 12 GPIO_ACTIVE_LOW>,       /* Read/Write Enable (nRW) */
+                       <&gpio_latch 8 GPIO_ACTIVE_LOW>,  /* Latch Enable (nLE) */
+                       <&gpio_key 2 GPIO_ACTIVE_HIGH>;   /* Key poll disable */
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "booter";
+                               reg = <0x0 0x0040000>;
+                               read-only;
+                       };
+
+                       partition@40000 {
+                               label = "kernel";
+                               reg = <0x0040000 0x03c0000>;
+                       };
+
+                       partition@400000 {
+                               label = "ubi";
+                               reg = <0x0400000 0x7c00000>;
+                       };
+               };
+       };
+
+       keys {
+               compatible = "gpio-keys-polled";
+               poll-interval = <20>;
+
+               button-reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&gpio_key 1 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: power {
+                       label = "green:power";
+                       gpios = <&gpio_latch 1 GPIO_ACTIVE_HIGH>;
+                       default-state = "on";
+               };
+
+               user {
+                       label = "green:user";
+                       gpios = <&gpio_latch 2 GPIO_ACTIVE_HIGH>;
+               };
+
+               led1 {
+                       label = "green:led1";
+                       gpios = <&ssr 0 GPIO_ACTIVE_HIGH>;
+               };
+
+               led2 {
+                       label = "green:led2";
+                       gpios = <&ssr 1 GPIO_ACTIVE_HIGH>;
+               };
+
+               led3 {
+                       label = "green:led3";
+                       gpios = <&ssr 2 GPIO_ACTIVE_HIGH>;
+               };
+
+               led4 {
+                       label = "green:led4";
+                       gpios = <&ssr 3 GPIO_ACTIVE_HIGH>;
+               };
+
+               led5 {
+                       label = "green:led5";
+                       gpios = <&ssr 4 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+
+               beeper {
+                       gpio-export,name = "beeper";
+                       gpio-export,output = <1>;       /* Must be 1 to avoid EMI induced clicking noise */
+                       gpios = <&ssr 5 GPIO_ACTIVE_HIGH>;
+               };
+
+               usb_power {
+                       gpio-export,name = "power-usb";
+                       gpio-export,output = <1>;
+                       gpios = <&ssr 6 GPIO_ACTIVE_HIGH>;
+               };
+
+               pcie_power {
+                       gpio-export,name = "power-pcie";
+                       gpio-export,output = <0>;
+                       gpios = <&ssr 7 GPIO_ACTIVE_HIGH>;
+               };
+       };
+};
+
+&ref {
+       clock-frequency = <40000000>;
+};
+
+&spi {
+       status = "okay";
+
+       compatible = "qca,ar7100-spi";
+
+       cs-gpios = <0>, <&gpio_latch 0 GPIO_ACTIVE_LOW>;
+
+       flash@0 {
+               compatible = "jedec,spi-nor";
+               reg = <0>;
+               spi-max-frequency = <50000000>;
+
+               partitions {
+                       compatible = "mikrotik,routerboot-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "routerboot";
+                               reg = <0x0 0x0>;
+                               read-only;
+                       };
+
+                       hard_config {
+                               read-only;
+                       };
+
+                       bios {
+                               size = <0x1000>;
+                               read-only;
+                       };
+
+                       soft_config {
+                       };
+               };
+       };
+
+       ssr: ssr@1 {
+               compatible = "fairchild,74hc595";
+               gpio-controller;
+               #gpio-cells = <2>;
+               registers-number = <1>;
+               reg = <1>;
+               spi-max-frequency = <50000000>;
+       };
+};
+
+&mdio0 {
+       status = "okay";
+
+       phy0: ethernet-phy@0 {
+               reg = <0>;
+       };
+};
+
+&eth0 {
+       status = "okay";
+
+       phy-mode = "rgmii-id";
+       phy-handle = <&phy0>;
+       pll-data = <0x02000000 0x00000101 0x00001313>;
+
+       gmac-config {
+               device = <&gmac>;
+               rgmii-gmac0 = <1>;
+               rxd-delay = <1>;
+               txd-delay = <1>;
+       };
+};
+
+&wmac {
+       status = "okay";
+       qca,no-eeprom;
+};
index b550026f071615c99dd05fcdf665d7ec32883a09..81d7284b3da1e09b4e6499413d18b7112d14022c 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-or-later
 
-#include "ar9344.dtsi"
+#include "ar9342_mikrotik_routerboard-911g.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
@@ -8,222 +8,6 @@
 / {
        compatible = "mikrotik,routerboard-912uag-2hpnd", "qca,ar9342";
        model = "MikroTik RouterBOARD 912UAG-(2,5)HPnD";
-
-       aliases {
-               led-boot = &led_power;
-               led-failsafe = &led_power;
-               led-running = &led_power;
-               led-upgrade = &led_power;
-       };
-
-       gpio_key: gpio_key {
-               compatible = "mikrotik,gpio-rb91x-key";
-               gpio-controller;
-               #gpio-cells = <2>;
-               gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
-       };
-
-       gpio_latch: gpio_latch {
-               compatible = "gpio-latch";
-               gpio-controller;
-               #gpio-cells = <2>;
-               gpios = <&gpio 0 GPIO_ACTIVE_HIGH>,
-                       <&gpio 1 GPIO_ACTIVE_HIGH>,
-                       <&gpio 2 GPIO_ACTIVE_HIGH>,
-                       <&gpio 3 GPIO_ACTIVE_HIGH>,
-                       <0>, /* Not connected */
-                       <&gpio 13 GPIO_ACTIVE_HIGH>,
-                       <&gpio 14 GPIO_ACTIVE_HIGH>,
-                       <&gpio_key 0 GPIO_ACTIVE_HIGH>,
-                       <&gpio 11 GPIO_ACTIVE_LOW>; /* Latch Enable */
-       };
-
-       nand_gpio {
-               compatible = "mikrotik,rb91x-nand";
-
-               gpios = <&gpio_latch 3 GPIO_ACTIVE_HIGH>, /* Read */
-                       <&gpio 4 GPIO_ACTIVE_HIGH>,       /* Ready (RDY) */
-                       <&gpio_latch 5 GPIO_ACTIVE_LOW>,  /* Chip Enable (nCE) */
-                       <&gpio_latch 6 GPIO_ACTIVE_HIGH>, /* Command Latch Enable (CLE) */
-                       <&gpio_latch 7 GPIO_ACTIVE_HIGH>, /* Address Latch Enable (ALE) */
-                       <&gpio 12 GPIO_ACTIVE_LOW>,       /* Read/Write Enable (nRW) */
-                       <&gpio_latch 8 GPIO_ACTIVE_LOW>,  /* Latch Enable (nLE) */
-                       <&gpio_key 2 GPIO_ACTIVE_HIGH>;   /* Key poll disable */
-
-               partitions {
-                       compatible = "fixed-partitions";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-
-                       partition@0 {
-                               label = "booter";
-                               reg = <0x0 0x0040000>;
-                               read-only;
-                       };
-
-                       partition@40000 {
-                               label = "kernel";
-                               reg = <0x0040000 0x03c0000>;
-                       };
-
-                       partition@400000 {
-                               label = "ubi";
-                               reg = <0x0400000 0x7c00000>;
-                       };
-               };
-       };
-
-       keys {
-               compatible = "gpio-keys-polled";
-               poll-interval = <20>;
-
-               button-reset {
-                       label = "reset";
-                       linux,code = <KEY_RESTART>;
-                       gpios = <&gpio_key 1 GPIO_ACTIVE_LOW>;
-               };
-       };
-
-       leds {
-               compatible = "gpio-leds";
-
-               led_power: power {
-                       label = "green:power";
-                       gpios = <&gpio_latch 1 GPIO_ACTIVE_HIGH>;
-                       default-state = "on";
-               };
-
-               user {
-                       label = "green:user";
-                       gpios = <&gpio_latch 2 GPIO_ACTIVE_HIGH>;
-               };
-
-               led1 {
-                       label = "green:led1";
-                       gpios = <&ssr 0 GPIO_ACTIVE_HIGH>;
-               };
-
-               led2 {
-                       label = "green:led2";
-                       gpios = <&ssr 1 GPIO_ACTIVE_HIGH>;
-               };
-
-               led3 {
-                       label = "green:led3";
-                       gpios = <&ssr 2 GPIO_ACTIVE_HIGH>;
-               };
-
-               led4 {
-                       label = "green:led4";
-                       gpios = <&ssr 3 GPIO_ACTIVE_HIGH>;
-               };
-
-               led5 {
-                       label = "green:led5";
-                       gpios = <&ssr 4 GPIO_ACTIVE_HIGH>;
-               };
-       };
-
-       gpio-export {
-               compatible = "gpio-export";
-
-               beeper {
-                       gpio-export,name = "beeper";
-                       gpio-export,output = <1>;       /* Must be 1 to avoid EMI induced clicking noise */
-                       gpios = <&ssr 5 GPIO_ACTIVE_HIGH>;
-               };
-
-               usb_power {
-                       gpio-export,name = "power-usb";
-                       gpio-export,output = <1>;
-                       gpios = <&ssr 6 GPIO_ACTIVE_HIGH>;
-               };
-
-               pcie_power {
-                       gpio-export,name = "power-pcie";
-                       gpio-export,output = <0>;
-                       gpios = <&ssr 7 GPIO_ACTIVE_HIGH>;
-               };
-       };
-};
-
-&ref {
-       clock-frequency = <40000000>;
-};
-
-&spi {
-       status = "okay";
-
-       compatible = "qca,ar7100-spi";
-
-       cs-gpios = <0>, <&gpio_latch 0 GPIO_ACTIVE_LOW>;
-
-       flash@0 {
-               compatible = "jedec,spi-nor";
-               reg = <0>;
-               spi-max-frequency = <50000000>;
-
-               partitions {
-                       compatible = "mikrotik,routerboot-partitions";
-                       #address-cells = <1>;
-                       #size-cells = <1>;
-
-                       partition@0 {
-                               label = "routerboot";
-                               reg = <0x0 0x0>;
-                               read-only;
-                       };
-
-                       hard_config {
-                               read-only;
-                       };
-
-                       bios {
-                               size = <0x1000>;
-                               read-only;
-                       };
-
-                       soft_config {
-                       };
-               };
-       };
-
-       ssr: ssr@1 {
-               compatible = "fairchild,74hc595";
-               gpio-controller;
-               #gpio-cells = <2>;
-               registers-number = <1>;
-               reg = <1>;
-               spi-max-frequency = <50000000>;
-       };
-};
-
-&mdio0 {
-       status = "okay";
-
-       phy0: ethernet-phy@0 {
-               reg = <0>;
-       };
-};
-
-&eth0 {
-       status = "okay";
-
-       phy-mode = "rgmii-id";
-       phy-handle = <&phy0>;
-       pll-data = <0x02000000 0x00000101 0x00001313>;
-
-       gmac-config {
-               device = <&gmac>;
-               rgmii-gmac0 = <1>;
-               rxd-delay = <1>;
-               txd-delay = <1>;
-       };
-};
-
-&wmac {
-       status = "okay";
-       qca,no-eeprom;
 };
 
 &pcie {
index fb98ccc1223db005b206557ef7b8ef307e5812a5..1bd1323f073c570c644a25fdb7f88dda3ba33698 100644 (file)
@@ -28,6 +28,16 @@ define Device/mikrotik_routerboard-911-lite
 endef
 TARGET_DEVICES += mikrotik_routerboard-911-lite
 
+define Device/mikrotik_routerboard-911g-xhpnd
+  $(Device/mikrotik_nand)
+  SOC := ar9342
+  DEVICE_MODEL := RouterBOARD 911G-2HPnD
+  DEVICE_ALT0_VENDOR := Mikrotik
+  DEVICE_ALT0_MODEL := RouterBOARD 911G-5HPnD
+  SUPPORTED_DEVICES += rb-912uag-2hpnd
+endef
+TARGET_DEVICES += mikrotik_routerboard-911g-xhpnd
+
 define Device/mikrotik_routerboard-912uag-2hpnd
   $(Device/mikrotik_nand)
   SOC := ar9342
index d45af6dbb39b4275fbf6c60c49fed46aeead0481..f13eca243bad3f722c98a3f5b27faaf00542dc6e 100644 (file)
@@ -20,6 +20,7 @@ ath79_setup_interfaces()
                        "0@eth0" "1:lan:4" "2:lan:1" "3:lan:3" "4:lan:2"
                ;;
        mikrotik,routerboard-911-lite|\
+       mikrotik,routerboard-911g-xhpnd|\
        mikrotik,routerboard-912uag-2hpnd|\
        mikrotik,routerboard-lhg-2nd|\
        mikrotik,routerboard-lhg-5nd|\
@@ -61,6 +62,7 @@ ath79_setup_macs()
 
        case "$board" in
        mikrotik,routerboard-911-lite|\
+       mikrotik,routerboard-911g-xhpnd|\
        mikrotik,routerboard-912uag-2hpnd|\
        mikrotik,routerboard-lhg-2nd|\
        mikrotik,routerboard-lhg-5nd|\
index cc05ba080bf3a60edb257caf66d0e4b0e13d5bee..e7bf17d0ec7599efa851c40c1d1e053cc65ccfb1 100644 (file)
@@ -24,6 +24,7 @@ case "$FIRMWARE" in
 "ath9k-eeprom-ahb-18100000.wmac.bin")
        case $board in
        mikrotik,routerboard-911-lite|\
+       mikrotik,routerboard-911g-xhpnd|\
        mikrotik,routerboard-912uag-2hpnd|\
        mikrotik,routerboard-lhg-2nd|\
        mikrotik,routerboard-lhg-5nd|\
index e3887bfc50d2619867e337add84db255982e2321..db0509d29018c08f66028f61f0753ea4c5593dc9 100644 (file)
@@ -30,6 +30,7 @@ platform_do_upgrade() {
 
        case "$board" in
        mikrotik,routerboard-493g|\
+       mikrotik,routerboard-911g-xhpnd|\
        mikrotik,routerboard-912uag-2hpnd|\
        mikrotik,routerboard-921gs-5hpacd-15s|\
        mikrotik,routerboard-922uags-5hpacd|\