Adding support for MikroTik RouterBOARD 711G 5HnD

I'm trying to port OpenWrt to a RouterBOARD 711G 5HnD.
I have never ported any device before. I found some instructions in the wiki that helped me compile OpenWrt and boot the initramfs image over the network using MikroTik's Etherboot mode. I then managed to make the NAND flash chip, wifi and ethernet work. I'm using the deprecated ar71xx target since that's what the instructions in the wiki suggested and I couldn't even get an image for the ath79 target booting after several hours of trying.
Everything works as expected if I Etherboot the image but if I use sysupgrade to flash the image and boot off of the flash chip, ethernet stops working correctly.
Here is the output of ip a if I boot off of the network:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br-lan state UP qlen 1000
    link/ether d4:ca:6d:42:ad:4b brd ff:ff:ff:ff:ff:ff
4: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether d4:ca:6d:42:ad:4b brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.149/24 brd 192.168.2.255 scope global br-lan
       valid_lft forever preferred_lft forever
    inet6 fe80::d6ca:6dff:fe42:ad4b/64 scope link 
       valid_lft forever preferred_lft forever
5: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000
    link/ether d4:ca:6d:42:ad:4a brd ff:ff:ff:ff:ff:ff
    inet6 fe80::d6ca:6dff:fe42:ad4a/64 scope link 
       valid_lft forever preferred_lft forever

Here is the output of ip a if I boot off the NAND flash chip:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br-lan state UP qlen 1000
    link/ether d4:ca:6d:42:ad:4b brd ff:ff:ff:ff:ff:ff
4: br-lan: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP qlen 1000
    link/ether d4:ca:6d:42:ad:4b brd ff:ff:ff:ff:ff:ff
    inet6 fe80::d6ca:6dff:fe42:ad4b/64 scope link 
       valid_lft forever preferred_lft forever
5: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master br-lan state UP qlen 1000
    link/ether d4:ca:6d:42:ad:4a brd ff:ff:ff:ff:ff:ff
    inet6 fe80::d6ca:6dff:fe42:ad4a/64 scope link 
       valid_lft forever preferred_lft forever

As you can see, br-lan has no IPv4 address. However, the ethernet port still seems to work somewhat as the DHCP server logs show DHCPDISCOVER messages every couple seconds (slightly random intervals). The ethernet indicator LED on the RouterBOARD and the LED on the switch it's attached to blink when that happens. If I configure OpenWrt to act as a DHCP server, as is the default, then attached devices won't get an IP address assigned.
I have no idea why this happens as I'm booting basically the same image both times, only once via ethernet and once via the onboard storage.

Has anyone seen this behaviour before or knows what could be going on? I have tried everything I could think of for multiple days now and am getting desperate.

I'm happy to provide any additional information that may be useful for debugging this.

I still haven't managed to boot from flash but my best theory as to why this is happening is that the AR8021 Gigabit Ethernet PHY chip is initialised by the boot loader when booting from the network but not when booting from flash and the kernel is not initialising it properly. With the help of AR8021 phy not working in gigabit mode; how to configure pll-data cells? I tried to extract the pll-data after booting from the network and then applying it on boot from flash but ultimately I couldn't get it to work. Maybe I just did something wrong so the pll-data wasn't set correctly or some other configuration for the chip is missing.

Which SoC is in this device? I could not find any information on this board, but e.g. on AR72xx I couldn't make Gigabit Ethernet work either.

But if it works when initialised by the bootloader, it's probably not an issue with GMAC PLL settings, since these registers are overwitten whenever a new link speed is detected.
Does 100BASE-T work when it is enforced by the link partner?

Are you still using ar71xx? Consider that this target has been removed by now, what were the issues you encountered when building for ath79?

It's an Atheros AR7242.

I think I tested this and it still didn't work when I forced 100BASE-T using a managed switch. But I'm not 100% sure anymore, it's been a couple months. The router is currently in operation on my roof, so testing it again would be inconvenient.

Yes. I'm also still using some 19.07 version of OpenWrt that was the latest at the time.

