[openwrt/openwrt] ath79: add support for NEC Aterm WR9500N

LEDE Commits lede-commits at lists.infradead.org
Sun Jul 28 09:48:41 PDT 2024


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/bafd1aa18349e0c67dae1ca0c66fccb5c23e32db

commit bafd1aa18349e0c67dae1ca0c66fccb5c23e32db
Author: INAGAKI Hiroshi <musashino.open at gmail.com>
AuthorDate: Thu Apr 25 01:08:41 2024 +0900

    ath79: add support for NEC Aterm WR9500N
    
    NEC Aterm WR9500N is a 2.4/5 GHz band 11n (Wi-Fi 4) router, based on
    AR9344.
    
    Specification:
    
    - SoC             : Atheros AR9344
    - RAM             : DDR2 128 MiB (2x Nanya NT5TU32M16DG-AC)
    - Flash           : SPI-NOR 16 MiB (Macronix MX25L12845EMI-10G)
    - WLAN            : 2.4/5 GHz
      - 2.4 GHz       : 2T2R, Atheros AR9344 (SoC)
      - 5 GHz         : 3T3R, Atheros AR9380
    - Ethernet        : 5x 10/100/1000 Mbps
      - switch        : Atheros AR8327
    - LEDs/Keys (GPIO): 12x/4x
      - note          : all LEDs are controlled by ath9k chip (AR9380)
    - UART            : pad on PCB (near shielded ath9k chip, white circle)
      - assignment    : 3.3V, GND, TX, RX from AR8327 side
      - 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 WR9500N 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. 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 a uboot.bin image
    
       mtd write <uboot.bin image> bootloader
    
    7. Perform sysupgrade with a sysupgrade.bin image
    
       sysupgrade <sysupgrade image>
    
    8. Wait ~120 seconds to complete flashing
    
    Flash instruction using initramfs-factory.bin image (bootloader CLI):
    
     1. Connect and open serial console
     2. Power on WR9500N 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 GPIO controller on the ath9k chip
      (AR9380) and controlled by it. Those LEDs are probed after probing of
      ath9k chip, so they cannot be handled as status LEDs of OpenWrt while
      booting.
    
    - A reset pin of the internal USB hub is connected to the GPIO
      controller of the ath9k chip, like LEDs above. That hub will be
      detected after probing of the ath9k 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.
    
    MAC Addresses:
    
    LAN    : 1C:B1:7F:xx:xx:60 (config,  0x6 (hex))
    WAN    : 1C:B1:7F:xx:xx:61 (config,  0xc (hex))
    2.4 GHz: 1C:B1:7F:xx:xx:62 (config,  0x0 (hex) / art, 0x1002 (hex))
    5 GHz  : 1C:B1:7F:xx:xx:63 (config, 0x12 (hex) / art, 0x5002 (hex))
    
    Signed-off-by: INAGAKI Hiroshi <musashino.open at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/15432
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 target/linux/ath79/dts/ar9344_nec_wr9500n.dts      | 39 ++++++++++++++++++++++
 target/linux/ath79/image/lzma-loader/src/board.c   |  3 +-
 target/linux/ath79/image/tiny.mk                   | 10 ++++++
 .../ath79/tiny/base-files/etc/board.d/02_network   |  4 ++-
 .../ath79/tiny/base-files/lib/upgrade/platform.sh  |  3 +-
 5 files changed, 56 insertions(+), 3 deletions(-)

diff --git a/target/linux/ath79/dts/ar9344_nec_wr9500n.dts b/target/linux/ath79/dts/ar9344_nec_wr9500n.dts
new file mode 100644
index 0000000000..1919e09829
--- /dev/null
+++ b/target/linux/ath79/dts/ar9344_nec_wr9500n.dts
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "ar9344_nec_aterm.dtsi"
+
+/ {
+	compatible = "nec,wr9500n", "qca,ar9344";
+	model = "NEC Aterm WR9500N";
+};
+
+&keys {
+	switch-converter {
+		label = "cnv";
+		gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
+		linux,code = <BTN_2>;
+		debounce-interval = <60>;
+	};
+};
+
+&ath9k_leds {
+	led-10 {
+		gpios = <&ath9k 14 GPIO_ACTIVE_LOW>;
+		color = <LED_COLOR_ID_GREEN>;
+		function = "converter";
+	};
+
+	led-11 {
+		gpios = <&ath9k 15 GPIO_ACTIVE_LOW>;
+		color = <LED_COLOR_ID_RED>;
+		function = "converter";
+	};
+};
+
+&partitions {
+	partition at 40000 {
+		compatible = "denx,uimage";
+		label = "firmware";
+		reg = <0x040000 0xfc0000>;
+	};
+};
diff --git a/target/linux/ath79/image/lzma-loader/src/board.c b/target/linux/ath79/image/lzma-loader/src/board.c
index 04e13ea31f..c38dc14558 100644
--- a/target/linux/ath79/image/lzma-loader/src/board.c
+++ b/target/linux/ath79/image/lzma-loader/src/board.c
@@ -213,7 +213,8 @@ static inline void huawei_ap_init(void)
 static inline void huawei_ap_init(void) {}
 #endif
 
-#if defined(CONFIG_BOARD_NEC_WR8750N)
+#if defined(CONFIG_BOARD_NEC_WR8750N) || \
+    defined(CONFIG_BOARD_NEC_WR9500N)
 
 #define AR934X_PLL_SWITCH_CLK_CTRL_REG			0x24
 #define AR934X_PLL_SWITCH_CLK_CTRL_SWITCHCLK_SEL	BIT(0)
diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk
index 454bb63dab..d80ffa9400 100644
--- a/target/linux/ath79/image/tiny.mk
+++ b/target/linux/ath79/image/tiny.mk
@@ -131,6 +131,16 @@ define Device/nec_wr8750n
 endef
 TARGET_DEVICES += nec_wr8750n
 
+define Device/nec_wr9500n
+  SOC := ar9344
+  DEVICE_MODEL := Aterm WR9500N
+  BLOCKSIZE := 4k
+  IMAGE_SIZE := 16128k
+  NEC_FW_TYPE := H033
+  $(Device/nec-netbsd-aterm)
+endef
+TARGET_DEVICES += nec_wr9500n
+
 define Device/pqi_air-pen
   SOC := ar9330
   DEVICE_VENDOR := PQI
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 6f0f988309..e11c37453e 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
@@ -70,6 +70,7 @@ ath79_setup_interfaces()
 			"0 at eth1" "4:lan:1"
 		;;
 	nec,wr8750n|\
+	nec,wr9500n|\
 	tplink,tl-wr941n-v7-cn)
 		ucidef_add_switch "switch0" \
 			"0 at eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4" "1:wan"
@@ -153,7 +154,8 @@ ath79_setup_macs()
 	ubnt,picostation-m)
 		label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
 		;;
-	nec,wr8750n)
+	nec,wr8750n|\
+	nec,wr9500n)
 		wan_mac=$(mtd_get_mac_binary config 0xc)
 		label_mac=$wan_mac
 		;;
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 6b0ffd4046..19ddd29a1d 100644
--- a/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/tiny/base-files/lib/upgrade/platform.sh
@@ -12,7 +12,8 @@ platform_check_image() {
 	local board=$(board_name)
 
 	case "$board" in
-	nec,wr8750n)
+	nec,wr8750n|\
+	nec,wr9500n)
 		local uboot_mtd=$(find_mtd_part "bootloader")
 
 		# check "U-Boot <year>.<month>" string in the "bootloader" partition




More information about the lede-commits mailing list