[OpenWrt-Devel] [PATCH 2/2] ramips: fix RBM11G name and partitioning

Thibaut VARÈNE hacks at slashdirt.org
Thu Jul 19 13:12:33 EDT 2018


This patch improves faf64056ddd46992a75b1e277d94541c7251035c by setting
the correct partition scheme for the RouterBoot section of the flash.

This section is subdivided in several segments, as they are on ar71xx
RB devices, albeit with different offsets and sizes. The naming convention
from ar71xx has been preserved, with an overlapping "RouterBoot" top level
partition added for clarity due to the many holes.

The resulting partition scheme looks like this:
[    2.477826] Creating 7 MTD partitions on "spi0.0":
[    2.482604] 0x000000000000-0x000000040000 : "RouterBoot"
[    2.488948] 0x000000000000-0x00000000f000 : "routerboot"
[    2.495289] 0x00000000f000-0x000000010000 : "hard_config"
[    2.501596] 0x000000010000-0x00000001f000 : "routerboot2"
[    2.507966] 0x000000020000-0x000000021000 : "soft_config"
[    2.514307] 0x000000030000-0x000000031000 : "bios"
[    2.520108] 0x000000040000-0x000001000000 : "firmware"

The device name is corrected to match the hardware-stored (in hard_config)
device name.

Leave a note in DTS to mention this device supports hardware crypto.
Leave a note in DTS to explain how the original author selected the SPI speed.

Note: more work is required to get rbcfg working on this device due to
endianness.

Tested-by: Tobias Schramm <tobleminer at gmail.com>
Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 target/linux/ramips/dts/RBM11G.dts | 62 +++++++++++++++++++++++++++-----------
 1 file changed, 45 insertions(+), 17 deletions(-)

diff --git a/target/linux/ramips/dts/RBM11G.dts b/target/linux/ramips/dts/RBM11G.dts
index f312093a22..079b4fc146 100644
--- a/target/linux/ramips/dts/RBM11G.dts
+++ b/target/linux/ramips/dts/RBM11G.dts
@@ -7,7 +7,7 @@
 
 / {
 	compatible = "mikrotik,rbm11g", "mediatek,mt7621-soc";
-	model = "MikroTik RBM11G";
+	model = "MikroTik RouterBOARD M11G";
 
 	aliases {
 		led-status = &led_usr;
@@ -90,29 +90,54 @@
 		#size-cells = <1>;
 		compatible = "jedec,spi-nor";
 		reg = <0>;
+		// XXX empiric value to obtain actual 10MHz SCK at the chip
 		spi-max-frequency = <3125000>;
 
-		partition at 0 {
-			label = "routerboot";
-			reg = <0x000000 0x00F000>;
-			read-only;
-		};
-
-		factory: partition at f000 {
-			label = "factory";
-			reg = <0x00F000 0x031000>;
-			read-only;
-		};
-
-		partition at 40000 {
-			label = "firmware";
-			reg = <0x040000 0xFC0000>;
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition at 0 {
+				label = "RouterBoot";
+				reg = <0x0 0x40000>;
+				read-only;
+			};
+
+			routerboot at 0 {
+				reg = <0x0 0xf000>;
+				read-only;
+			};
+
+			hard_config: hard_config at f000 {
+				reg = <0xf000 0x1000>;
+				read-only;
+			};
+
+			routerboot2 at 10000 {
+				reg = <0x10000 0xf000>;
+				read-only;
+			};
+
+			soft_config at 20000 {
+				reg = <0x20000 0x1000>;
+			};
+
+			// valid data only extends up to 0x4f but make it 0x1000 to match ar71xx
+			bios at 30000 {
+				reg = <0x30000 0x1000>;
+				read-only;
+			};
+
+			firmware at 40000 {
+				reg = <0x040000 0xFC0000>;
+			};
 		};
 	};
 };
 
 &ethernet {
-	mtd-mac-address = <&factory 0x0010>;
+	mtd-mac-address = <&hard_config 0x0010>;
 	mtd-mac-address-increment = <1>;
 };
 
@@ -133,3 +158,6 @@
 &pcie {
 	status = "okay";
 };
+
+// XXX this device has hardware crypto
+//&crypto {};
-- 
2.14.3 (Apple Git-98)


_______________________________________________
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