diff mbox series

added support for comfast jw-ew74

Message ID 20210504152820.3987371-1-eric@daloft.com
State Changes Requested
Headers show
Series added support for comfast jw-ew74 | expand

Commit Message

eric@daloft.com May 4, 2021, 3:28 p.m. UTC
From: eric <eric@daloft.com>

---
 .../ramips/dts/mt7628an_comfast_jw-ew74.dts   | 147 ++++++++++++++++++
 target/linux/ramips/image/mt76x8.mk           |   9 ++
 .../mt76x8/base-files/etc/board.d/01_leds     |   7 +
 .../mt76x8/base-files/etc/board.d/02_network  |   4 +
 4 files changed, 167 insertions(+)
 create mode 100644 target/linux/ramips/dts/mt7628an_comfast_jw-ew74.dts

Comments

Paul Spooren May 5, 2021, 2:39 p.m. UTC | #1
On 5/4/21 5:28 PM, eric@daloft.com wrote:
> From: eric <eric@daloft.com>
>
> ---

Hi Eric,

thank you very much for your contribution!

Please read the following guide, there are some formal issues with this 
patch:

https://openwrt.org/submitting-patches

Patches should always include the full and real name of the author and a 
commit message which describes the patch. Especially when adding new 
devices, the commit message should include steps to flash the device and 
a hardware overview. Please see the git log to find examples.

Kind regards,
Paul

