[OpenWrt-Devel] [PATCH] ramips: add WT3020 with 16MB flash

Dmitry Antonov dantonov at gmail.com
Fri May 6 12:02:44 EDT 2016


A little HW-mod applied to WT3020 makes it more usable.

Some people can buy it and need an updated OpenWRT.


Signed-off-by: Dmitry Antonov <dantonov at gmail.com>
---

diff --git a/openwrt_wt3020-16MB/target/linux/ramips/dts/WT3020-16M.dts
b/openwrt_wt3020-16MB/target/linux/ramips/dts/WT3020-16M.dts
new file mode 100644
index 0000000..ff13560
--- /dev/null
+++ b/openwrt_wt3020-16MB/target/linux/ramips/dts/WT3020-16M.dts
@@ -0,0 +1,102 @@
+/dts-v1/;
+
+/include/ "mt7620n.dtsi"
+
+/ {
+	compatible = "wt3020", "ralink,mt7620n-soc";
+	model = "Nexx WT3020";
+
+	palmbus at 10000000 {
+		gpio2: gpio at 660 {
+			status = "okay";
+		};
+
+		gpio3: gpio at 688 {
+			status = "okay";
+		};
+
+		spi at b00 {
+			status = "okay";
+
+			m25p80 at 0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				compatible = "jedec,spi-nor";
+				reg = <0 0>;
+				linux,modalias = "m25p80", "w25q128";
+				spi-max-frequency = <10000000>;
+
+				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>;
+					read-only;
+				};
+
+				partition at 50000 {
+					label = "firmware";
+					reg = <0x50000 0xfb0000>;
+				};
+			};
+		};
+	};
+
+	ehci at 101c0000 {
+		status = "okay";
+	};
+
+	ohci at 101c1000 {
+		status = "okay";
+	};
+
+	ethernet at 10100000 {
+		mtd-mac-address = <&factory 0x4>;
+		mediatek,portmap = "wllll";
+	};
+
+	wmac at 10180000 {
+		ralink,mtd-eeprom = <&factory 0>;
+	};
+
+	pinctrl {
+		state_default: pinctrl0 {
+			default {
+				ralink,group = "ephy", "wled", "pa", "i2c", "wdt", "uartf";
+				ralink,function = "gpio";
+			};
+		};
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 1 1>;
+			linux,code = <0x198>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		power {
+			label = "wt3020:blue:power";
+			gpios = <&gpio3 0 0>;
+		};
+	};
+};
diff --git a/openwrt/target/linux/ramips/image/Makefile
b/openwrt_wt3020-16MB/target/linux/ramips/image/Makefile
index 6e0349f..1d78c86 100644
--- a/openwrt/target/linux/ramips/image/Makefile
+++ b/openwrt_wt3020-16MB/target/linux/ramips/image/Makefile
@@ -145,24 +145,28 @@ endef
 # $(1) = squashfs/initramfs
 # $(2) = lowercase board name
 # $(3) = dts file
+# $(4) = uImage header name field
 ralink_default_fw_size_4M=3866624
 BuildFirmware/Default4M/squashfs=$(call
BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_4M),$(4))
 BuildFirmware/Default4M/initramfs=$(call
BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))

 # Build images for default ralink layout for 8MB flash
 # kernel + roots = 0x7b0000
-# $(1) = squashfs/initramfs
-# $(2) = lowercase board name
-# $(3) = dts file
-# $(4) = uImage header name field
+# parameters' descriptions the same as "... for 4MB flash"
 ralink_default_fw_size_8M=8060928
 BuildFirmware/Default8M/squashfs=$(call
BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4))
 BuildFirmware/Default8M/initramfs=$(call
BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))

-ralink_default_fw_size_16M=16121856
+# Build images for default ralink layout for 16MB flash
+# kernel + roots = 0xfb0000
+# parameters' descriptions the same as "... for 4MB flash"
+ralink_default_fw_size_16M=16449536
 BuildFirmware/Default16M/squashfs=$(call
BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_16M),$(4))
 BuildFirmware/Default16M/initramfs=$(call
BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))

