]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
mvebu: MikroTik: add support for RB5009UPr+S+IN
authorPrzemek Rudy <prudy@protonmail.com>
Mon, 23 Feb 2026 10:44:17 +0000 (11:44 +0100)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Wed, 1 Jul 2026 15:03:40 +0000 (17:03 +0200)
The MikroTik RB5009UPr+S+IN is a multigig router based on the Marvell
Armada 7040 SoC, sharing the same hardware base as the RB5009UG+S+IN
with added PoE-out support on all ethernet ports.

Specification:

- SoC             : Marvell Armada 7040 (88F7040), 4x Cortex-A72
- CPU frequency   : 350-1400 MHz
- RAM             : 1 GB
- Flash           : 16 MB SPI NOR + 1 GB NAND
- Switch          : Marvell MV88E6393X
- Ethernet        : 1x 2.5G (p1, QCA8081), 7x 1G (p2-p8), 1x SFP+ 10G
- PoE-in          : 802.3af/at on p1, 24-57V
- PoE-out         : 802.3af/at on p1-p8, 130 W total
- Power           : DC jack / 2-pin terminal / PoE-in, 24-57V
- USB             : 1x USB 3.0 type A, max 1.5 A
- LEDs/Keys (GPIO): 4x/1x
- UART            : MikroTik SPI/UART combo header (10-pin, 2.0mm pitch)
  - assignment    : GND Vcc Rx ? GND / CLK DO /CS Tx DI (top view)
  - settings      : 115200n8

Flash instruction using initramfs image:

RouterBOOT cannot boot the OpenWrt kernel directly. A U-Boot loader
(u-boot.elf) is installed as an intermediary: RouterBOOT loads
u-boot.elf, which then loads the OpenWrt initramfs image.

1. Rename the downloaded initramfs image, removing the version number,
   to: openwrt-mvebu-cortexa72-mikrotik_rb5009-initramfs-uImage.itb
2. Set up a BOOTP/TFTP server serving u-boot.elf, with the renamed
   initramfs image in the same directory
3. Power off the router, hold the reset button (front panel), power on
   and keep holding until the initramfs image has been served, then
   release
4. The router boots the initramfs image, reachable at 192.168.1.1
5. Log in via SSH, install U-Boot, wipe NAND and flash OpenWrt:

     . /lib/functions.sh
     yafut -d /dev/mtd$(find_mtd_index "YAFFS") -w -i /tmp/u-boot.elf -o kernel -T
     ubiformat /dev/mtd$(find_mtd_index "ubi") -y
     sysupgrade /tmp/openwrt-mvebu-cortexa72-mikrotik_rb5009upr-squashfs-sysupgrade.bin

Recovery:

Hold the reset button while U-Boot is booting to load the initramfs
image again. To return to RouterOS, use MikroTik Netinstall.

MAC Addresses:

MAC addresses are read from the RouterBOOT hard_config in NOR via the
macaddr_hard nvmem cell:

offset +0 p1  (2.5G, label-mac-device)
offset +1 p2
offset +2 p3
offset +3 p4
offset +4 p5
offset +5 p6
offset +6 p7
offset +7 p8
offset +8 sfp

Tested-by: Sm00shed <sm00shed@posteo.de> (RB5009UPr+S+IN, OpenWrt v25.12.4,
kernel 6.12.87, mtpoe fw 65.21)
Signed-off-by: Przemek Rudy <prudy@protonmail.com>
[carlo@common-net.org: refactor RB5009UPr+S+IN support and fix sysupgrade path]
Signed-off-by: Carlo Filippi <carlo@common-net.org>
[sm00shed@posteo.de: fix compatible indentation, remove mikrotik,rb5009, expand commit message]
Signed-off-by: Sm00shed <sm00shed@posteo.de>
Link: https://github.com/openwrt/openwrt/pull/23698
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
package/boot/uboot-mvebu/Makefile
target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network
target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh
target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dtsi
target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009upr.dts [new file with mode: 0644]
target/linux/mvebu/image/cortexa72.mk
target/linux/mvebu/patches-6.18/913-drivers_spi_add_mtpoe_device_compatible.patch [new file with mode: 0644]

index 34d9a21ee4b18253ceb225a8b54aac675cc471fb..fa9c20b8ae7fdc89df1dc5fdabf00bf2284c1b05 100644 (file)
@@ -70,7 +70,7 @@ endef
 define U-Boot/rb5009
   NAME:=MikroTik RB5009
   BUILD_SUBTARGET:=cortexa72
-  BUILD_DEVICES:=mikrotik_rb5009ug
+  BUILD_DEVICES:=mikrotik_rb5009ug mikrotik_rb5009upr
   UBOOT_CONFIG:=mvebu_rb5009
   UBOOT_IMAGE:=u-boot.elf
 endef
index b8d1a3b41b34884fae927a5917d41f64db7040bc..9d0f6d538c40841c7a82238f3c2e32211b34d732 100644 (file)
@@ -38,7 +38,8 @@ marvell,armada7040-db)
 marvell,armada8040-clearfog-gt-8k)
        ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 eth2" "eth0 eth1"
        ;;
-mikrotik,rb5009ug)
+mikrotik,rb5009ug|\
+mikrotik,rb5009upr)
        ucidef_set_interfaces_lan_wan "p2 p3 p4 p5 p6 p7 p8 sfp" "p1"
        ;;
 solidrun,clearfog-pro)
