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 <ha...@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               | 105 ++++++++++++++-------
 target/linux/ramips/image/mt7621.mk                |  15 ++-
 5 files changed, 79 insertions(+), 49 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 818a919f41..e47c3cd5c9 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 a7f9c1722e..818d854464 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -131,7 +131,6 @@ platform_check_image() {
        psr-680w|\
        px-4885-4M|\
        px-4885-8M|\
-       rb750gr3|\
        re6500|\
        rp-n53|\
        rt5350f-olinuxino|\
@@ -301,6 +300,7 @@ platform_check_image() {
                nand_do_platform_check "$board" "$1"
                return $?;
                ;;
+       mikrotik,rb750gr3|\
        mikrotik,rbm11g|\
        mikrotik,rbm33g|\
        re350-v1)
@@ -328,6 +328,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 563a537268..6a163734ad 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@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>;
                };
@@ -45,7 +46,7 @@
                mode {
                        label = "mode";
                        gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
-                       linux,code = <KEY_RFKILL>;
+                       linux,code = <BTN_0>;
                };
 
                res {
@@ -66,9 +67,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>;
                };
        };
 };
@@ -76,49 +89,69 @@
 &spi0 {
        status = "okay";
 
-       m25p80@0 {
+       w25q128@0 {
                #address-cells = <1>;
                #size-cells = <1>;
                compatible = "jedec,spi-nor";
                reg = <0>;
-               spi-max-frequency = <10000000>;
-               m25p,chunked-io = <32>;
-
-               partition@0 {
-                       label = "u-boot";
-                       reg = <0x0 0x30000>;
-                       read-only;
-               };
-
-               partition@30000 {
-                       label = "u-boot-env";
-                       reg = <0x30000 0x10000>;
-                       read-only;
-               };
-
-               factory: partition@40000 {
-                       label = "factory";
-                       reg = <0x40000 0x10000>;
-                       read-only;
+               // XXX matching RBM11/RBM33, untested
+               spi-max-frequency = <3125000>;
+
+               partitions {
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "RouterBoot";
+                               reg = <0x0 0x40000>;
+                               read-only;
+                               compatible = "fixed-partitions";
+                               #address-cells = <1>;
+                               #size-cells = <1>;
+
+                               routerboot@0 {
+                                       reg = <0x0 0xf000>;
+                                       read-only;
+                               };
+
+                               hard_config: hard_config@f000 {
+                                       reg = <0xf000 0x1000>;
+                                       read-only;
+                               };
+
+                               routerboot2@10000 {
+                                       reg = <0x10000 0xf000>;
+                                       read-only;
+                               };
+
+                               soft_config@20000 {
+                                       reg = <0x20000 0x1000>;
+                               };
+
+                               bios@30000 {
+                                       reg = <0x30000 0x1000>;
+                                       read-only;
+                               };
+                       };
+
+                       firmware@40000 {
+                               reg = <0x040000 0xFC0000>;
+                       };
                };
-
-               partition@50000 {
-                       label = "firmware";
-                       reg = <0x50000 0xfb0000>;
-               };
-
        };
 };
 
 &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 8ac78ad7de..e4e8ec3b19 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -252,14 +252,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
@@ -271,6 +263,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@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to