[OpenWrt-Devel] [RTF] [PATCH v2] ramips: add RB750Gr3 native support

Thibaut VARÈNE hacks at slashdirt.org
Sat Aug 4 09:50:45 EDT 2018


[Repost after rebasing on current master]

This patch attempts to support the MikroTik RouterBOARD 750Gr3 "natively",
i.e. without reflashing the bootloader.

Installation through RouterBoot probably follows the usual MikroTik method
(force tftp booting via long press on the reset button, boot openwrt
initramfs, and sysupgrade from there).

I don't own the hardware, this code is untested.

Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 .../linux/ramips/base-files/etc/board.d/02_network |  2 +-
 target/linux/ramips/base-files/lib/ramips.sh       |  3 -
 .../ramips/base-files/lib/upgrade/platform.sh      |  3 +-
 target/linux/ramips/dts/RB750Gr3.dts               | 92 +++++++++++++++-------
 target/linux/ramips/image/mt7621.mk                | 15 ++--
 5 files changed, 73 insertions(+), 42 deletions(-)

diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index 7d5f09c35c..3ec2259e01 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -201,9 +201,9 @@ ramips_setup_interfaces()
 	jhr-n805r|\
 	jhr-n825r|\
 	jhr-n926r|\
+	mikrotik,rb750gr3|\
 	mikrotik,rbm33g|\
 	mzk-wdpr|\
-	rb750gr3|\
 	rt-n14u|\
 	tplink,c20-v4|\
 	tplink,c50-v3|\
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 5741cbd2ee..2dd0388426 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -418,9 +418,6 @@ ramips_board_detect() {
 	*"R6220")
 		name="r6220"
 		;;