index 1c1233f8268a0c6b8db0615f0ed827cc2d0d8ff3..7db50a937964743447795943c21508aa82a1be18 100755 (executable)
@@ -83,7 +83,8 @@ platform_do_upgrade() {
        solidrun,clearfog-pro)
                legacy_sdcard_do_upgrade "$1"
                ;;
-       mikrotik,rb5009ug)
+       mikrotik,rb5009ug|\
+       mikrotik,rb5009upr)
                nand_do_upgrade "$1"
                ;;
        *)
index 18b4703189c15270c5a450a9f4b7c62b4cb0e655..bd0fccef827bb32bac0a7a7c89ca6e9491ab24bb 100644 (file)
@@ -1,17 +1,11 @@
 // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
 
-/dts-v1/;
-
 #include "armada-7040.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/leds/common.h>
 
 / {
-       model = "MikroTik RB5009";
-       compatible = "mikrotik,rb5009", "marvell,armada7040",
-                    "marvell,armada-ap806-quad", "marvell,armada-ap806";
-
        chosen {
                stdout-path = "serial0:115200n8";
        };
diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009upr.dts b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009upr.dts
new file mode 100644 (file)
index 0000000..a25c3bf
--- /dev/null
@@ -0,0 +1,40 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "armada-7040-rb5009.dtsi"
+
+/ {
+       model = "MikroTik RB5009UPr";
+       compatible = "mikrotik,rb5009upr", "marvell,armada7040",
+                    "marvell,armada-ap806-quad", "marvell,armada-ap806";
+};
+
+&cp0_gpio1 {
+       enable-poe-power {
+               gpio-hog;
+               gpios = <8 GPIO_ACTIVE_HIGH>;
+               output-high;
+               line-name = "enable PoE power";
+       };
+};
+
+&cp0_pinctrl {
+       cp0_spi1_pins: cp0-spi1-pins {
+               marvell,pins = "mpp47", "mpp48", "mpp49", "mpp50";
+               marvell,function = "spi1";
+       };
+};
+
+&cp0_spi1 {
+       status = "okay";
+
+       pinctrl-0 = <&cp0_spi1_pins>;
+       pinctrl-names = "default";
+
+       spidev@0 {
+               compatible = "mikrotik,mtpoe";
+               reg = <0>;
+               spi-max-frequency = <2000000>;
+       };
+};
index bc7ef452ab94e66418474595d38bd830067aec5c..b6042bb60f026a4a458506c3e0a3897773ff1fd9 100644 (file)
@@ -119,6 +119,13 @@ define Device/mikrotik_rb5009ug
 endef
 TARGET_DEVICES += mikrotik_rb5009ug
 
+define Device/mikrotik_rb5009upr
+  $(call Device/mikrotik_rb5009)
+  DEVICE_DTS := armada-7040-rb5009upr
+  DEVICE_MODEL := RB5009UPr+S+IN
+endef
+TARGET_DEVICES += mikrotik_rb5009upr
+
 define Device/marvell_clearfog-gt-8k
   $(call Device/Default-arm64)
   DEVICE_VENDOR := SolidRun
diff --git a/target/linux/mvebu/patches-6.18/913-drivers_spi_add_mtpoe_device_compatible.patch b/target/linux/mvebu/patches-6.18/913-drivers_spi_add_mtpoe_device_compatible.patch
new file mode 100644 (file)
index 0000000..2230986
--- /dev/null
@@ -0,0 +1,30 @@
+From 14f37a22f520f963d4fbbd0ef99c073100029ac3 Mon Sep 17 00:00:00 2001
+From: Przemek Rudy <prudy@protonmail.com>
+Date: Mon, 23 Dec 2024 17:29:32 +0100
+Subject: [PATCH] kernel: add compatible string for the mtpoe spi device
+
+Device listed in spidev allows referring it in DT.
+
+Signed-off-by: Przemek Rudy <prudy@protonmail.com>
+---
+ drivers/spi/spidev.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/spi/spidev.c
++++ b/drivers/spi/spidev.c
+@@ -695,6 +695,7 @@ static const struct spi_device_id spidev
+       { .name = /* lwn */ "bk4-spi" },
+       { .name = /* menlo */ "m53cpld" },
+       { .name = /* micron */ "spi-authenta" },
++      { .name = /* mikrotik */ "mtpoe" },
+       { .name = /* rohm */ "bh2228fv" },
+       { .name = /* rohm */ "dh2228fv" },
+       { .name = /* semtech */ "sx1301" },
+@@ -728,6 +729,7 @@ static const struct of_device_id spidev_
+       { .compatible = "lwn,bk4-spi", .data = &spidev_of_check },
+       { .compatible = "menlo,m53cpld", .data = &spidev_of_check },
+       { .compatible = "micron,spi-authenta", .data = &spidev_of_check },
++      { .compatible = "mikrotik,mtpoe", .data = &spidev_of_check },
+       { .compatible = "rohm,bh2228fv", .data = &spidev_of_check },
+       { .compatible = "rohm,dh2228fv", .data = &spidev_of_check },
+       { .compatible = "semtech,sx1301", .data = &spidev_of_check },