Yes, I know and it would be great to run the latest version (and is mandatory for getting support for this router into OpenWrt) but I couldn't get it to work. Building for the ar71xx target was relatively easy. I found this wonderful wiki page, which contains a patch. I then adapted the patch slightly to make it apply on the latest 19.07 OpenWrt release and compiled it. Booting the resulting image over the network worked on the first try I think and I could see some boot messages on the serial port. Then I could slowly make features like networking and access to the NAND flash chip work with the help of the serial port. But when I tried building and booting an image for ath79 using the latest OpenWrt master at the time, the bootloader wouldn't accept the image and simply reboot. The same behaviour happens when the image is too large, so I removed packages until the image was much smaller than an image that I knew would boot, without success. I tried various things I can't remember now and the pll thing but nothing worked. I never got any output on the serial port. Unfortunately the bootloader is completely silent on the serial port, so I couldn't see what was going on, which made it impossible for me to debug this.

I have a MikroTik RouterBOARD 711 5HnD (so without the G) on the other side of the wireless link which is much easier to access (not on a roof). The main difference between the two is that the one without the G only has 100MBit Ethernet using a single port of the switch built into the AR7241 SOC. Booting from flash totally works on that device. But for trying to port the it to ath79, this router should be equally good. So if you have any ideas on what else I could try to make ath79 work, I'd be very interested in hearing them.

This sounds a lot easier to support for a beginning, when the internal switch can be used. Actually, from my experience, even ath9k wifi is much simpler to get working than ethernet, so for new devices with complicated ethernet configurations, I usually have wifi enabled by default.
This can be done using a uci script with fixed values for ESSID and PSK. Here is an example I used for DAP-1320 (50_wifi_defaults.sh, even reading both values from the flash) :

Most important thing would be to find the flash layout, but in this case it seems to be available and verified (regarding the position of art) already from ar71xx.

Since AR7241 has no built-in wifi, the pcie node in the dts needs be enabled (status="okay"); I'm not quite sure whether the wifi node is also needed to include the ath9k driver in the image, but it should look something like this, the VID of the device (002e) might be different for the 5GHz radio though:

&pcie {
	status = "okay";

	ath9k: wifi@0,0 {
		compatible = "pci168c,002e";
		reg = <0x0000 0 0 0 0>;
		#gpio-cells = <2>;
		gpio-controller;
		qca,no-eeprom;
	};
};

If there is a valid MAC address at 0x1002 in art, it should be found and used automatically... otherwise, this can be fixed later, first of all access to the device should be possible :wink:
Most of the ethernet configuration should be handled automatically in ath79, but let me know when you encounter any troubles.

Ok, so I took town the wireless link and tried to make the RouterBOARD 711 5HnD boot the latest OpenWrt master again. I created the following patch:

diff --git a/target/linux/ath79/dts/ar7241_mikrotik_routerboard-711-5hnd.dts b/target/linux/ath79/dts/ar7241_mikrotik_routerboard-711-5hnd.dts
new file mode 100644
index 0000000000..7a2a7de671
--- /dev/null
+++ b/target/linux/ath79/dts/ar7241_mikrotik_routerboard-711-5hnd.dts
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar7241.dtsi"
+
+/ {
+	compatible = "mikrotik,routerboard-711-5hnd", "qca,ar7241";
+	model = "MikroTik RouterBOARD 711 5HnD";
+
+	chosen {
+		bootargs = "earlycon=ns16550a,mmio,0x18020000 console=ttyS0,115200 earlyprintk";
+	};
+};
diff --git a/target/linux/ath79/image/mikrotik.mk b/target/linux/ath79/image/mikrotik.mk
index 2324ecc195..94f40d65b1 100644
--- a/target/linux/ath79/image/mikrotik.mk
+++ b/target/linux/ath79/image/mikrotik.mk
@@ -1,5 +1,21 @@
 include ./common-mikrotik.mk
 
+define Device/mikrotik_routerboard-711-5hnd
+  $(Device/mikrotik_nand)
+  SOC := ar7241
+  DEVICE_MODEL := RouterBOARD 711 5HnD
+  SUPPORTED_DEVICES += rb-711-5hnd
+endef
+TARGET_DEVICES += mikrotik_routerboard-711-5hnd
+
 define Device/mikrotik_routerboard-493g
   $(Device/mikrotik_nand)
   SOC := ar7161
diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network
index 4058742133..a2e0ccf61c 100644
--- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network
@@ -14,6 +14,8 @@ ath79_setup_interfaces()
 		ucidef_add_switch "switch1" \
 			"0@eth1" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
 		;;
+	mikrotik,routerboard-711-5hnd|\
 	mikrotik,routerboard-912uag-2hpnd|\
 	mikrotik,routerboard-lhg-2nd|\
 	mikrotik,routerboard-sxt-5nd-r2|\
@@ -36,6 +38,8 @@ ath79_setup_macs()
 	local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)"
 
 	case "$board" in
+	mikrotik,routerboard-711-5hnd|\
 	mikrotik,routerboard-912uag-2hpnd|\
 	mikrotik,routerboard-lhg-2nd|\
 	mikrotik,routerboard-sxt-5nd-r2|\
diff --git a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
index 6962c6fdcc..d08ef6b7ef 100644
--- a/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/mikrotik/base-files/lib/upgrade/platform.sh
@@ -31,6 +31,8 @@ platform_do_upgrade() {
 	local board=$(board_name)
 
 	case "$board" in
+	mikrotik,routerboard-711-5hnd|\
 	mikrotik,routerboard-493g|\
 	mikrotik,routerboard-912uag-2hpnd|\
 	mikrotik,routerboard-921gs-5hpacd-15s|\

I executed make menuconfig and removed all the packages to make the resulting image as small as possible. As the first step, I only want to boot the kernel and don't care about userspace at all. The device tree is deliberately minimal, not containing anything related to wifi, ethernet, flash, etc. as this doesn't help me get over this first hurdle.
Unfortunately the bootloader doesn't seem to accept the image I built, as the router reboots just after downloading the image via the network. This is the same behaviour as when trying to boot an image that is too large. Since the bootloader is completely silent on the serial port, this makes it extremely difficult to debug what the heck is going on. When I first tried this a couple months ago, I even tried to flash the image to NAND from a running instance of OpenWrt 19.x, which also didn't work, so I don't think booting over ethernet is the problem here.
While the tips you gave me may prove very helpful in the future, they unfortunately don't help me at all with this first hurdle.

Should I try to replace the vendor bootloader with u-boot?
I'm just a little scared of bricking the board. I read that there is a way to recover it and the board has an SPI flash chip that presumably holds the backup bootloader, but still.
I've never compiled u-boot before. Any tipps for what I need to watch out for and what I need to adjust in u-boot to hopefully be compatible with the board?

Does anyone still have the original patch?
Since the rb711-openwrt.patch linked on the OpenWRT wiki is gone.

I have a old image (18.06) that works for my usecase, but it missing a lot of things, including working opkg and the abililty to be flashed, forcing me to constantly boot the device from tftp and use a script to set the settings.

Are you talking about the RouterBOARD 711G 5HnD or the RouterBOARD 711 5HnD? I only managed to flash the non-G variant, I'm still booting the other version over the network to this day.
Here is the original rb711-openwrt.patch:

From 7f38b7a2798d27d3268f1011f98eb4c47676a152 Mon Sep 17 00:00:00 2001
From: Jonas Heinrich <onny@project-insanity.org>
Date: Fri, 22 Jan 2016 19:50:51 +0000
Subject: [PATCH] =?UTF-8?q?meine=20=C3=A4nderungen?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 target/linux/ar71xx/base-files/lib/ar71xx.sh       |   6 ++
 .../ar71xx/files/arch/mips/ath79/mach-rb750.c      | 104 +++++++++++++++++++++
 .../linux/ar71xx/files/arch/mips/ath79/machtypes.h |   5 +
 3 files changed, 115 insertions(+)

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 34d5741..0644ed3 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -704,6 +704,12 @@ ar71xx_board_detect() {
 	*"RouterBOARD 951Ui-2HnD")
 		name="rb-951ui-2hnd"
 		;;
+	*"RouterBOARD 711")
+	*"RouterBOARD 711G")
+	*"RouterBOARD 711GT")
+	*"RouterBOARD 711Gr100")
+		name="rb-711"
+		;;
 	*"RouterBOARD 2011L")
 		name="rb-2011l"
 		;;
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
index 5656d3c..e295a64 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
@@ -344,3 +344,107 @@ static void __init rb751g_setup(void)
 
 MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G",
 	     rb751g_setup);
