From: Bernhard Frauendienst Date: Sat, 18 Aug 2018 16:28:02 +0000 (+0200) Subject: ath79: add support for Buffalo WZR-HP-AG300H X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=480bf28273926d7b30be21b7605dd4fefd07fc3a;p=openwrt%2Fstaging%2Flynxis.git ath79: add support for Buffalo WZR-HP-AG300H Buffalo WZR-HP-AG300H is a dual band router based on Qualcom Atheros AR7161 rev 2 Specification: - 680 MHz CPU (Qualcomm Atheros AR7161) - 128 MiB RAM (2x Samsung K4H511638G-LCCC) - 32 MiB Flash (2x Winbond 25Q128BVFG) - WiFi 5 GHz a/n (Atheros AR9220) - WiFi 2.4 GHz b/g/n (Atheros AR9223) - 1000Base-T WAN (Atheros AR7161) - 4x 1000Base-T Switch (Atheros AR8316) - 1x USB 2.0 - 3 Buttons (AOSS/WPS, Reset, USB Eject) - 2 Slide switches (Router (on/off/auto), Movie Engine (on/off)) - 9 LEDs (Power green, WLAN 2GHz green, WLAN 2GHz amber, WLAN 5GHz green, WLAN 5GHz LED amber, Router green, Diag red, Movie Engine blue, USB green) It is already supported by the ar71xx target. For more information on the device visit the wiki: Serial console: - The UART Header is next to Movie Engine Switch. - Pinout is RX - TX - GND - 3.3V (Square Pad is 3.3V) - The Serial setting is 115200-8-N-1. Installation of OpenWRT from vendor firmware: - Connect to the Web-interface at http://192.168.11.1 - Go to “Administration” → “Firmware Upgrade” - Upload the OpenWrt factory image Tested: - Ethernet (LAN, WAN) - WiFi - Installation - via TFTP rescue - via factory image - on firmware v1.77 (28-05-2012) - on pro firmware v24SP2 r30356 (26-03-2018) - via sysupgrade from ar71xx (wlan devices don't work because of new names) - via sysupgrade from itself - Buttons - LEDS - USB (Power control and device recognition) Signed-off-by: Bernhard Frauendienst --- diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network index 6cd794e3d9..54fbe7b350 100755 --- a/target/linux/ath79/base-files/etc/board.d/02_network +++ b/target/linux/ath79/base-files/etc/board.d/02_network @@ -27,6 +27,11 @@ ath79_setup_interfaces() wd,mynet-wifi-rangeextender) ucidef_set_interface_lan "eth0" ;; + buffalo,wzr-hp-ag300h) + ucidef_set_interface_wan "eth1" + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" + ;; buffalo,wzr-hp-g450h) ucidef_add_switch "switch0" \ "0@eth0" "2:lan" "3:lan" "4:lan" "5:lan" "1:wan" diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 8c10cb8979..334e7056cf 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -156,15 +156,16 @@ case "$FIRMWARE" in ;; "ath9k-eeprom-pci-0000:00:11.0.bin") case $board in - dlink,dir-825-b1) - ath9k_eeprom_extract "caldata" 4096 3768 - ath9k_patch_fw_mac_crc $(mtd_get_mac_text "caldata" 65440) 524 - ;; + buffalo,wzr-hp-ag300h|\ netgear,wndr3700|\ netgear,wndr3700v2|\ netgear,wndr3800) ath9k_eeprom_extract "art" 4096 3768 ;; + dlink,dir-825-b1) + ath9k_eeprom_extract "caldata" 4096 3768 + ath9k_patch_fw_mac_crc $(mtd_get_mac_text "caldata" 65440) 524 + ;; *) ath9k_eeprom_die "board $board is not supported yet" ;; @@ -172,15 +173,16 @@ case "$FIRMWARE" in ;; "ath9k-eeprom-pci-0000:00:12.0.bin") case $board in - dlink,dir-825-b1) - ath9k_eeprom_extract "caldata" 20480 3768 - ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_text "caldata" 65460) 1) 524 - ;; + buffalo,wzr-hp-ag300h|\ netgear,wndr3700|\ netgear,wndr3700v2|\ netgear,wndr3800) ath9k_eeprom_extract "art" 20480 3768 ;; + dlink,dir-825-b1) + ath9k_eeprom_extract "caldata" 20480 3768 + ath9k_patch_fw_mac_crc $(macaddr_add $(mtd_get_mac_text "caldata" 65460) 1) 524 + ;; *) ath9k_eeprom_die "board $board is not supported yet" ;; diff --git a/target/linux/ath79/config-4.14 b/target/linux/ath79/config-4.14 index 6f273e1bcd..f0365e95f8 100644 --- a/target/linux/ath79/config-4.14 +++ b/target/linux/ath79/config-4.14 @@ -173,6 +173,7 @@ CONFIG_MTD_SPLIT_TPLINK_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_MTD_SPLIT_WRGG_FW=y CONFIG_MTD_TPLINK_PARTS=y +CONFIG_MTD_VIRT_CONCAT=y CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y diff --git a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts new file mode 100644 index 0000000000..8a5571ad0f --- /dev/null +++ b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts @@ -0,0 +1,284 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/dts-v1/; + +#include +#include + +#include "ar7100.dtsi" + +/ { + compatible = "buffalo,wzr-hp-ag300h", "qca,ar7161"; + model = "Buffalo WZR-HP-AG300H/WZR-600DHP"; + + aliases { + led-boot = &diag; + led-failsafe = &diag; + led-upgrade = &diag; + }; + + chosen { + bootargs = "console=ttyS0,115200"; + }; + + extosc: ref { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-output-names = "ref"; + clock-frequency = <40000000>; + }; + + gpio-leds { + compatible = "gpio-leds"; + + diag: diag { + label = "buffalo:red:diag"; + gpios = <&gpio 1 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + }; + + ath9k-leds { + // those leds are indeed attached to the wifi chips + + compatible = "gpio-leds"; + band2g_a { + label = "buffalo:amber:band2g"; + gpios = <&ath9k0 1 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + usb { + label = "buffalo:green:usb"; + gpios = <&ath9k0 3 GPIO_ACTIVE_LOW>; + default-state = "off"; + trigger-sources = <&usb_ochi_port>, <&usb_echi_port>; + linux,default-trigger = "usbport"; + }; + + band2g_g { + label = "buffalo:green:band2g"; + gpios = <&ath9k0 5 GPIO_ACTIVE_LOW>; + default-state = "off"; + linux,default-trigger = "phy0tpt"; + }; + + band5g_g { + label = "buffalo:green:band5g"; + gpios = <&ath9k1 1 GPIO_ACTIVE_LOW>; + default-state = "off"; + linux,default-trigger = "phy1tpt"; + }; + + router { + label = "buffalo:green:router"; + gpios = <&ath9k1 3 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + movie_engine { + label = "buffalo:blue:movie_engine"; + gpios = <&ath9k1 4 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + + band5g_a { + label = "buffalo:amber:band5g"; + gpios = <&ath9k1 5 GPIO_ACTIVE_LOW>; + default-state = "off"; + }; + }; + + gpio-keys-polled { + compatible = "gpio-keys-polled"; + poll-interval = <20>; + + reset { + linux,code = ; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + usb { + linux,code = ; + gpios = <&gpio 3 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + aoss { + linux,code = ; + gpios = <&gpio 5 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + router_auto { + linux,code = ; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + router_off { + linux,code = ; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + + movie_engine { + linux,code = ; + gpios = <&gpio 8 GPIO_ACTIVE_LOW>; + debounce-interval = <60>; + }; + }; + + gpio-export { + compatible = "gpio-export"; + + gpio_usb_power { + gpio-export,name = "buffalo:power:usb"; + gpio-export,output = <1>; + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>; + }; + }; + + flash { + compatible = "mtd-concat"; + + devices = <&flash0 &flash1>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + label = "u-boot"; + reg = <0x0000000 0x0040000>; + read-only; + }; + + partition@40000 { + label = "u-boot-env"; + reg = <0x0040000 0x0010000>; + read-only; + }; + + art: partition@50000 { + label = "art"; + reg = <0x0050000 0x0010000>; + read-only; + }; + + partition@60000 { + label = "firmware"; + reg = <0x0060000 0x1f90000>; + }; + + partition@1ff0000 { + label = "user_property"; + reg = <0x1ff0000 0x0010000>; + read-only; + }; + }; + }; +}; + +&usb_phy { + status = "okay"; +}; + +&usb1 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + usb_ochi_port: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&usb2 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + usb_echi_port: port@1 { + reg = <1>; + #trigger-source-cells = <0>; + }; +}; + +&pcie0 { + status = "okay"; + + ath9k0: wifi@0,11 { + compatible = "pci168c,0029"; + reg = <0x8800 0 0 0 0>; + qca,no-eeprom; + #gpio-cells = <2>; + gpio-controller; + }; + + ath9k1: wifi@0,12 { + compatible = "pci168c,0029"; + reg = <0x9000 0 0 0 0>; + qca,no-eeprom; + #gpio-cells = <2>; + gpio-controller; + }; +}; + +&uart { + status = "okay"; +}; + +&pll { + clocks = <&extosc>; +}; + +&spi { + status = "okay"; + num-cs = <2>; + cs-gpios = <0>, <0>; + + flash0: flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <104000000>; + m25p,fast-read; + }; + + flash1: flash@1 { + compatible = "jedec,spi-nor"; + reg = <1>; + spi-max-frequency = <104000000>; + m25p,fast-read; + }; +}; + +&mdio0 { + status = "okay"; + + phy4: ethernet-phy@4 { + reg = <4>; + phy-mode = "rgmii"; + }; +}; + +ð0 { + status = "okay"; + + mtd-mac-address = <&art 0x120c>; + + fixed-link { + speed = <1000>; + full-duplex; + }; +}; + +ð1 { + status = "okay"; + + mtd-mac-address = <&art 0x520c>; + mtd-mac-address-increment = <1>; + + phy-handle = <&phy4>; +}; diff --git a/target/linux/ath79/image/common-buffalo.mk b/target/linux/ath79/image/common-buffalo.mk new file mode 100644 index 0000000000..a756f8448b --- /dev/null +++ b/target/linux/ath79/image/common-buffalo.mk @@ -0,0 +1,20 @@ +define Build/buffalo-tftp-header + ( \ + echo -n -e "# Airstation Public Fmt1" | dd bs=32 count=1 conv=sync; \ + dd if=$@; \ + ) > $@.new + mv $@.new $@ +endef + +define Build/buffalo-tag + $(eval product=$(word 1,$(1))) + $(STAGING_DIR_HOST)/bin/buffalo-tag \ + -c 0x80041000 -d 0x801e8000 -w 3 \ + -a ath -v 1.99 -m 1.01 -f 1 \ + -b $(product) -p $(product) \ + -r M_ -l mlang8 \ + -i $@ -o $@.new + mv $@.new $@ +endef + + diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index fc38c09958..e968dcf92c 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1,3 +1,4 @@ +include ./common-buffalo.mk include ./common-netgear.mk DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION @@ -68,6 +69,19 @@ define Device/avm_fritz4020 endef TARGET_DEVICES += avm_fritz4020 +define Device/buffalo_wzr-hp-ag300h + ATH_SOC := ar7161 + DEVICE_TITLE := Buffalo WZR-HP-AG300H + IMAGE_SIZE := 32256k + IMAGES += factory.bin tftp.bin + IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) + IMAGE/factory.bin := $$(IMAGE/default) | buffalo-enc WZR-HP-AG300H 1.99 | buffalo-tag WZR-HP-AG300H + IMAGE/tftp.bin := $$(IMAGE/default) | buffalo-tftp-header + DEVICE_PACKAGES := kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport kmod-leds-reset kmod-owl-loader + SUPPORTED_DEVICES += wzr-hp-ag300h +endef +TARGET_DEVICES += buffalo_wzr-hp-ag300h + define Device/buffalo_wzr-hp-g450h ATH_SOC := ar7242 DEVICE_TITLE := Buffalo WZR-HP-G450H diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk index 0047554620..531a7f30c2 100644 --- a/target/linux/ath79/image/tiny.mk +++ b/target/linux/ath79/image/tiny.mk @@ -1,23 +1,6 @@ -DEVICE_VARS += ROOTFS_SIZE - -define Build/buffalo-tftp-header - ( \ - echo -n -e "# Airstation Public Fmt1" | dd bs=32 count=1 conv=sync; \ - dd if=$@; \ - ) > $@.new - mv $@.new $@ -endef +include ./common-buffalo.mk -define Build/buffalo-tag - $(eval product=$(word 1,$(1))) - $(STAGING_DIR_HOST)/bin/buffalo-tag \ - -c 0x80041000 -d 0x801e8000 -w 3 \ - -a ath -v 1.99 -m 1.01 -f 1 \ - -b $(product) -p $(product) \ - -r M_ -l mlang8 \ - -i $@ -o $@.new - mv $@.new $@ -endef +DEVICE_VARS += ROOTFS_SIZE define Device/buffalo_bhr-4grv2 ATH_SOC := qca9558