+# Build images for default ralink layout for 32MB flash
+# kernel + roots = 0x1fb0000
+# parameters' descriptions the same as "... for 4MB flash"
 ralink_default_fw_size_32M=33226752
 BuildFirmware/Default32M/squashfs=$(call
BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_32M),$(4))
 BuildFirmware/Default32M/initramfs=$(call
BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
@@ -192,6 +196,18 @@ define BuildFirmware/DefaultDualSize/initramfs
 	$(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
 endef

+# wrappers for boards that have 4MB, 8MB and 16MB versions
+define BuildFirmware/DefaultThreeSize/squashfs
+	$(call BuildFirmware/Default4M/$(1),$(1),$(2)-4M,$(3)-4M)
+	$(call BuildFirmware/Default8M/$(1),$(1),$(2)-8M,$(3)-8M)
+	$(call BuildFirmware/Default16M/$(1),$(1),$(2)-16M,$(3)-16M)
+endef
+define BuildFirmware/DefaultThreeSize/initramfs
+	$(call BuildFirmware/OF/initramfs,$(1),$(2)-4M,$(3)-4M)
+	$(call BuildFirmware/OF/initramfs,$(1),$(2)-8M,$(3)-8M)
+	$(call BuildFirmware/OF/initramfs,$(1),$(2)-16M,$(3)-16M)
+endef
+
 # build Seama header images
 define BuildFirmware/Seama/squashfs
 	$(call MkImageLzmaDtb,$(2),$(3),$(5))
@@ -239,6 +255,25 @@ define BuildFirmware/PorayDualSize/squashfs
 endef
 BuildFirmware/PorayDualSize/initramfs=$(call
BuildFirmware/DefaultDualSize/initramfs,$(1),$(2),$(3))

+define BuildFirmware/PorayThreeSize/squashfs
+	$(call BuildFirmware/DefaultThreeSize/$(1),$(1),$(2),$(3))
+	if [ -e "$(call sysupname,$(1),$(2)-4M)" ]; then \
+		mkporayfw -B $(3) -F 4M \
+			-f $(call sysupname,$(1),$(2)-4M) \
+			-o $(call imgname,$(1),$(2)-4M)-factory.bin; \
+	fi
+	if [ -e "$(call sysupname,$(1),$(2)-8M)" ]; then \
+		mkporayfw -B $(3) -F 8M \
+			-f $(call sysupname,$(1),$(2)-8M) \
+			-o $(call imgname,$(1),$(2)-8M)-factory.bin; \
+	fi
+	if [ -e "$(call sysupname,$(1),$(2)-16M)" ]; then \
+		mkporayfw -B $(3) -F 16M \
+			-f $(call sysupname,$(1),$(2)-16M) \
+			-o $(call imgname,$(1),$(2)-16M)-factory.bin; \
+	fi
+endef
+BuildFirmware/PorayThreeSize/initramfs=$(call
BuildFirmware/DefaultThreeSize/initramfs,$(1),$(2),$(3))

 ifeq ($(SUBTARGET),rt288x)
 include rt288x.mk
diff --git a/openwrt/target/linux/ramips/image/mt7620.mk
b/openwrt_wt3020-16MB/target/linux/ramips/image/mt7620.mk
index 09c0ec2..539149d 100644
--- a/openwrt/target/linux/ramips/image/mt7620.mk
+++ b/openwrt_wt3020-16MB/target/linux/ramips/image/mt7620.mk
@@ -116,7 +116,7 @@ Image/Build/Profile/WMR-300=$(call
BuildFirmware/Default8M/$(1),$(1),wmr-300,WMR
 Image/Build/Profile/RT-N14U=$(call
BuildFirmware/Default8M/$(1),$(1),rt-n14u,RT-N14U)
 Image/Build/Profile/WRH-300CR=$(call
BuildFirmware/WRH-300CR/$(1),$(1),wrh-300cr,WRH-300CR)
 Image/Build/Profile/WRTNODE=$(call
BuildFirmware/Default16M/$(1),$(1),wrtnode,WRTNODE)
-Image/Build/Profile/WT3020=$(call
BuildFirmware/PorayDualSize/$(1),$(1),wt3020,WT3020)
+Image/Build/Profile/WT3020=$(call
BuildFirmware/PorayThreeSize/$(1),$(1),wt3020,WT3020)
 Image/Build/Profile/MIWIFI-MINI=$(call
BuildFirmware/Default16M/$(1),$(1),miwifi-mini,MIWIFI-MINI)
 Image/Build/Profile/GL-MT300A=$(call
BuildFirmware/Default16M/$(1),$(1),gl-mt300a,GL-MT300A)
 Image/Build/Profile/GL-MT300N=$(call
BuildFirmware/Default16M/$(1),$(1),gl-mt300n,GL-MT300N)
diff --git a/openwrt/tools/firmware-utils/src/mkporayfw.c
b/openwrt_wt3020-16MB/tools/firmware-utils/src/mkporayfw.c
index 6ec4f32..1463e03 100644
--- a/openwrt/tools/firmware-utils/src/mkporayfw.c
+++ b/openwrt_wt3020-16MB/tools/firmware-utils/src/mkporayfw.c
@@ -136,6 +136,10 @@ static struct flash_layout layouts[] = {
 		.id		= "8M",
 		.fw_max_len	= 0x7c0000,
 	}, {
+		.id		= "16M",
+		.fw_max_len	= 0xfc0000,
+	}, {
 		/* terminating entry */
 	}
 };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20160506/ff98ba56/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list