From: Przemek Rudy Date: Mon, 23 Feb 2026 10:44:17 +0000 (+0100) Subject: mvebu: MikroTik: add support for RB5009UPr+S+IN X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e6f5d04c52d97b2d4cc3973a5fa7787bcc278c2b;p=thirdparty%2Fopenwrt.git mvebu: MikroTik: add support for RB5009UPr+S+IN 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 (RB5009UPr+S+IN, OpenWrt v25.12.4, kernel 6.12.87, mtpoe fw 65.21) Signed-off-by: Przemek Rudy [carlo@common-net.org: refactor RB5009UPr+S+IN support and fix sysupgrade path] Signed-off-by: Carlo Filippi [sm00shed@posteo.de: fix compatible indentation, remove mikrotik,rb5009, expand commit message] Signed-off-by: Sm00shed Link: https://github.com/openwrt/openwrt/pull/23698 Signed-off-by: Jonas Jelonek --- diff --git a/package/boot/uboot-mvebu/Makefile b/package/boot/uboot-mvebu/Makefile index 34d9a21ee4b..fa9c20b8ae7 100644 --- a/package/boot/uboot-mvebu/Makefile +++ b/package/boot/uboot-mvebu/Makefile @@ -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 diff --git a/target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network b/target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network index b8d1a3b41b3..9d0f6d538c4 100644 --- a/target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network +++ b/target/linux/mvebu/cortexa72/base-files/etc/board.d/02_network @@ -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) diff --git a/target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh index 1c1233f8268..7db50a93796 100755 --- a/target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh +++ b/target/linux/mvebu/cortexa72/base-files/lib/upgrade/platform.sh @@ -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" ;; *) diff --git a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dtsi b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dtsi index 18b4703189c..bd0fccef827 100644 --- a/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dtsi +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009.dtsi @@ -1,17 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -/dts-v1/; - #include "armada-7040.dtsi" #include #include #include / { - 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 index 00000000000..a25c3bf27aa --- /dev/null +++ b/target/linux/mvebu/files/arch/arm64/boot/dts/marvell/armada-7040-rb5009upr.dts @@ -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>; + }; +}; diff --git a/target/linux/mvebu/image/cortexa72.mk b/target/linux/mvebu/image/cortexa72.mk index bc7ef452ab9..b6042bb60f0 100644 --- a/target/linux/mvebu/image/cortexa72.mk +++ b/target/linux/mvebu/image/cortexa72.mk @@ -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 index 00000000000..223098691a8 --- /dev/null +++ b/target/linux/mvebu/patches-6.18/913-drivers_spi_add_mtpoe_device_compatible.patch @@ -0,0 +1,30 @@ +From 14f37a22f520f963d4fbbd0ef99c073100029ac3 Mon Sep 17 00:00:00 2001 +From: Przemek Rudy +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 +--- + 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 },