+
+static void __init rb711_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				     AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				     AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				     AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				     AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(0);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711, "711", "MikroTik RouterBOARD 711",
+	     rb711_setup);
+
+static void __init rb711r3_setup(void)
+{rb711_setup(); return;
+	ath79_register_mdio(0, 0x0);
+	mdiobus_register_board_info(rb750g3_mdio_info,
+				    ARRAY_SIZE(rb750g3_mdio_info));
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB7XX_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711_R3, "711r3", "MikroTik RouterBOARD 711",
+	     rb711r3_setup);
+
+static void __init rb711g_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				     AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				     AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				     AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				     AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(0);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711G, "711G", "MikroTik RouterBOARD 711G",
+	     rb711g_setup);
+
+MIPS_MACHINE(ATH79_MACH_RB_711GT, "711GT", "MikroTik RouterBOARD 711GT",
+	     rb711g_setup);
+
+static void __init rb711gr100_setup(void)
+{
+	ath79_register_mdio(0, 0x0);
+	mdiobus_register_board_info(rb750g3_mdio_info,
+				    ARRAY_SIZE(rb750g3_mdio_info));
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+	ath79_eth0_data.phy_mask = BIT(0);
+
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB7XX_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711GR100, "711Gr100", "MikroTik RouterBOARD 711Gr100",
+	     rb711gr100_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index a170e8d..1fe3e02 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -128,6 +128,10 @@ enum ath79_mach_type {
 	ATH79_MACH_RB_493,		/* Mikrotik RouterBOARD 493/493AH */
 	ATH79_MACH_RB_493G,		/* Mikrotik RouterBOARD 493G */
 	ATH79_MACH_RB_711GR100,		/* Mikrotik RouterBOARD 911/912 boards */
+	ATH79_MACH_RB_711,		/* MikroTik RouterBOARD 711 */
+	ATH79_MACH_RB_711_R3,		/* MikroTik RouterBOARD 711 */
+	ATH79_MACH_RB_711G,		/* MikroTik RouterBOARD 711G */
+	ATH79_MACH_RB_711GT,		/* MikroTik RouterBOARD 711GT */
 	ATH79_MACH_RB_750,		/* MikroTik RouterBOARD 750 */
 	ATH79_MACH_RB_750G_R3,		/* MikroTik RouterBOARD 750GL */
 	ATH79_MACH_RB_751,		/* MikroTik RouterBOARD 751 */
-- 
2.7.0

I also dug out my modified OpenWrt version and created a new patch for you:

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 14b661cfd7..7fe1e1b513 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -454,6 +454,14 @@ mikrotik_board_detect() {
 	*"750")
 		name="rb-750"
 		;;
+	*"711"|\
+	*"711HnD"|\
+	*"711GHnD"|\
+	*"711G"|\
+	*"711GT"|\
+	*"711Gr100")
+		name="rb-711"
+		;;
 	*"750 r2"|\
 	*"750r2")
 		name="rb-750-r2"
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index f44cdb061f..4d51955c2a 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -548,6 +548,8 @@ platform_check_image() {
 	rb-450g|\
 	rb-493|\
 	rb-493g|\
+	rb-711-5hnd|\
+	rb-711g-5hnd|\
 	rb-750|\
 	rb-750gl|\
 	rb-751|\
@@ -868,6 +870,8 @@ platform_do_upgrade() {
 	rb-450g|\
 	rb-493|\
 	rb-493g|\
+	rb-711-5hnd|\
+	rb-711g-5hnd|\
 	rb-750|\
 	rb-750gl|\
 	rb-751|\
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
index 0ec94a80e3..77c73564bd 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
@@ -347,3 +347,179 @@ static void __init rb751g_setup(void)
 
 MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G",
 	    rb751g_setup);
+
+static void __init rb711_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(0);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711, "711", "MikroTik RouterBOARD 711",
+	    rb711_setup);
+
+static void __init rb711hnd_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(1);
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB750_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711HnD, "711HnD", "MikroTik RouterBOARD 711 5HnD",
+	    rb711hnd_setup);
+
+static void __init rb711ghnd_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_register_mdio(0, 0x0);
+	mdiobus_register_board_info(rb750g3_mdio_info,
+				   ARRAY_SIZE(rb750g3_mdio_info));
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+	ath79_eth0_data.phy_mask = BIT(0);
+	//ath79_eth0_data.mii_bus_dev = &ath79_mdio0_device.dev;
+	ath79_eth0_pll_data.pll_1000 = 0x16000000;
+
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB750_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711GHnD, "711GHnD", "MikroTik RouterBOARD 711G 5HnD",
+	    rb711ghnd_setup);
+
+static void __init rb711r3_setup(void)
+{rb711_setup(); return;
+	ath79_register_mdio(0, 0x0);
+	mdiobus_register_board_info(rb750g3_mdio_info,
+				   ARRAY_SIZE(rb750g3_mdio_info));
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB7XX_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711_R3, "711r3", "MikroTik RouterBOARD 711",
+	    rb711r3_setup);
+
+static void __init rb711g_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(0);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711G, "711G", "MikroTik RouterBOARD 711G",
+	    rb711g_setup);
+
+MIPS_MACHINE(ATH79_MACH_RB_711GT, "711GT", "MikroTik RouterBOARD 711GT",
+	    rb711g_setup);
+
+static void __init rb711gr100_setup(void)
+{
+	ath79_register_mdio(0, 0x0);
+	mdiobus_register_board_info(rb750g3_mdio_info,
+				   ARRAY_SIZE(rb750g3_mdio_info));
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+	ath79_eth0_data.phy_mask = BIT(0);
+
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB7XX_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711GR100, "711Gr100", "MikroTik RouterBOARD 711Gr100",
+	    rb711gr100_setup);
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index eb2f362034..bfd61003b4 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -77,3 +77,5 @@ CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_ZLIB_DEFLATE=y
 CONFIG_ZLIB_INFLATE=y
