[OpenWrt-Devel] [RFC 2/9] wap6805: add board definition and DTS

Bjørn Mork bjorn at mork.no
Mon Oct 15 06:24:56 EDT 2018


Signed-off-by: Bjørn Mork <bjorn at mork.no>
---
 .../linux/ramips/base-files/etc/board.d/02_network |   4 +
 .../ramips/base-files/etc/board.d/03_gpio_switches |   3 +
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 .../ramips/base-files/lib/upgrade/platform.sh      |   6 +-
 target/linux/ramips/dts/WAP6805.dts                | 142 +++++++++++++++++++++
 target/linux/ramips/image/mt7621.mk                |  24 +++-
 6 files changed, 179 insertions(+), 3 deletions(-)
 create mode 100644 target/linux/ramips/dts/WAP6805.dts

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 9e9ecbcb51df..f53bf02d221f 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -404,6 +404,10 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan:2" "1:lan:1" "4:wan" "6 at eth0"
 		;;
+	wap6805)
+		ucidef_add_switch "switch0" \
+			"0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "6 at eth0"
+		;;
 	*)
 		RT3X5X=`cat /proc/cpuinfo | egrep "(RT3.5|RT5350)"`
 		if [ -n "${RT3X5X}" ]; then
diff --git a/target/linux/ramips/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
index a847a64d6bb0..9753d5d69df8 100755
--- a/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
+++ b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
@@ -17,6 +17,9 @@ ubnt-erx-sfp)
 	ucidef_add_gpio_switch "poe_power_port3" "PoE Power Port3" "499"
 	ucidef_add_gpio_switch "poe_power_port4" "PoE Power Port4" "500"
 	;;
+wap6805)
+	ucidef_add_gpio_switch "qtn_power" "Quantenna Module Power" "16"
+	;;
 esac
 
 board_config_flush
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 5741cbd2ee13..5afae99cd41e 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -718,6 +718,9 @@ ramips_board_detect() {
 	*"ZyXEL Keenetic Viva")
 		name="kng_rc"
 		;;
+	*"ZyXEL WAP6805")
+		name="wap6805"
+		;;
 	*"YK1")
 		name="youku-yk1"
 		;;
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 7558b4e3168a..238290c7ea37 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -304,7 +304,8 @@ platform_check_image() {
 	mir3g|\
 	r6220|\
 	ubnt-erx|\
-	ubnt-erx-sfp)
+	ubnt-erx-sfp|\
+	wap6805)
 		nand_do_platform_check "$board" "$1"
 		return $?;
 		;;
@@ -361,7 +362,8 @@ platform_do_upgrade() {
 	mir3g|\
 	r6220|\
 	ubnt-erx|\
-	ubnt-erx-sfp)
+	ubnt-erx-sfp|\
+	wap6805)
 		nand_do_upgrade "$ARGV"
 		;;
 	*)
diff --git a/target/linux/ramips/dts/WAP6805.dts b/target/linux/ramips/dts/WAP6805.dts
new file mode 100644
index 000000000000..53ef7301d13b
--- /dev/null
+++ b/target/linux/ramips/dts/WAP6805.dts
@@ -0,0 +1,142 @@
+/dts-v1/;
+
+#include "mt7621.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "zyxel,wap6805", "mediatek,mt7621-soc";
+	model = "ZyXEL WAP6805";
+
+	memory at 0 {
+		device_type = "memory";
+		reg = <0x0 0x4000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,57600";
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <20>;
+
+		wps {
+                        label = "wps";
+                        gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
+                        linux,code = <KEY_WPS_BUTTON>;
+                };
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+	};
+
+        aliases {
+                led-status = &led_system;
+        };
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		system_red {
+			label = "wap6805:red:system";
+			gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>;
+		};
+
+		led_system: system_green {
+			label = "wap6805:green:system";
+			gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&nand {
+	status = "okay";
+
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition at 0 {
+			label = "Bootloader";
+			reg = <0x0 0x100000>;
+			read-only;
+		};
+
+		partition at 100000 {
+			label = "MRD";
+			reg = <0x100000 0x100000>;
+			read-only;
+		};
+
+		factory: partition at 200000 {
+			label = "Factory";
+			reg = <0x200000 0x100000>;
+			read-only;
+		};
+
+		partition at 300000 {
+			label = "Config";
+			reg = <0x300000 0x100000>;
+		};
+
+		partition at 400000 {
+			label = "firmware";
+			reg = <0x400000 0x2000000 >;
+		};
+
+		partition at 2400000 {
+			label = "Kernel2";
+			reg = <0x2400000 0x2000000 >;
+		};
+
+		partition at 4400000 {
+			label = "Private";
+			reg = <0x4400000 0x100000>;
+		};
+
+		partition at 4500000 {
+			label = "Log";
+			reg = <0x4500000 0x1000000>;
+		};
+
+		partition at 5500000 {
+			label = "App";
+			reg = <0x5500000 0x2b00000>;
+		};
+	};
+};
+
+&pcie {
+        status = "okay";
+	pcie0 {
+                mt76 at 0,0 {
+                        mediatek,mtd-eeprom = <&factory 0>;
+                };
+        };
+
+};
+
+&ethernet {
+	mtd-mac-address = <&factory 0xe000>;
+};
+
+&xhci {
+       status = "disabled";
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		gpio {
+			ralink,group = "i2c", "uart3", "jtag", "wdt", "spi", "sdhci";
+			ralink,function = "gpio";
+		};
+	};
+};
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index a4a0f3d29382..cc37c53bad28 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -3,7 +3,7 @@
 #
 
 KERNEL_DTB += -d21
-DEVICE_VARS += TPLINK_BOARD_ID TPLINK_HEADER_VERSION TPLINK_HWID TPLINK_HWREV
+DEVICE_VARS += TPLINK_BOARD_ID TPLINK_HEADER_VERSION TPLINK_HWID TPLINK_HWREV MITRASTAR_MODEL_ID MITRASTAR_CUST_ID
 
 define Build/elecom-gst-factory
   $(eval product=$(word 1,$(1)))
@@ -531,6 +531,28 @@ define Device/zbt-wg3526-32M
 endef
 TARGET_DEVICES += zbt-wg3526-32M
 
+define Device/wap6805
+  DTS := WAP6805
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  FILESYSTEMS := squashfs
+  IMAGE_SIZE := $(ralink_default_fw_size_32M)
+  DEVICE_TITLE := ZyXEL WAP6805
+  DEVICE_PACKAGES := \
+	kmod-mt7603 kmod-mt76x2 \
+	kmod-usb3 kmod-usb-ledtrig-usbport wpad-mini \
+	-swconfig
+  MITRASTAR_MODEL_ID := 8008
+  MITRASTAR_CUST_ID := ffff
+  KERNEL_SIZE := 4096k
+  KERNEL := $(KERNEL_DTB) | mitrastar lzma
+  IMAGES += factory.bin
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  UBINIZE_OPTS := -E 5
+  IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += wap6805
+
 # FIXME: is this still needed?
 define Image/Prepare
 #define Build/Compile
-- 
2.11.0


_______________________________________________
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