-	*"RB750Gr3")
-		name="rb750gr3"
-		;;
 	*"RE350 v1")
 		name="re350-v1"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index e3f8e606c2..1221500c79 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -132,7 +132,6 @@ platform_check_image() {
 	psr-680w|\
 	px-4885-4M|\
 	px-4885-8M|\
-	rb750gr3|\
 	re6500|\
 	rp-n53|\
 	rt5350f-olinuxino|\
@@ -302,6 +301,7 @@ platform_check_image() {
 		nand_do_platform_check "$board" "$1"
 		return $?;
 		;;
+	mikrotik,rb750gr3|\
 	mikrotik,rbm11g|\
 	mikrotik,rbm33g|\
 	re350-v1)
@@ -329,6 +329,7 @@ platform_pre_upgrade() {
 	local board=$(board_name)
 
 	case "$board" in
+	mikrotik,rb750gr3|\
 	mikrotik,rbm11g|\
 	mikrotik,rbm33g)
 		[ -z "$(rootfs_type)" ] && mtd erase firmware
diff --git a/target/linux/ramips/dts/RB750Gr3.dts b/target/linux/ramips/dts/RB750Gr3.dts
index 20198eb9ca..89863b68e0 100644
--- a/target/linux/ramips/dts/RB750Gr3.dts
+++ b/target/linux/ramips/dts/RB750Gr3.dts
@@ -7,10 +7,10 @@
 
 / {
 	compatible = "mikrotik,rb750gr3", "mediatek,mt7621-soc";
-	model = "MikroTik RB750Gr3";
+	model = "MikroTik RouterBOARD 750Gr3";
 
 	aliases {
-		led-status = &led_pwr;
+		led-status = &led_usr;
 	};
 
 	memory at 0 {
@@ -19,18 +19,19 @@
 	};
 
 	chosen {
-		bootargs = "console=ttyS0,57600";
+		bootargs = "console=ttyS0,115200";
 	};
 
 	gpio-leds {
 		compatible = "gpio-leds";
 
-		led_pwr: pwr {
+		pwr {
 			label = "rb750gr3:blue:pwr";
 			gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+			default-state = "on";
 		};
 
-		usr {
+		led_usr: usr {
 			label = "rb750gr3:green:usr";
 			gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
 		};
@@ -43,7 +44,7 @@
 		mode {
 			label = "mode";
 			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
-			linux,code = <KEY_RFKILL>;
+			linux,code = <BTN_0>;
 		};
 
 		res {
@@ -64,9 +65,21 @@
 		};
 
 		usb {
-			gpio-export,name = "usb";
+			gpio-export,name = "usb_power_off";
 			gpio-export,output = <1>;
-			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+		};
+
+		// Used to enable power-over-ethernet passthrough to eth4 (according to OEM source).
+		poe_out {
+			gpio-export,name = "poe_passthrough";
+			gpio-export,output = <0>;
+			gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
+		};
+
+		poe_status {
+			gpio-export,name = "poe_status";
+			gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
 		};
 	};
 };
@@ -74,11 +87,11 @@
 &spi0 {
 	status = "okay";
 
-	m25p80 at 0 {
+	w25q128 at 0 {
 		compatible = "jedec,spi-nor";
 		reg = <0>;
-		spi-max-frequency = <10000000>;
-		m25p,chunked-io = <32>;
+		// XXX matching RBM11/RBM33, untested
+		spi-max-frequency = <3125000>;
 
 		partitions {
 			compatible = "fixed-partitions";
@@ -86,40 +99,61 @@
 			#size-cells = <1>;
 
 			partition at 0 {
-				label = "u-boot";
-				reg = <0x0 0x30000>;
-				read-only;
-			};
-
-			partition at 30000 {
-				label = "u-boot-env";
-				reg = <0x30000 0x10000>;
-				read-only;
-			};
-
-			factory: partition at 40000 {
-				label = "factory";
-				reg = <0x40000 0x10000>;
+				label = "RouterBoot";
+				reg = <0x0 0x40000>;
 				read-only;
+				compatible = "fixed-partitions";
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				partition at 0 {
+					label = "bootloader1";
+					reg = <0x0 0xf000>;
+					read-only;
+				};
+
+				hard_config: partition at f000 {
+					label = "hard_config";
+					reg = <0xf000 0x1000>;
+					read-only;
+				};
+
+				partition at 10000 {
+					label = "bootloader2";
+					reg = <0x10000 0xf000>;
+					read-only;
+				};
+
+				partition at 20000 {
+					label = "soft_config";
+					reg = <0x20000 0x1000>;
+				};
+
+				partition at 30000 {
+					label = "bios";
+					reg = <0x30000 0x1000>;
+					read-only;
+				};
 			};
 
-			partition at 50000 {
+			partition at 40000 {
 				label = "firmware";
-				reg = <0x50000 0xfb0000>;
+				reg = <0x040000 0xFC0000>;
 			};
 		};
 	};
 };
 
 &ethernet {
-	mtd-mac-address = <&factory 0xe000>;
+	mtd-mac-address = <&hard_config 0x0010>;
 	mtd-mac-address-increment = <1>;
 };
 
+
 &pinctrl {
 	state_default: pinctrl0 {
 		gpio {
-			ralink,group = "i2c", "uart2", "uart3", "pcie", "rgmii2", "jtag";
+			ralink,group = "uart2", "uart3", "jtag", "wdt";
 			ralink,function = "gpio";
 		};
 	};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index b427ff4f25..c98bc35a52 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -275,14 +275,6 @@ define Device/r6220
 endef
 TARGET_DEVICES += r6220
 
-define Device/rb750gr3
-  DTS := RB750Gr3
-  IMAGE_SIZE := $(ralink_default_fw_size_16M)
-  DEVICE_TITLE := MikroTik RB750Gr3
-  DEVICE_PACKAGES := kmod-usb3 uboot-envtools
-endef
-TARGET_DEVICES += rb750gr3
-
 define Device/MikroTik
   BLOCKSIZE := 64k
   IMAGE_SIZE := 16128k
@@ -294,6 +286,13 @@ define Device/MikroTik
 	append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
 endef
 
+define Device/mikrotik_rb750gr3
+  $(Device/MikroTik)
+  DTS := RB750Gr3
+  DEVICE_TITLE := MikroTik RouterBOARD RB750Gr3
+endef
+TARGET_DEVICES += mikrotik_rb750gr3
+
 define Device/mikrotik_rbm33g
   $(Device/MikroTik)
   DTS := RBM33G
-- 
2.13.6 (Apple Git-96)


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list