>   .../ramips/dts/mt7628an_comfast_jw-ew74.dts   | 147 ++++++++++++++++++
>   target/linux/ramips/image/mt76x8.mk           |   9 ++
>   .../mt76x8/base-files/etc/board.d/01_leds     |   7 +
>   .../mt76x8/base-files/etc/board.d/02_network  |   4 +
>   4 files changed, 167 insertions(+)
>   create mode 100644 target/linux/ramips/dts/mt7628an_comfast_jw-ew74.dts
>
> diff --git a/target/linux/ramips/dts/mt7628an_comfast_jw-ew74.dts b/target/linux/ramips/dts/mt7628an_comfast_jw-ew74.dts
> new file mode 100644
> index 0000000000..dc6aaeb4fe
> --- /dev/null
> +++ b/target/linux/ramips/dts/mt7628an_comfast_jw-ew74.dts
> @@ -0,0 +1,147 @@
> +/dts-v1/;
> +
> +#include "mt7628an.dtsi"
> +
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
> +
> +/ {
> +	#address-cells = <0x01>;
> +	#size-cells = <0x01>;
> +	compatible = "comfast,jw-ew74\0mediatek,mt7628an-soc";
> +	model = "Comfast JW-EW74";
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200";
> +	};
> +
> +
> +
> +	gpio-keys-polled {
> +		#address-cells = <0x01>;
> +		#size-cells = <0x00>;
> +		compatible = "gpio-keys-polled";
> +		poll-interval = <0x14>;
> +
> +		reset {
> +			gpios = <&gpio 0x06 0x01>;
> +			label = "reset";
> +			linux,code = <KEY_RESTART>;
> +		};
> +	};
> +
> +	gpio-leds {
> +		compatible = "gpio-leds";
> +
> +		wifi {
> +			gpios = <&gpio 0x0c 0x01>;
> +			label = "comfast:blue:wifi";
> +		};
> +
> +		wifi0 {
> +			gpios = <&gpio 0x0b 0x01>;
> +			label = "comfast:blue:wifi0";
> +		};
> +
> +		wifi1 {
> +			gpios = <&gpio 0x05 0x01>;
> +			label = "comfast:blue:wifi1";
> +		};
> +
> +		wifi2 {
> +			gpios = <&gpio 0x0d 0x01>;
> +			label = "comfast:blue:wifi2";
> +		};
> +	};
> +
> +};
> +
> +
> +
> +
> +
> +&spi0 {
> +  	 status = "okay";
> +
> +     	 flash@0 {
> +       	         compatible = "jedec,spi-nor";
> +       	         reg = <0>;
> +       	         spi-max-frequency = <10000000>;
> +
> +		partitions {
> +       	          compatible = "fixed-partitions";
> +       	          #address-cells = <1>;
> +     	          #size-cells = <1>;
> +
> +
> +			partition@0 {
> +				label = "u-boot";
> +				read-only;
> +				reg = <0x00 0x30000>;
> +			};
> +
> +
> +			partition@30000 {
> +				label = "u-boot-env";
> +				read-only;
> +				reg = <0x30000 0x10000>;
> +			};
> +
> +			factory: partition@40000 {
> +				label = "factory";
> +				read-only;
> +				reg = <0x40000 0x10000>;
> +			};
> +
> +			partition@50000 {
> +  				compatible = "denx,uimage";
> +				label = "firmware";
> +				reg = <0x50000 0x770000>;
> +			};
> +
> +			partition@7c0000 {
> +				label = "configs";
> +				reg = <0x7c0000 0x40000>;
> +			};
> +			partition@1000000 {
> +                                        label = "reserve";
> +                                        reg = <0x1000000 0x1000000>;
> +                                };
> +
> +		};
> +	};
> +};
> +
> +&ethernet {
> +	mtd-mac-address = <&factory 0xe00 >;
> +        };
> +
> +
> +&wmac {
> +
> +       status = "okay";
> +	mtd-mac-address = <&factory 0xe00>;
> +	mtd-mac-address-increment = <1>;
> +
> +};
> +
> +
> +&pcie {
> +       status = "okay";
> +};
> +
> +
> +&pcie0 {
> +        wifi: mt76@0,0 {
> +                reg = <0x0000 0 0 0 0>;
> +		mediatek,5ghz = <0x00>;
> +                mediatek,mtd-eeprom = <&factory 0x8000>;
> +		ieee80211-freq-limit = <5000000 6000000>;
> +		mtd-mac-address = <&factory 0xe00>;
> +		mtd-mac-address-increment = <2>;
> +				
> +        };
> +};
> +&i2c 	{
> +	status = "okay";
> +};
> diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
> index d5a9684dba..35402edc3b 100644
> --- a/target/linux/ramips/image/mt76x8.mk
> +++ b/target/linux/ramips/image/mt76x8.mk
> @@ -78,6 +78,15 @@ define Device/buffalo_wcr-1166ds
>   endef
>   TARGET_DEVICES += buffalo_wcr-1166ds
>   
> +define Device/comfast_jw-ew74
> +  IMAGE_SIZE := 7798784
> +  DEVICE_VENDOR := Comfast
> +  DEVICE_MODEL := JW-EW74
> +  DEVICE_PACKAGES := kmod-mt76x2
> +  SUPPORTED_DEVICES += comfast_jw-ew74
> +endef
> +TARGET_DEVICES += comfast_jw-ew74
> +
>   define Device/cudy_wr1000
>     IMAGE_SIZE := 7872k
>     IMAGES += factory.bin
> diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
> index fdef158ea8..4fc820520a 100644
> --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
> +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
> @@ -19,6 +19,13 @@ netgear,r6120)
>   	ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0xf"
>   	ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10"
>   	;;
> +comfast,jw-ew74)
> +	ucidef_set_rssimon "wlan0" "200000" "1"
> +	ucidef_set_led_rssi "wifi-low" "wifi-low" "comfast:blue:wifi0" "wlan0" "1" "49"
> +	ucidef_set_led_rssi "wifi-med" "wifi-med" "comfast:blue:wifi1" "wlan0" "50" "84"
> +	ucidef_set_led_rssi "wifi-high" "wifi-high" "comfast:blue:wifi2" "wlan0" "85" "100"
> +	ucidef_set_led_netdev "wifi_led" "wifi" "comfast:blue:wifi" "wlan0"
> +	;;
>   cudy,wr1000)
>   	ucidef_set_led_switch "wan" "wan" "blue:wan" "switch0" "0x10"
>   	ucidef_set_led_switch "lan1" "lan1" "blue:lan1" "switch0" "0x08"
> diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
> index 5ce44d0e9b..6340a39414 100644
> --- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
> +++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
> @@ -9,6 +9,10 @@ ramips_setup_interfaces()
>   
>   	case $board in
>   	alfa-network,awusfree1|\
> +	comfast,jw-ew74)
> +        ucidef_add_switch "switch0"  \
> +                       "4:lan" "6@eth0"
> +		;;
>   	d-team,pbr-d1|\
>   	glinet,microuter-n300|\
>   	glinet,vixmini|\
diff mbox series

Patch

