Browse Source

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 <[email protected]>
George Hopkins 8 years ago
parent
commit
13f9e40602

+ 1 - 1
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

+ 1 - 0
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|\

+ 7 - 6
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"
 		;;

+ 6 - 3
target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header → 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

+ 3 - 0
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"
 		;;

+ 139 - 0
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@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>;
+};

+ 16 - 0
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

+ 1 - 0
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