From 29014b54d4cbabe28961ca26d758e266ef76a7d5 Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Tue, 7 Oct 2025 23:53:32 +0900 Subject: [PATCH] ath79: add support for NEC Aterm WF1200HP MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit NEC Aterm WF1200HP is a 2.4/5 GHz band 11ac (Wi-Fi 5) router with FE ports, based on AR9344. Specification: - SoC : Atheros AR9344 - RAM : DDR2 128 MiB (2x ESMT M14D5121632A-2.5BG2A) - Flash : SPI-NOR 8 MiB (Macronix MX25L6406EM2I-12G) - WLAN : 2.4/5 GHz 2T2R - 2.4 GHz : Atheros AR9344 (SoC) - 5 GHz : Qualcomm Atheros QCA9882 - Ethernet : 4x 10/100 Mbps - switch : Atheros AR9344 (SoC) - LEDs/Keys (GPIO) : 12x/4x - note : all LEDs are controlled by ath10k chip (QCA9882) - UART : through-hole on PCB (J1) - assignment : 3.3V, GND, NC, TX, RX from tri-angle marking - settings : 9600n8 (U-Boot: 115200n8) - Power : 12 VDC, 0.7 A (Max. 8 W) - Stock OS : NetBSD based Flash instruction using initramfs-factory.bin image (StockFW WebUI): 1. Boot WF1200HP with router mode 2. Access to the WebUI ("http://aterm.me/" or "http://192.168.10.1/") on the device and open firmware update page ("ファームウェア更新") 3. Select the OpenWrt initramfs-factory.bin image and click update ("更新") button 4. After updating, the device will be rebooted and booted with OpenWrt initramfs image 5. On the initramfs image, upload (or download) uboot.bin and sysupgrade.bin image to the device 6. Replace the bootloader with uboot.bin image mtd write bootloader 7. Perform sysupgrade with sysupgrade.bin image sysupgrade 8. Wait ~120 seconds to complete flashing and rebooting Flash instruction using initramfs-factory.bin image (bootloader CLI): 1. Connect and open serial console 2. Power on WF1200HP and interrupt bootloader by ESC key 3. Login to the bootloader CLI with the password "chiron" 4. Start TFTP server by "tftpd" command 5. Upload initramfs-factory.bin via tftp from your computer example (Windows): tftp -i 192.168.0.1 PUT initramfs-factory.bin 6. Boot initramfs image by "boot" command 7. On the initramfs image, backup the stock bootloader and firmware if needed 8. Upload (or download) uboot.bin and sysupgrade.bin image to the device 9. Replace the bootloader with uboot.bin image (see above) 10. Perform sysupgrade with sysupgrade.bin image (see above) 11. Wait ~120 seconds to complete flashing and rebooting Notes: - The stock bootloader requires the unknown filesystem on firmware area in the flash chip. Booting OpenWrt from that filesystem cannot be handled, so the bootloader needs to be replaced to mainline U-Boot before OpenWrt installation. Known issues: - All LEDs on the front side are connected to the GPIO controller on the ath10k chip (QCA9882) and controlled by it. The current ath10k driver supports only one LED as "ath10k-phyN", but using as a GPIO controller is not supported yet. As a result, all 12x LEDs on the front side cannot be controlled by users. MAC Addresses: LAN : C0:25:A2:xx:xx:44 (config, 0x6 (hex)) WAN : C0:25:A2:xx:xx:45 (config, 0xc (hex)) 2.4 GHz: C0:25:A2:xx:xx:46 (config, 0x0 (hex)) 5 GHz : C0:25:A2:xx:xx:47 (config, 0x12 (hex)) Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/20611 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/ar9344_nec_wf1200.dtsi | 177 ++++++++++++++++++ .../linux/ath79/dts/ar9344_nec_wf1200hp.dts | 8 + .../linux/ath79/image/lzma-loader/src/board.c | 6 +- target/linux/ath79/image/tiny.mk | 13 ++ .../tiny/base-files/etc/board.d/02_network | 5 + .../tiny/base-files/lib/upgrade/platform.sh | 1 + 6 files changed, 208 insertions(+), 2 deletions(-) create mode 100644 target/linux/ath79/dts/ar9344_nec_wf1200.dtsi create mode 100644 target/linux/ath79/dts/ar9344_nec_wf1200hp.dts diff --git a/target/linux/ath79/dts/ar9344_nec_wf1200.dtsi b/target/linux/ath79/dts/ar9344_nec_wf1200.dtsi new file mode 100644 index 0000000000..576e5aba4b --- /dev/null +++ b/target/linux/ath79/dts/ar9344_nec_wf1200.dtsi @@ -0,0 +1,177 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include +#include +#include + +#include "ar9344.dtsi" + +/ { + aliases { + label-mac-device = ð0; + }; + + chosen { + /* + * don't specify bootargs property in DeviceTree to + * enable a console with a default baudrate (9600) + * or passed console= parameter from the bootloader + */ + /delete-property/ bootargs; + stdout-path = &uart; + }; + + keys { + compatible = "gpio-keys"; + + button-wps { + label = "wps"; + gpios = <&gpio 4 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + switch-bridge { + label = "br"; + gpios = <&gpio 11 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + switch-coverter { + label = "cnv"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + + button-reset { + label = "reset"; + gpios = <&gpio 15 GPIO_ACTIVE_LOW>; + linux,code = ; + debounce-interval = <60>; + }; + }; + + /* all LEDs are connected to ath10k chip (QCA9882) */ +}; + +&ref { + clock-frequency = <40000000>; +}; + +&spi { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <25000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* + * since the OEM bootloader requires unknown + * filesystem on firmware area, needs to be + * replaced to u-boot before OpenWrt installation + */ + partition@0 { + label = "bootloader"; + reg = <0x000000 0x020000>; + }; + + /* not compatible with u-boot */ + partition@20000 { + label = "config"; + reg = <0x020000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_config_0: mac-address@0 { + reg = <0x0 0x6>; + }; + + macaddr_config_6: mac-address@6 { + reg = <0x6 0x6>; + }; + + macaddr_config_c: mac-address@c { + reg = <0xc 0x6>; + }; + + macaddr_config_12: mac-address@12 { + reg = <0x12 0x6>; + }; + }; + }; + + partition@30000 { + label = "art"; + reg = <0x030000 0x010000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + cal_art_1000: calibration@1000 { + reg = <0x1000 0x440>; + }; + + cal_art_5000: calibration@5000 { + reg = <0x5000 0x844>; + }; + }; + }; + + partition@40000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x040000 0x7c0000>; + }; + }; + }; +}; + +ð0 { + status = "okay"; + + phy-handle = <&swphy4>; + + nvmem-cells = <&macaddr_config_c>; + nvmem-cell-names = "mac-address"; +}; + +ð1 { + status = "okay"; + + nvmem-cells = <&macaddr_config_6>; + nvmem-cell-names = "mac-address"; +}; + +&pcie { + status = "okay"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + + nvmem-cells = <&cal_art_5000>, <&macaddr_config_12>; + nvmem-cell-names = "calibration", "mac-address"; + }; +}; + +&wmac { + status = "okay"; + + nvmem-cells = <&cal_art_1000>, <&macaddr_config_0>; + nvmem-cell-names = "calibration", "mac-address"; +}; diff --git a/target/linux/ath79/dts/ar9344_nec_wf1200hp.dts b/target/linux/ath79/dts/ar9344_nec_wf1200hp.dts new file mode 100644 index 0000000000..2cf739f98c --- /dev/null +++ b/target/linux/ath79/dts/ar9344_nec_wf1200hp.dts @@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "ar9344_nec_wf1200.dtsi" + +/ { + compatible = "nec,wf1200hp", "qca,ar9344"; + model = "NEC Aterm WF1200HP"; +}; diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c index 7ed414aa90..5fbb4bb821 100644 --- a/target/linux/ath79/image/lzma-loader/src/board.c +++ b/target/linux/ath79/image/lzma-loader/src/board.c @@ -219,7 +219,8 @@ static inline void huawei_ap_init(void) static inline void huawei_ap_init(void) {} #endif -#if defined(CONFIG_BOARD_NEC_WG1400HP) || \ +#if defined(CONFIG_BOARD_NEC_WF1200HP) || \ + defined(CONFIG_BOARD_NEC_WG1400HP) || \ defined(CONFIG_BOARD_NEC_WG1800HP) || \ defined(CONFIG_BOARD_NEC_WG1800HP2) || \ defined(CONFIG_BOARD_NEC_WG2200HP) || \ @@ -262,7 +263,8 @@ static inline void nec_aterm_reset_common(void) } #endif -#if defined(CONFIG_BOARD_NEC_WG600HP) || \ +#if defined(CONFIG_BOARD_NEC_WF1200HP) || \ + defined(CONFIG_BOARD_NEC_WG600HP) || \ defined(CONFIG_BOARD_NEC_WR8750N) || \ defined(CONFIG_BOARD_NEC_WR9500N) diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk index 53111119d8..d8e127d20b 100644 --- a/target/linux/ath79/image/tiny.mk +++ b/target/linux/ath79/image/tiny.mk @@ -121,6 +121,19 @@ define Device/engenius_enh202-v1 endef TARGET_DEVICES += engenius_enh202-v1 +define Device/nec_wf1200hp + DEVICE_MODEL := Aterm WF1200HP + SOC := ar9344 + BLOCKSIZE := 4k + IMAGE_SIZE := 7936k + NEC_FW_TYPE := H047 + $(Device/nec-netbsd-aterm) + DEVICE_PACKAGES := kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct \ + -uboot-envtools + UBOOT_PATH := $$(STAGING_DIR_IMAGE)/$$(SOC)_nec_aterm_fe-u-boot.bin +endef +TARGET_DEVICES += nec_wf1200hp + define Device/nec_wg600hp DEVICE_MODEL := Aterm WG600HP SOC := ar9344 diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/02_network b/target/linux/ath79/tiny/base-files/etc/board.d/02_network index 7bd55986d5..991d39daee 100644 --- a/target/linux/ath79/tiny/base-files/etc/board.d/02_network +++ b/target/linux/ath79/tiny/base-files/etc/board.d/02_network @@ -72,6 +72,11 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth1" "4:lan:1" ;; + nec,wf1200hp) + ucidef_set_interface_wan "eth1" + ucidef_add_switch "switch0" \ + "0@eth0" "2:lan:3" "3:lan:2" "4:lan:1" + ;; nec,wg600hp|\ nec,wr8750n|\ nec,wr9500n|\ diff --git a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh index 8fc0efcfbd..5829c84c05 100644 --- a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh @@ -12,6 +12,7 @@ platform_check_image() { local board=$(board_name) case "$board" in + nec,wf1200hp|\ nec,wg600hp|\ nec,wr8750n|\ nec,wr9500n) -- 2.30.2