ramips: add support for D-Link DAP-1522 A1
authorGeorge Hopkins <george-hopkins@null.net>
Sat, 28 Oct 2017 12:24:21 +0000 (14:24 +0200)
committerJohn Crispin <john@phrozen.org>
Tue, 13 Feb 2018 10:18:07 +0000 (11:18 +0100)
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@null.net>
package/system/mtd/src/Makefile
target/linux/ramips/base-files/etc/board.d/02_network
target/linux/ramips/base-files/etc/diag.sh
target/linux/ramips/base-files/etc/uci-defaults/09_fix-checksum [new file with mode: 0644]
target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header [deleted file]
target/linux/ramips/base-files/lib/ramips.sh
target/linux/ramips/dts/DAP-1522-A1.dts [new file with mode: 0644]
target/linux/ramips/image/rt288x.mk
target/linux/ramips/rt288x/config-4.9

index 52fac47fe0d2356be49bccb042a4fc936303db4f..daeadbcd35eee3ab3058b62f0f6ab72adb4ae2fc 100644 (file)
@@ -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
index 1ccff892b1d31cbb507776f4d7d704e53b817e5b..8f0a2b0725774496f92c49fb74b791839ca18ebc 100755 (executable)
@@ -242,6 +242,7 @@ ramips_setup_interfaces()
                ;;
        cs-qr10|\
        d105|\
+       dap-1522-a1|\
        dch-m225|\
        ex2700|\
        ex3700|\
index e38311d5e5fc4785b5039cf23e58ea30dd70cae1..342a6486872cb0f1d3ccb5e00ea42fdf786663c7 100644 (file)
@@ -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-checksum b/target/linux/ramips/base-files/etc/uci-defaults/09_fix-checksum
new file mode 100644 (file)
index 0000000..7e57931
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+
+. /lib/functions.sh
+
+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 fix$1 firmware
+}
+
+board=$(board_name)
+
+case "$board" in
+cy-swr1100 | \
+dch-m225 | \
+dir-645 | \
+dir-860l-b1)
+       fix_checksum seama
+       ;;
+dap-1522-a1)
+       fix_checksum wrg
+       ;;
+esac
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-seama-header
deleted file mode 100644 (file)
index 9533aed..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2012 OpenWrt.org
-#
-
-. /lib/functions.sh
-
-fix_seama_header() {
-       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
-}
-
-board=$(board_name)
-
-case "$board" in
-cy-swr1100 | \
-dch-m225 | \
-dir-645 | \
-dir-860l-b1)
-       fix_seama_header
-       ;;
-esac
index 74ed5913b8c2e00172f01d5da09afd5c400f7d20..9738f01dfe408d73a3c1fd627a660bffdd26fe42 100755 (executable)
@@ -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 (file)
index 0000000..8f8d098
--- /dev/null
@@ -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@bc400000 {
+               compatible = "cfi-flash";
+               reg = <0xbc400000 0x800000>;
+               bank-width = <2>;
+               device-width = <2>;
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               partition@0 {
+                       label = "uboot";
+                       reg = <0x0 0x30000>;
+                       read-only;
+               };
+
+               factory: partition@30000 {
+                       label = "factory";
+                       reg = <0x30000 0x10000>;
+                       read-only;
+               };
+
+               partition@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@0 {
+               mediatek,fixed-link = <1000 1 1 1>;
+       };
+
+       mdio-bus {
+               status = "okay";
+
+               phy0: ethernet-phy@0 {
+                       phy-mode = "mii";
+                       reg = <0>;
+               };
+       };
+};
+
+&wmac {
+       ralink,mtd-eeprom = <&factory 0x2000>;
+};
index 86a506388c5de26257098327938b30ddfb64539b..e9627a7431b0a766ea3e2692688894f15e6e4342 100644 (file)
@@ -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
index 92f1881ffb50e484bd8a2f0f352e93e1bfbfc17f..b6b9b8963b99f7476811117c682180b3656eef37 100644 (file)
@@ -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