[openwrt/openwrt] ramips: add support for D-Link DAP-1522 A1

LEDE Commits lede-commits at lists.infradead.org
Tue Feb 13 02:18:52 PST 2018


blogic pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/13f9e40602707479aaffac0d68a952070f305b7d

commit 13f9e40602707479aaffac0d68a952070f305b7d
Author: George Hopkins <george-hopkins at null.net>
AuthorDate: Sat Oct 28 14:24:21 2017 +0200

    ramips: add support for D-Link DAP-1522 A1
    
    D-Link DAP-1522 is a wireless bridge/access point with 4 LAN
    ports and a dual-band wireless chipset.
    
    Specifications:
    - Ralink RT2880
    - 32 MB of RAM
    - 4 MB of Flash
    - 4x 10/100/1000 Mbps Ethernet (RTL8366SR)
    - 802.11abgn (RT2850)
    
    Flash Instructions:
    1. Download lede-ramips-rt288x-dap-1522-a1-squashfs-factory.bin
    2. Open the web interface and upload the image
    
    Signed-off-by: George Hopkins <george-hopkins at null.net>
---
 package/system/mtd/src/Makefile                    |   2 +-
 .../linux/ramips/base-files/etc/board.d/02_network |   1 +
 target/linux/ramips/base-files/etc/diag.sh         |  13 +-
 .../{09_fix-seama-header => 09_fix-checksum}       |   9 +-
 target/linux/ramips/base-files/lib/ramips.sh       |   3 +
 target/linux/ramips/dts/DAP-1522-A1.dts            | 139 +++++++++++++++++++++
 target/linux/ramips/image/rt288x.mk                |  16 +++
 target/linux/ramips/rt288x/config-4.9              |   1 +
 8 files changed, 174 insertions(+), 10 deletions(-)

diff --git a/package/system/mtd/src/Makefile b/package/system/mtd/src/Makefile
index 52fac47..daeadbc 100644
--- a/package/system/mtd/src/Makefile
+++ b/package/system/mtd/src/Makefile
@@ -11,7 +11,7 @@ obj.brcm = trx.o
 obj.brcm47xx = $(obj.brcm)
 obj.bcm53xx = $(obj.brcm) $(obj.seama)
 obj.brcm63xx = imagetag.o
-obj.ramips = $(obj.seama)
+obj.ramips = $(obj.seama) $(obj.wrg)
 obj.mvebu = linksys_bootcount.o
 obj.kirkwood = linksys_bootcount.o
 obj.ipq806x = linksys_bootcount.o
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 1ccff89..8f0a2b0 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -242,6 +242,7 @@ ramips_setup_interfaces()
 		;;
 	cs-qr10|\
 	d105|\
+	dap-1522-a1|\
 	dch-m225|\
 	ex2700|\
 	ex3700|\
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index e38311d..342a648 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -147,6 +147,13 @@ get_status_led() {
 	youku-yk1)
 		status_led="$boardname:blue:power"
 		;;
+	dap-1522-a1|\
+	k2p|\
+	m3|\
+	mir3g|\
+	miwifi-nano)
+		status_led="$boardname:blue:status"
+		;;
 	db-wrt01|\
 	esr-9753|\
 	pbr-d1)
@@ -174,12 +181,6 @@ get_status_led() {
 	hc5962)
 		status_led="$boardname:white:status"
 		;;
-	k2p|\
-	m3|\
-	mir3g|\
-	miwifi-nano)
-		status_led="$boardname:blue:status"
-		;;
 	linkits7688)
 		status_led="linkit-smart-7688:orange:wifi"
 		;;
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header b/target/linux/ramips/base-files/etc/uci-defaults/09_fix-checksum
similarity index 66%
rename from target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header
rename to target/linux/ramips/base-files/etc/uci-defaults/09_fix-checksum
index 9533aed..7e57931 100644
--- a/target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header
+++ b/target/linux/ramips/base-files/etc/uci-defaults/09_fix-checksum
@@ -5,10 +5,10 @@
 
 . /lib/functions.sh
 
-fix_seama_header() {
+fix_checksum() {
 	local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"kernel".*/\1/p' /proc/mtd)
 
-	[ "$kernel_size" ] && mtd -c 0x$kernel_size fixseama firmware
+	[ "$kernel_size" ] && mtd -c 0x$kernel_size fix$1 firmware
 }
 
 board=$(board_name)
@@ -18,6 +18,9 @@ cy-swr1100 | \
 dch-m225 | \
 dir-645 | \
 dir-860l-b1)
-	fix_seama_header
+	fix_checksum seama
+	;;
+dap-1522-a1)
+	fix_checksum wrg
 	;;
 esac
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 74ed591..9738f01 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -112,6 +112,9 @@ ramips_board_detect() {
 	*"DAP-1350")
 		name="dap-1350"
 		;;
+	*"DAP-1522 A1")
+		name="dap-1522-a1"
+		;;
 	*"DB-WRT01")
 		name="db-wrt01"
 		;;
