From 7b495f5deb5be7062395b90b535d57ae43f8e880 Mon Sep 17 00:00:00 2001 From: Tim Wilkinson Date: Thu, 22 Dec 2022 21:34:43 -0800 Subject: [PATCH] Add MikroTik_RouterBOARD_912UAG-5HPnD (#575) --- .circleci/config.yml | 4 + README.md | 2 +- configs/ath79-mikrotik-nand.config | 9 + configs/ath79-mikrotik.config | 1 - files/etc/radios.json | 4 +- patches/747-mikrotik-extra-support.patch | 300 +++++++++++++++++++++++ 6 files changed, 316 insertions(+), 4 deletions(-) create mode 100755 configs/ath79-mikrotik-nand.config diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f0eb3c3..48de1e04 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -35,6 +35,10 @@ jobs: name: Build command: make MAINTARGET=ath79 SUBTARGET=mikrotik ALTTARGET=ath10k no_output_timeout: 1h + - run: + name: Build + command: make MAINTARGET=ath79 SUBTARGET=mikrotik ALTTARGET=nand + no_output_timeout: 1h - run: name: Build command: make MAINTARGET=ath79 SUBTARGET=nand diff --git a/README.md b/README.md index 13d16a6d..b34d7940 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ Mikrotik QRT5 RB911G-5HPnD-QRT | ath79 | - | 64MB | untested Mikrotik mANTBox RB911G-2HPnD | ath79 | - | 64MB | untested Mikrotik mANTBox RB911G-5HPnD | ath79 | - | 64MB | untested Mikrotik mANTBox RB912UAG-2HPnD | ath79 | mikrotik_routerboard-912uag-2hpnd | 128MB | untested -Mikrotik mANTBox RB912UAG-5HPnD | ath79 | - | 128MB | untested +Mikrotik mANTBox RB912UAG-5HPnD | ath79 | mikrotik_routerboard-912uag-5hpnd | 128MB | stable Mikrotik mANTBox RB921GS-5HPacD 15s | ath79 | mikrotik_routerboard-921gs-5hpacd-15s | 128MB | stable new Mikrotik mANTBox RB921GS-5HPacD 19s | ath79 | mikrotik_routerboard-921gs-5hpacd-19s | 128MB | stable new Mikrotik SXTsq 5HPnD | ath79 | mikrotik_routerboard-sxt-5nd | 64MB | stable diff --git a/configs/ath79-mikrotik-nand.config b/configs/ath79-mikrotik-nand.config new file mode 100755 index 00000000..1855ab7a --- /dev/null +++ b/configs/ath79-mikrotik-nand.config @@ -0,0 +1,9 @@ +CONFIG_TARGET_ath79=y +CONFIG_TARGET_ath79_mikrotik=y +CONFIG_TARGET_DEVICE_ath79_mikrotik_DEVICE_mikrotik_routerboard-912uag-2hpnd=y +CONFIG_TARGET_DEVICE_ath79_mikrotik_DEVICE_mikrotik_routerboard-912uag-5hpnd=y +# +# DEVICE_PACKAGES are not included in the initramfs, but for these devices we need +# extra packages pre-installed to successfully install sysupgrade. +# +CONFIG_PACKAGE_nand-utils=y diff --git a/configs/ath79-mikrotik.config b/configs/ath79-mikrotik.config index 8c7d1a33..fd7d78bd 100644 --- a/configs/ath79-mikrotik.config +++ b/configs/ath79-mikrotik.config @@ -1,6 +1,5 @@ CONFIG_TARGET_ath79=y CONFIG_TARGET_ath79_mikrotik=y -CONFIG_TARGET_DEVICE_ath79_mikrotik_DEVICE_mikrotik_routerboard-912uag-2hpnd=y CONFIG_TARGET_DEVICE_ath79_mikrotik_DEVICE_mikrotik_routerboard-952ui-5ac2nd=y CONFIG_TARGET_DEVICE_ath79_mikrotik_DEVICE_mikrotik_routerboard-lhg-2nd=y CONFIG_TARGET_DEVICE_ath79_mikrotik_DEVICE_mikrotik_routerboard-lhg-5nd=y diff --git a/files/etc/radios.json b/files/etc/radios.json index 41f76adc..0be0daee 100644 --- a/files/etc/radios.json +++ b/files/etc/radios.json @@ -322,8 +322,8 @@ "usechains" : true, "rfband" : "2400" }, - "Mikrotik RouterBOARD 912UAG-5HPnD" : { - "name" : "Mikrotik RouterBOARD 912UAG-5HPnD", + "MikroTik RouterBOARD 912UAG-5HPnD" : { + "name" : "MikroTik RouterBOARD 912UAG-5HPnD", "comment" : "", "supported" : "1", "maxpower" : "30", diff --git a/patches/747-mikrotik-extra-support.patch b/patches/747-mikrotik-extra-support.patch index 44823930..69381bc5 100644 --- a/patches/747-mikrotik-extra-support.patch +++ b/patches/747-mikrotik-extra-support.patch @@ -498,3 +498,303 @@ mikrotik,routerboard-922uags-5hpacd|\ mikrotik,routerboard-sxt-5nd-r2) platform_do_upgrade_mikrotik_nand "$1" + +--- /dev/null ++++ b/target/linux/ath79/dts/ar9342_mikrotik_routerboard-912uag-5hpnd.dts +@@ -0,0 +1,240 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later ++ ++#include "ar9344.dtsi" ++ ++#include ++#include ++ ++/ { ++ compatible = "mikrotik,routerboard-912uag-5hpnd", "qca,ar9342"; ++ model = "MikroTik RouterBOARD 912UAG-5HPnD"; ++ ++ 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>; ++ gpio = <&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"; ++ #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@0 { ++ label = "reset"; ++ linux,code = ; ++ 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 = <25000000>; ++}; ++ ++&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: 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"; ++ ++ phy-mask = <0>; ++ ++ phy0: ethernet-phy@0 { ++ reg = <0>; ++ }; ++}; ++ ++ð0 { ++ 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 { ++ status = "okay"; ++}; ++ ++&usb { ++ status = "okay"; ++}; ++ ++&usb_phy { ++ status = "okay"; ++}; +--- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network ++++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +@@ -15,6 +15,7 @@ + "0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3" + ;; + mikrotik,routerboard-912uag-2hpnd|\ ++ mikrotik,routerboard-912uag-5hpnd|\ + mikrotik,routerboard-lhg-2nd|\ + mikrotik,routerboard-lhg-5nd|\ + mikrotik,routerboard-mapl-2nd|\ +@@ -69,6 +70,7 @@ + + case "$board" in + mikrotik,routerboard-912uag-2hpnd|\ ++ mikrotik,routerboard-912uag-5hpnd|\ + mikrotik,routerboard-lhg-2nd|\ + mikrotik,routerboard-lhg-5nd|\ + mikrotik,routerboard-map-2nd|\ +--- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom ++++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +@@ -24,6 +24,7 @@ + "ath9k-eeprom-ahb-18100000.wmac.bin") + case $board in + mikrotik,routerboard-912uag-2hpnd|\ ++ mikrotik,routerboard-912uag-5hpnd|\ + mikrotik,routerboard-lhg-2nd|\ + mikrotik,routerboard-lhg-5nd|\ + mikrotik,routerboard-sxt-5nd|\ +--- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh ++++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh +@@ -33,6 +33,7 @@ + case "$board" in + mikrotik,routerboard-493g|\ + mikrotik,routerboard-912uag-2hpnd|\ ++ mikrotik,routerboard-912uag-5hpnd|\ + mikrotik,routerboard-921gs-5hpacd-15s|\ + mikrotik,routerboard-921gs-5hpacd-19s|\ + mikrotik,routerboard-922uags-5hpacd|\ +--- a/target/linux/ath79/image/mikrotik.mk ++++ b/target/linux/ath79/image/mikrotik.mk +@@ -18,6 +18,15 @@ + endef + TARGET_DEVICES += mikrotik_routerboard-912uag-2hpnd + ++define Device/mikrotik_routerboard-912uag-5hpnd ++ $(Device/mikrotik_nand) ++ SOC := ar9342 ++ DEVICE_MODEL := RouterBOARD 912UAG-5HPnD ++ DEVICE_PACKAGES += kmod-usb-ehci kmod-usb2 ++ SUPPORTED_DEVICES += rb-912uag-5hpnd ++endef ++TARGET_DEVICES += mikrotik_routerboard-912uag-5hpnd ++ + define Device/mikrotik_routerboard-921gs-5hpacd-15s + $(Device/mikrotik_nand) + SOC := qca9558