From 13f9e40602707479aaffac0d68a952070f305b7d Mon Sep 17 00:00:00 2001 From: George Hopkins Date: Sat, 28 Oct 2017 14:24:21 +0200 Subject: [PATCH] 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 --- package/system/mtd/src/Makefile | 2 +- .../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(-) rename target/linux/ramips/base-files/etc/uci-defaults/{09_fix-seama-header => 09_fix-checksum} (66%) create mode 100644 target/linux/ramips/dts/DAP-1522-A1.dts diff --git a/package/system/mtd/src/Makefile b/package/system/mtd/src/Makefile index 52fac47fe0..daeadbcd35 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 1ccff892b1..8f0a2b0725 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 e38311d5e5..342a648687 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 9533aed475..7e579316b5 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 74ed5913b8..9738f01dfe 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 0000000000..8f8d098bd5 --- /dev/null +++ b/target/linux/ramips/dts/DAP-1522-A1.dts @@ -0,0 +1,139 @@ +/dts-v1/; + +#include "rt2880.dtsi" + +#include +#include + +/ { + 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 = ; + }; + + wps { + label = "wps"; + gpios = <&gpio2 16 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + ap { + label = "ap"; + gpios = <&gpio2 13 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + + bridge { + label = "bridge"; + gpios = <&gpio2 14 GPIO_ACTIVE_LOW>; + linux,code = ; + linux,input-type = ; + }; + }; + + 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"; + }; + }; +}; + +ðernet { + 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>; +}; diff --git a/target/linux/ramips/image/rt288x.mk b/target/linux/ramips/image/rt288x.mk index 86a506388c..e9627a7431 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 92f1881ffb..b6b9b8963b 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