+CONFIG_CMDLINE="console=ttyS0,115200 GPIO_RESET=yes gpio=790341 HZ=400000000 mem=32M kmac=d4:ca:6d:12:34:56 board=711HnD ubi.mtd=ubi root=/dev/ubiblock0_1 rootfstype=squashfs noinitrd"
+CONFIG_CMDLINE_OVERRIDE=y

Apply it on top of the openwrt-19.07 branch. This patch should work for the non-G version. For the other one, add a G to CONFIG_CMDLINE in the right place. Only the non-G version works properly when flashed with this, the other version needs to be booted over the network. Let me know if you have trouble getting this working and I'll try to help you.

If you ever try to port this to ath79, let me know so we can work on this together.

1 Like

Thank you. I just confirmed and yeah, I have the RouterBOARD 711G 5HnD version.
I remember editing the patch to make the NAND work, but I'll check it out later.
Thank you again.

1 Like

I cleaned up the patch a bit, didn't really add anything. Should apply cleanly to the latest 19.07 branch.
I did notice that the setup 750Gr3 doesn't include the USB, despite having USB and being officially supported by OpenWRT.

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 14b661cfd7..35a8aaa9d7 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -451,6 +451,14 @@ mikrotik_board_detect() {
 	*"493G")
 		name="rb-493g"
 		;;