diff --git a/target/linux/ramips/dts/mt7628an_comfast_jw-ew74.dts b/target/linux/ramips/dts/mt7628an_comfast_jw-ew74.dts
new file mode 100644
index 0000000000..dc6aaeb4fe
--- /dev/null
+++ b/target/linux/ramips/dts/mt7628an_comfast_jw-ew74.dts
@@ -0,0 +1,147 @@ 
+/dts-v1/;
+
+#include "mt7628an.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	#address-cells = <0x01>;
+	#size-cells = <0x01>;
+	compatible = "comfast,jw-ew74\0mediatek,mt7628an-soc";
+	model = "Comfast JW-EW74";
+
+	chosen {
+		bootargs = "console=ttyS0,115200";
+	};
+
+
+
+	gpio-keys-polled {
+		#address-cells = <0x01>;
+		#size-cells = <0x00>;
+		compatible = "gpio-keys-polled";
+		poll-interval = <0x14>;
+
+		reset {
+			gpios = <&gpio 0x06 0x01>;
+			label = "reset";
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		wifi {
+			gpios = <&gpio 0x0c 0x01>;
+			label = "comfast:blue:wifi";
+		};
+
+		wifi0 {
+			gpios = <&gpio 0x0b 0x01>;
+			label = "comfast:blue:wifi0";
+		};
+
+		wifi1 {
+			gpios = <&gpio 0x05 0x01>;
+			label = "comfast:blue:wifi1";
+		};
+
+		wifi2 {
+			gpios = <&gpio 0x0d 0x01>;
+			label = "comfast:blue:wifi2";
+		};
+	};
+
+};
+
+
+
+
+
+&spi0 {
+  	 status = "okay";
+
+     	 flash@0 {
+       	         compatible = "jedec,spi-nor";
+       	         reg = <0>;
+       	         spi-max-frequency = <10000000>;
+
+		partitions {
+       	          compatible = "fixed-partitions";
+       	          #address-cells = <1>;
+     	          #size-cells = <1>;
+
+
+			partition@0 {
+				label = "u-boot";
+				read-only;
+				reg = <0x00 0x30000>;
+			};
+
+
+			partition@30000 {
+				label = "u-boot-env";
+				read-only;
+				reg = <0x30000 0x10000>;
+			};
+
+			factory: partition@40000 {
+				label = "factory";
+				read-only;
+				reg = <0x40000 0x10000>;
+			};
+
+			partition@50000 {
+  				compatible = "denx,uimage";
+				label = "firmware";
+				reg = <0x50000 0x770000>;
+			};
+
+			partition@7c0000 {
+				label = "configs";
+				reg = <0x7c0000 0x40000>;
+			};
+			partition@1000000 {
+                                        label = "reserve";
+                                        reg = <0x1000000 0x1000000>;
+                                };
+
+		};
+	};
+};
+
+&ethernet {
+	mtd-mac-address = <&factory 0xe00 >;
+        };
+
+
+&wmac {
+
+       status = "okay";
+	mtd-mac-address = <&factory 0xe00>;
+	mtd-mac-address-increment = <1>;
+
+};
+
+
+&pcie {
+       status = "okay";
+};
+
+
+&pcie0 {
+        wifi: mt76@0,0 {
+                reg = <0x0000 0 0 0 0>;
+		mediatek,5ghz = <0x00>;
+                mediatek,mtd-eeprom = <&factory 0x8000>;
+		ieee80211-freq-limit = <5000000 6000000>;
+		mtd-mac-address = <&factory 0xe00>;
+		mtd-mac-address-increment = <2>;
+				
+        };
+};
+&i2c 	{
+	status = "okay";
+};
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index d5a9684dba..35402edc3b 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -78,6 +78,15 @@  define Device/buffalo_wcr-1166ds
 endef
 TARGET_DEVICES += buffalo_wcr-1166ds
 
+define Device/comfast_jw-ew74
+  IMAGE_SIZE := 7798784
+  DEVICE_VENDOR := Comfast
+  DEVICE_MODEL := JW-EW74
+  DEVICE_PACKAGES := kmod-mt76x2
+  SUPPORTED_DEVICES += comfast_jw-ew74
+endef
+TARGET_DEVICES += comfast_jw-ew74
+
 define Device/cudy_wr1000
   IMAGE_SIZE := 7872k
   IMAGES += factory.bin
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
index fdef158ea8..4fc820520a 100644
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
@@ -19,6 +19,13 @@  netgear,r6120)
 	ucidef_set_led_switch "lan" "lan" "green:lan" "switch0" "0xf"
 	ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x10"
 	;;
+comfast,jw-ew74)
+	ucidef_set_rssimon "wlan0" "200000" "1"
+	ucidef_set_led_rssi "wifi-low" "wifi-low" "comfast:blue:wifi0" "wlan0" "1" "49"
+	ucidef_set_led_rssi "wifi-med" "wifi-med" "comfast:blue:wifi1" "wlan0" "50" "84"
+	ucidef_set_led_rssi "wifi-high" "wifi-high" "comfast:blue:wifi2" "wlan0" "85" "100"
+	ucidef_set_led_netdev "wifi_led" "wifi" "comfast:blue:wifi" "wlan0"
+	;;
 cudy,wr1000)
 	ucidef_set_led_switch "wan" "wan" "blue:wan" "switch0" "0x10"
 	ucidef_set_led_switch "lan1" "lan1" "blue:lan1" "switch0" "0x08"
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
index 5ce44d0e9b..6340a39414 100644
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/02_network
@@ -9,6 +9,10 @@  ramips_setup_interfaces()
 
 	case $board in
 	alfa-network,awusfree1|\
+	comfast,jw-ew74)
+        ucidef_add_switch "switch0"  \
+                       "4:lan" "6@eth0"
+		;;
 	d-team,pbr-d1|\
 	glinet,microuter-n300|\
 	glinet,vixmini|\