diff --git a/target/linux/ramips/dts/DAP-1522-A1.dts b/target/linux/ramips/dts/DAP-1522-A1.dts
new file mode 100644
index 0000000..8f8d098
--- /dev/null
+++ b/target/linux/ramips/dts/DAP-1522-A1.dts
@@ -0,0 +1,139 @@
+/dts-v1/;
+
+#include "rt2880.dtsi"
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+/ {
+	compatible = "dlink,dap-1522-a1", "ralink,rt2880-soc";
+	model = "D-Link DAP-1522 A1";
+
+	cfi at bc400000 {
+		compatible = "cfi-flash";
+		reg = <0xbc400000 0x800000>;
+		bank-width = <2>;
+		device-width = <2>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition at 0 {
+			label = "uboot";
+			reg = <0x0 0x30000>;
+			read-only;
+		};
+
+		factory: partition at 30000 {
+			label = "factory";
+			reg = <0x30000 0x10000>;
+			read-only;
+		};
+
+		partition at 40000 {
+			label = "firmware";
+			reg = <0x40000 0x3a0000>;
+		};
+	};
+
+	rtl8366s {
+		compatible = "realtek,rtl8366s";
+		gpio-sda = <&gpio0 1 GPIO_ACTIVE_HIGH>;
+		gpio-sck = <&gpio0 2 GPIO_ACTIVE_HIGH>;
+	};
+
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		poll-interval = <100>;
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		wps {
+			label = "wps";
+			gpios = <&gpio2 16 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_WPS_BUTTON>;
+		};
+
+		ap {
+			label = "ap";
+			gpios = <&gpio2 13 GPIO_ACTIVE_LOW>;
+			linux,code = <BTN_0>;
+			linux,input-type = <EV_SW>;
+		};
+
+		bridge {
+			label = "bridge";
+			gpios = <&gpio2 14 GPIO_ACTIVE_LOW>;
+			linux,code = <BTN_1>;
+			linux,input-type = <EV_SW>;
+		};
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		wps {
+			label = "dap-1522-a1:blue:wps";
+			gpios = <&gpio2 17 GPIO_ACTIVE_LOW>;
+		};
+
+		ap {
+			label = "dap-1522-a1:blue:ap";
+			gpios = <&gpio2 18 GPIO_ACTIVE_LOW>;
+		};
+
+		sta {
+			label = "dap-1522-a1:red:sta";
+			gpios = <&gpio2 19 GPIO_ACTIVE_LOW>;
+		};
+
+		status {
+			label = "dap-1522-a1:blue:status";
+			gpios = <&gpio2 20 GPIO_ACTIVE_LOW>;
+		};
+	};
+};
+
+&gpio0 {
+	status = "okay";
+};
+
+&gpio2 {
+	status = "okay";
+};
+
+&pinctrl {
+	state_default: pinctrl0 {
+		gpio {
+			ralink,group = "i2c", "uartlite", "pci";
+			ralink,function = "gpio";
+		};
+	};
+};
+
+&ethernet {
+	status = "okay";
+	mtd-mac-address = <&factory 0x2004>;
+
+	port at 0 {
+		mediatek,fixed-link = <1000 1 1 1>;
+	};
+
+	mdio-bus {
+		status = "okay";
+
+		phy0: ethernet-phy at 0 {
+			phy-mode = "mii";
+			reg = <0>;
+		};
+	};
+};
+
+&wmac {
+	ralink,mtd-eeprom = <&factory 0x2000>;
+};
diff --git a/target/linux/ramips/image/rt288x.mk b/target/linux/ramips/image/rt288x.mk
index 86a5063..e9627a7 100644
--- a/target/linux/ramips/image/rt288x.mk
+++ b/target/linux/ramips/image/rt288x.mk
@@ -30,6 +30,22 @@ define Device/ar725w
 endef
 TARGET_DEVICES += ar725w
 
+define Device/dap-1522-a1
+  DTS := DAP-1522-A1
+  BLOCKSIZE := 64k
+  IMAGE_SIZE := 3801088
+  DEVICE_TITLE := D-Link DAP-1522 A1
+  DEVICE_PACKAGES := kmod-switch-rtl8366s
+  KERNEL := $(KERNEL_DTB)
+  IMAGES += factory.bin
+  IMAGE/factory.bin := \
+	append-kernel | pad-offset $$$$(BLOCKSIZE) 96 | \
+	append-rootfs | pad-rootfs -x 96 | \
+	wrg-header wapnd01_dlink_dap1522 | \
+	check-size $$$$(IMAGE_SIZE)
+endef
+TARGET_DEVICES += dap-1522-a1
+
 define Device/f5d8235-v1
   IMAGE_SIZE := 7744k
   DEVICE_TITLE := Belkin F5D8235 V1
diff --git a/target/linux/ramips/rt288x/config-4.9 b/target/linux/ramips/rt288x/config-4.9
index 92f1881..b6b9b89 100644
--- a/target/linux/ramips/rt288x/config-4.9
+++ b/target/linux/ramips/rt288x/config-4.9
@@ -134,6 +134,7 @@ CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_SPLIT_FIRMWARE=y
 CONFIG_MTD_SPLIT_LZMA_FW=y
 CONFIG_MTD_SPLIT_UIMAGE_FW=y
+CONFIG_MTD_SPLIT_WRGG_FW=y
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NEED_PER_CPU_KM=y
 CONFIG_NET_MEDIATEK_MDIO=y



More information about the lede-commits mailing list