+	*"711"|\
+	*"711HnD"|\
+	*"711GHnD"|\
+	*"711G"|\
+	*"711GT"|\
+	*"711Gr100")
+		name="rb-711"
+		;;
 	*"750")
 		name="rb-750"
 		;;
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index f44cdb061f..4d51955c2a 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -548,6 +548,8 @@ platform_check_image() {
 	rb-450g|\
 	rb-493|\
 	rb-493g|\
+	rb-711-5hnd|\
+	rb-711g-5hnd|\
 	rb-750|\
 	rb-750gl|\
 	rb-751|\
@@ -868,6 +870,8 @@ platform_do_upgrade() {
 	rb-450g|\
 	rb-493|\
 	rb-493g|\
+	rb-711-5hnd|\
+	rb-711g-5hnd|\
 	rb-750|\
 	rb-750gl|\
 	rb-751|\
diff --git a/target/linux/ar71xx/config-4.14 b/target/linux/ar71xx/config-4.14
index 9a524fae43..4fe24e0906 100644
--- a/target/linux/ar71xx/config-4.14
+++ b/target/linux/ar71xx/config-4.14
@@ -11,12 +11,20 @@ CONFIG_ARCH_HAS_ELF_RANDOMIZE=y
 # CONFIG_ARCH_HAS_GCOV_PROFILE_ALL is not set
 CONFIG_ARCH_HAS_RESET_CONTROLLER=y
 # CONFIG_ARCH_HAS_SG_CHAIN is not set
+# CONFIG_ARCH_HAS_STRICT_KERNEL_RWX is not set
+# CONFIG_ARCH_HAS_STRICT_MODULE_RWX is not set
 CONFIG_ARCH_HIBERNATION_POSSIBLE=y
 CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
 CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
+CONFIG_ARCH_MMAP_RND_BITS_MAX=15
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=15
+# CONFIG_ARCH_OPTIONAL_KERNEL_RWX is not set
+# CONFIG_ARCH_OPTIONAL_KERNEL_RWX_DEFAULT is not set
 CONFIG_ARCH_SUPPORTS_UPROBES=y
 CONFIG_ARCH_SUSPEND_POSSIBLE=y
 CONFIG_ARCH_USE_BUILTIN_BSWAP=y
+CONFIG_ARCH_USE_QUEUED_RWLOCKS=y
+CONFIG_ARCH_USE_QUEUED_SPINLOCKS=y
 CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
 CONFIG_AT803X_PHY=y
 CONFIG_ATH79=y
@@ -289,8 +297,8 @@ CONFIG_CLONE_BACKWARDS=y
 CONFIG_CMDLINE="rootfstype=squashfs noinitrd"
 CONFIG_CMDLINE_BOOL=y
 # CONFIG_CMDLINE_OVERRIDE is not set
-# CONFIG_COMMON_CLK_BOSTON is not set
 CONFIG_COMMON_CLK=y
+# CONFIG_COMMON_CLK_BOSTON is not set
 CONFIG_CPU_BIG_ENDIAN=y
 CONFIG_CPU_GENERIC_DUMP_TLB=y
 CONFIG_CPU_HAS_PREFETCH=y
@@ -315,8 +323,10 @@ CONFIG_FIXED_PHY=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_CPU_AUTOPROBE=y
 CONFIG_GENERIC_IO=y
 CONFIG_GENERIC_IRQ_CHIP=y
+CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK=y
 CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SCHED_CLOCK=y
@@ -331,6 +341,7 @@ CONFIG_GPIO_GENERIC=y
 CONFIG_GPIO_NXP_74HC153=y
 CONFIG_GPIO_PCF857X=y
 CONFIG_GPIO_SYSFS=y
+# CONFIG_GRO_CELLS is not set
 CONFIG_HANDLE_DOMAIN_IRQ=y
 CONFIG_HARDWARE_WATCHPOINTS=y
 CONFIG_HAS_DMA=y
@@ -338,6 +349,7 @@ CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT_MAP=y
 # CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set
 # CONFIG_HAVE_ARCH_BITREVERSE is not set
+CONFIG_HAVE_ARCH_COMPILER_H=y
 CONFIG_HAVE_ARCH_JUMP_LABEL=y
 CONFIG_HAVE_ARCH_KGDB=y
 CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
@@ -348,6 +360,7 @@ CONFIG_HAVE_CC_STACKPROTECTOR=y
 CONFIG_HAVE_CLK=y
 CONFIG_HAVE_CLK_PREPARE=y
 CONFIG_HAVE_CONTEXT_TRACKING=y
+CONFIG_HAVE_COPY_THREAD_TLS=y
 CONFIG_HAVE_C_RECORDMCOUNT=y
 CONFIG_HAVE_DEBUG_KMEMLEAK=y
 CONFIG_HAVE_DEBUG_STACKOVERFLOW=y
@@ -378,6 +391,7 @@ CONFIG_I2C_ALGOBIT=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_GPIO=y
 CONFIG_IMAGE_CMDLINE_HACK=y
+CONFIG_INITRAMFS_COMPRESSION=""
 CONFIG_INITRAMFS_ROOT_GID=0
 CONFIG_INITRAMFS_ROOT_UID=0
 CONFIG_INITRAMFS_SOURCE="../../root"
@@ -390,12 +404,15 @@ CONFIG_IRQ_WORK=y
 CONFIG_LEDS_GPIO=y
 CONFIG_MARVELL_PHY=y
 CONFIG_MDIO_BITBANG=y
-CONFIG_MDIO_BOARDINFO=y
+CONFIG_MDIO_BUS=y
+CONFIG_MDIO_DEVICE=y
 CONFIG_MDIO_GPIO=y
 CONFIG_MICREL_PHY=y
+CONFIG_MIGRATION=y
 CONFIG_MIPS=y
 CONFIG_MIPS_ASID_BITS=8
 CONFIG_MIPS_ASID_SHIFT=0
+CONFIG_MIPS_CBPF_JIT=y
 CONFIG_MIPS_CLOCK_VSYSCALL=y
 # CONFIG_MIPS_CMDLINE_BUILTIN_EXTEND is not set
 CONFIG_MIPS_CMDLINE_FROM_BOOTLOADER=y
@@ -443,6 +460,7 @@ CONFIG_PERF_USE_VMALLOC=y
 CONFIG_PGTABLE_LEVELS=2
 CONFIG_PHYLIB=y
 CONFIG_RATIONAL=y
+# CONFIG_RCU_NEED_SEGCBLIST is not set
 # CONFIG_RCU_STALL_COMMON is not set
 CONFIG_RTL8306_PHY=y
 CONFIG_RTL8366RB_PHY=y
@@ -465,6 +483,7 @@ CONFIG_SERIAL_8250_RUNTIME_UARTS=1
 CONFIG_SPI=y
 CONFIG_SPI_ATH79=y
 CONFIG_SPI_BITBANG=y
+# CONFIG_SPI_DYNAMIC is not set
 CONFIG_SPI_GPIO=y
 CONFIG_SPI_MASTER=y
 # CONFIG_SPI_RB4XX is not set
@@ -483,4 +502,6 @@ CONFIG_SYS_SUPPORTS_MIPS16=y
 CONFIG_SYS_SUPPORTS_ZBOOT=y
 CONFIG_SYS_SUPPORTS_ZBOOT_UART_PROM=y
 CONFIG_TICK_CPU_ACCOUNTING=y
+CONFIG_TINY_SRCU=y
+CONFIG_UNIX_SCM=y
 CONFIG_USB_SUPPORT=y
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
index 0ec94a80e3..75f27ca8f1 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb750.c
@@ -347,3 +347,178 @@ static void __init rb751g_setup(void)
 
 MIPS_MACHINE(ATH79_MACH_RB_751G, "751g", "MikroTik RouterBOARD 751G",
 	     rb751g_setup);
+
+static void __init rb711_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(0);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711, "711", "MikroTik RouterBOARD 711",
+	    rb711_setup);
+
+static void __init rb711hnd_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(1);
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB750_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711HnD, "711HnD", "MikroTik RouterBOARD 711 5HnD",
+	    rb711hnd_setup);
+
+static void __init rb711ghnd_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_register_mdio(0, 0x0);
+	mdiobus_register_board_info(rb750g3_mdio_info,
+				   ARRAY_SIZE(rb750g3_mdio_info));
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+	ath79_eth0_data.phy_mask = BIT(0);
+	ath79_eth0_pll_data.pll_1000 = 0x16000000;
+
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB750_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711GHnD, "711GHnD", "MikroTik RouterBOARD 711G 5HnD",
+	    rb711ghnd_setup);
+
+static void __init rb711r3_setup(void)
+{
+	ath79_register_mdio(0, 0x0);
+	mdiobus_register_board_info(rb750g3_mdio_info,
+				   ARRAY_SIZE(rb750g3_mdio_info));
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB7XX_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711_R3, "711r3", "MikroTik RouterBOARD 711",
+	    rb711r3_setup);
+
+static void __init rb711g_setup(void)
+{
+	ath79_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN |
+				    AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN);
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+
+	ath79_register_mdio(0, 0x0);
+
+	ath79_register_eth(0);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711G, "711G", "MikroTik RouterBOARD 711G",
+	    rb711g_setup);
+
+MIPS_MACHINE(ATH79_MACH_RB_711GT, "711GT", "MikroTik RouterBOARD 711GT",
+	    rb711g_setup);
+
+static void __init rb711gr100_setup(void)
+{
+	ath79_register_mdio(0, 0x0);
+	mdiobus_register_board_info(rb750g3_mdio_info,
+				   ARRAY_SIZE(rb750g3_mdio_info));
+
+	ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
+	ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
+	ath79_eth0_data.phy_mask = BIT(0);
+
+	ath79_register_eth(0);
+
+	rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
+	rb750_leds_data.leds = rb750gr3_leds;
+	rb750_leds_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_leds_device);
+
+	rb750_nand_data.nce_line = RB7XX_NAND_NCE;
+	rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins;
+	rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins;
+	rb750_nand_data.latch_change = rb750gr3_latch_change;
+	platform_device_register(&rb750_nand_device);
+
+	ath79_register_usb();
+	rb751_wlan_setup();
+}
+
+MIPS_MACHINE(ATH79_MACH_RB_711GR100, "711Gr100", "MikroTik RouterBOARD 711Gr100",
+	    rb711gr100_setup);
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
index 900b4ec87b..985ad29ea7 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
+++ b/target/linux/ar71xx/files/arch/mips/ath79/machtypes.h
@@ -211,6 +211,12 @@ enum ath79_mach_type {
 	ATH79_MACH_RB_493,			/* Mikrotik RouterBOARD 493/493AH */
 	ATH79_MACH_RB_493G,			/* Mikrotik RouterBOARD 493G */
 	ATH79_MACH_RB_711GR100,			/* Mikrotik RouterBOARD 911/912 boards */
+	ATH79_MACH_RB_711,			/* MikroTik RouterBOARD 711 */
+	ATH79_MACH_RB_711_R3,			/* MikroTik RouterBOARD 711 */
+	ATH79_MACH_RB_711G,			/* MikroTik RouterBOARD 711G */
+	ATH79_MACH_RB_711GT,			/* MikroTik RouterBOARD 711GT */
+	ATH79_MACH_RB_711HnD,			/* MikroTik RouterBOARD 711 HnD */
+	ATH79_MACH_RB_711GHnD,			/* MikroTik RouterBOARD 711G HnD */
 	ATH79_MACH_RB_750,			/* MikroTik RouterBOARD 750 */
 	ATH79_MACH_RB_750G_R3,			/* MikroTik RouterBOARD 750GL */
 	ATH79_MACH_RB_750UPR2,			/* MikroTik RouterBOARD 750UP r2 */
diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default
index eb2f362034..dfce8fefe2 100644
--- a/target/linux/ar71xx/mikrotik/config-default
+++ b/target/linux/ar71xx/mikrotik/config-default
@@ -77,3 +77,5 @@ CONFIG_UBIFS_FS_ADVANCED_COMPR=y
 CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_ZLIB_DEFLATE=y
 CONFIG_ZLIB_INFLATE=y
+CONFIG_CMDLINE="console=ttyS0,115200 GPIO_RESET=yes gpio=790341 HZ=400000000 mem=32M board=711GHnD noinitrd"
+CONFIG_CMDLINE_OVERRIDE=y

Yeah, I didn't modify the 750Gr3 or any of the other boards from the original patch as I was just trying to get my boards to work. Since I didn't manage to port this to any newer OpenWrt version, this can't be upstreamed anyways.
What does your patch improve?

My patch makes it apply cleanly to the 19.07 branch.
Since the MAC is correctly detected, the unnecessary CMDLINE parameters were also removed.

Probably not worth porting any higher, since the memory is limited.