From 9b35815f0f0e10125d144c82595bbccbc83d6812 Mon Sep 17 00:00:00 2001 From: Francois Goudal Date: Mon, 27 Feb 2017 21:59:50 +0100 Subject: [PATCH] ramips: add support for Afoundry EW-1200 This device features both a 2.4 and 5Ghz radio, and supports 802.11a/b/g/n/ac modes. It has 5 Gb-Ethernet ports and a USB 3.0 host port. It is powered by the Mediatek MT7621 SoC, and the MT7602E and MT7612E wifi chipsets, together with 128MB of RAM and 16 MB of SPI Flash. The stock firmware is in fact based on some openwrt barrier breaker, with a mediatek SDK kernel, and an afoundry custom made web interface (not LuCI based). Firmware update page on the stock web interface can not accept sysupgrade images, it bricks the device. At this point, the only working solution I found was to connect to the serial console port (available on J4 header) and to use opkg to install dropbear. Then scp the sysupgrade file in the device's /tmp and run sysupgrade from console without preserving configuration files. Signed-off-by: Francois Goudal --- .../ramips/base-files/etc/board.d/01_leds | 1 + .../ramips/base-files/etc/board.d/02_network | 1 + target/linux/ramips/base-files/etc/diag.sh | 1 + target/linux/ramips/base-files/lib/ramips.sh | 3 + .../ramips/base-files/lib/upgrade/platform.sh | 1 + target/linux/ramips/dts/EW1200.dts | 127 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 8 ++ 7 files changed, 142 insertions(+) create mode 100644 target/linux/ramips/dts/EW1200.dts diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds index be3306d308..e01ba5f602 100755 --- a/target/linux/ramips/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/base-files/etc/board.d/01_leds @@ -19,6 +19,7 @@ board_config_update case $board in 11acnas|\ all0239-3g|\ +ew1200|\ hw550-3g|\ mofi3500-3gn|\ sap-g3200u3|\ 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 cfad1fffde..c67f3d58b3 100755 --- a/target/linux/ramips/base-files/etc/board.d/02_network +++ b/target/linux/ramips/base-files/etc/board.d/02_network @@ -78,6 +78,7 @@ ramips_setup_interfaces() dir-320-b1|\ dir-610-a1|\ dir-615-h1|\ + ew1200|\ firewrt|\ hc5661a|\ hc5962|\ diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh index 3f2211778b..54961371f8 100644 --- a/target/linux/ramips/base-files/etc/diag.sh +++ b/target/linux/ramips/base-files/etc/diag.sh @@ -88,6 +88,7 @@ get_status_led() { status_led="$board:blue:wlan" ;; atp-52b|\ + ew1200|\ ip2202) status_led="$board:green:run" ;; diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh index 8e53848be8..91ce5fbd49 100755 --- a/target/linux/ramips/base-files/lib/ramips.sh +++ b/target/linux/ramips/base-files/lib/ramips.sh @@ -184,6 +184,9 @@ ramips_board_detect() { *"ESR-9753") name="esr-9753" ;; + *"EW1200") + name="ew1200" + ;; *"EX2700") name="ex2700"; ;; diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh index e5e5eb0487..3245e2c1c8 100755 --- a/target/linux/ramips/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh @@ -53,6 +53,7 @@ platform_check_image() { dwr-512-b|\ e1700|\ esr-9753|\ + ew1200|\ ex2700|\ f7c027|\ firewrt|\ diff --git a/target/linux/ramips/dts/EW1200.dts b/target/linux/ramips/dts/EW1200.dts new file mode 100644 index 0000000000..73c5395c19 --- /dev/null +++ b/target/linux/ramips/dts/EW1200.dts @@ -0,0 +1,127 @@ +/dts-v1/; + +#include "mt7621.dtsi" + +#include +#include + +/ { + model = "EW1200"; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,57600"; + }; + + palmbus: palmbus@1E000000 { + i2c@900 { + status = "okay"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + poll-interval = <20>; + + reset { + label = "reset"; + gpios = <&gpio0 18 1>; + linux,code = ; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status { + label = "ew1200:green:run"; + gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>; + }; + + usb { + label = "ew1200:green:usb"; + gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&sdhci { + status = "okay"; +}; + +&spi0 { + status = "okay"; + + m25p80@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + m25p,chunked-io = <32>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; +}; + +&pcie { + status = "okay"; + + pcie0 { + mt76@0,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; + }; + + pcie1 { + mt76@1,0 { + reg = <0x0000 0 0 0 0>; + device_type = "pci"; + mediatek,mtd-eeprom = <&factory 0x0000>; + ieee80211-freq-limit = <2400000 2500000>; + }; + }; +}; + +ðernet { + mtd-mac-address = <&factory 0xe000>; +}; + +&pinctrl { + state_default: pinctrl0 { + gpio { + ralink,group = "wdt", "rgmii2", "wdt rst", "jtag", "mdio"; + ralink,function = "gpio"; + }; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index d40c185084..6704f84dc5 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -63,6 +63,14 @@ define Device/dir-860l-b1 endef TARGET_DEVICES += dir-860l-b1 +define Device/ew1200 + DTS := EW1200 + IMAGE_SIZE := $(ralink_default_fw_size_16M) + DEVICE_TITLE := AFOUNDRY EW1200 + DEVICE_PACKAGES := kmod-usb3 kmod-usb-ledtrig-usbport kmod-ata-core kmod-ata-ahci +endef +TARGET_DEVICES += ew1200 + define Device/firewrt DTS := FIREWRT IMAGE_SIZE := $(ralink_default_fw_size_16M) -- 2.25.1