From de6fa88f0597e4223563eaeb8ed3e91bb6bee15f Mon Sep 17 00:00:00 2001 From: INAGAKI Hiroshi Date: Sat, 29 Jun 2024 21:53:42 +0900 Subject: [PATCH] ath79: add support for NEC Aterm WG1800HP MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit NEC Aterm WG1800HP is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on QCA9558. Specification: - SoC : Qualcomm Atheros QCA9558 - RAM : DDR2 128 MiB (2x Nanya NT5TU32M16DG-AC) - Flash : SPI-NOR 16 MiB (Macronix MX25L12845EMI-10G) - WLAN : 2.4/5 GHz - 2.4 GHz : 3T3R (Qualcomm Atheros QCA9558 (SoC)) - 5 GHz : 3T3R (Qualcomm Atheros QCA9880) - Ethernet : 5x 10/100/1000 Mbps - switch : Atheros AR8327 - LEDs/Keys (GPIO) : 12x/5x - UART : through-hole on PCB - assignment : 3.3V, GND, NC, TX, RX from tri-angle marking - settings : 9600n8 - USB : 1x USB 2.0 Type-A - hub (internal) : NEC uPD720114 - Power : 12 VDC, 1.5 A (Max. 17 W) - Stock OS : NetBSD based Flash instruction using initramfs-factory.bin image (StockFW WebUI): 1. Boot WG1800HP with router mode normally 2. Access to the WebUI ("http://aterm.me/" or "http://192.168.0.1/") on the device and open firmware update page ("ファームウェア更新") 3. Downgrade the stock firmware to v1.0.2 4. After downgrading, select the OpenWrt initramfs-factory.bin image and click update ("更新") button 5. After updating, the device will be rebooted and booted with OpenWrt initramfs image 6. On the initramfs image, upload (or download) uboot.bin and sysupgrade.bin image to the device 7. Replace the bootloader with a uboot.bin image mtd write bootloader 8. Perform sysupgrade with a sysupgrade.bin image sysupgrade 9. Wait ~120 seconds to complete flashing Flash instruction using initramfs-factory.bin image (bootloader CLI): 1. Connect and open serial console 2. Power on WG1800HP and interrupt bootloader by ESC key 3. Login to the bootloader CLI with a 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, back up 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 a uboot.bin image 10. Perform sysupgrade with a sysupgrade.bin image 11. Wait ~120 seconds to complete flashing Notes: - All LEDs are connected to the TI TCA6416A (marking: PH416A) I2C Expander chip. - The stock bootloader requires an unknown filesystem on firmware area in the flash. Booting of OpenWrt from that filesystem cannot be handled, so the bootloader needs to be replaced to mainline U-Boot before OpenWrt installation. - The data length of blocks in firmware image will be checked (4M < threshold < 6M) on the stock WebUI on some versions (v1.0.28, v1.0.30(latest), ...), so needs to be downgraded before OpenWrt installation with initramfs-factory image. MAC addresses: LAN : 10:66:82:xx:xx:04 (config, 0x6 (hex)) WAN : 10:66:82:xx:xx:05 (config, 0xc (hex)) 2.4 GHz: 10:66:82:xx:xx:06 (config, 0x0 (hex)) 5 G : 10:66:82:xx:xx:07 (config, 0x12 (hex)) Signed-off-by: INAGAKI Hiroshi Link: https://github.com/openwrt/openwrt/pull/16297 Signed-off-by: Hauke Mehrtens --- target/linux/ath79/dts/qca9558_nec_wg1800hp.dts | 12 ++++++++++++ .../ath79/generic/base-files/etc/board.d/02_network | 1 + .../ath79/generic/base-files/lib/upgrade/platform.sh | 3 ++- target/linux/ath79/image/generic.mk | 10 ++++++++++ target/linux/ath79/image/lzma-loader/src/board.c | 7 +++++-- 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 target/linux/ath79/dts/qca9558_nec_wg1800hp.dts diff --git a/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts b/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts new file mode 100644 index 0000000000..47679c5869 --- /dev/null +++ b/target/linux/ath79/dts/qca9558_nec_wg1800hp.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "qca9558_nec_aterm.dtsi" + +/ { + compatible = "nec,wg1800hp", "qca,qca9558"; + model = "NEC Aterm WG1800HP"; +}; + +ð0 { + pll-data = <0x5a000000 0x00000101 0x00001616>; +}; diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network index 8efae58ae6..759508d386 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -190,6 +190,7 @@ ath79_setup_interfaces() belkin,f9j1108-v2|\ belkin,f9k1115-v2|\ nec,wg1400hp|\ + nec,wg1800hp|\ tplink,archer-c5-v1|\ tplink,archer-c7-v1|\ tplink,archer-c7-v2|\ diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh index e286314b9e..d17e03c748 100644 --- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh @@ -17,7 +17,8 @@ platform_check_image() { ubnt,routerstation-pro) platform_check_image_redboot_fis "$1" ;; - nec,wg1400hp) + nec,wg1400hp|\ + nec,wg1800hp) local uboot_mtd=$(find_mtd_part "bootloader") # check "U-Boot ." string in the "bootloader" partition diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index 2cbf50e5e2..94c248541d 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -2071,6 +2071,16 @@ define Device/nec_wg1400hp endef TARGET_DEVICES += nec_wg1400hp +define Device/nec_wg1800hp + SOC := qca9558 + DEVICE_MODEL := Aterm WG1800HP + IMAGE_SIZE := 16128k + NEC_FW_TYPE := H040a + $(Device/nec-netbsd-aterm) + DEVICE_PACKAGES += kmod-ath10k-ct ath10k-firmware-qca988x-ct +endef +TARGET_DEVICES += nec_wg1800hp + define Device/nec_wg800hp SOC := qca9563 DEVICE_VENDOR := NEC diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c index c7232e7115..2e56601024 100644 --- a/target/linux/ath79/image/lzma-loader/src/board.c +++ b/target/linux/ath79/image/lzma-loader/src/board.c @@ -52,7 +52,8 @@ static inline void tlwr1043nd_init(void) {} #endif #if defined(CONFIG_BOARD_MERAKI_MR18) || \ - defined(CONFIG_BOARD_NEC_WG1400HP) + defined(CONFIG_BOARD_NEC_WG1400HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP) static int extract_qca955x_sgmii_res_cal(void) { @@ -217,6 +218,7 @@ static inline void huawei_ap_init(void) {} #endif #if defined(CONFIG_BOARD_NEC_WG1400HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP) || \ defined(CONFIG_BOARD_NEC_WG600HP) || \ defined(CONFIG_BOARD_NEC_WR8750N) || \ defined(CONFIG_BOARD_NEC_WR9500N) @@ -290,7 +292,8 @@ static inline void nec_aterm_init(void) AR934X_RESET_RTC); WRITEREG(reg + AR934X_RESET_REG_RESET_MODULE, val); } -#elif defined(CONFIG_BOARD_NEC_WG1400HP) +#elif defined(CONFIG_BOARD_NEC_WG1400HP) || \ + defined(CONFIG_BOARD_NEC_WG1800HP) #define QCA955X_GMAC_MR_AN_CONTROL_PHY_RESET_MASK BIT(15) #define QCA955X_GMAC_MR_AN_CONTROL_FULL_DUPLEX_MASK BIT(8) -- 2.30.2